How to integrate $\int \frac{1}{\cos(x)}\,\mathrm dx$

could you help me on this integral ?

$$\int \frac{1}{\cos(x)}\,\mathrm dx$$

Here's what I've started :

$$\int \frac{1}{\cos(x)}\,\mathrm dx = \int \frac{\cos(x)}{\cos(x)^2}\,\mathrm dx = \int \frac{\cos(x)}{1-\sin(x)^2}\,\mathrm dx$$

Now, I did : $u = \sin(x)$, so $\mathrm du = 1$.

Now I have :

$$\int \frac{\text{???}}{1-u^2}\,\mathrm du$$

But at this point, I think I did the most of the job but I'm stuck. Could you help me to solve this integral please (to the integration by substitution at the end) ?

Thanks

EDIT :

Now I follow the steps and I got :

$$\int \frac{1}{1-u^2}\,\mathrm du$$ Doing the partial fraction I got $A = 1/2$ and $B = 1/2$.

So basically I have :

\begin{align} & \int \frac{1}{1-u^2}\,\mathrm du = \int \frac{1/2}{1+u}\,\mathrm du + \int \frac{1/2}{1-u}\,\mathrm du \\[8pt] = {} & \frac 1 2 \left(\int \frac{1}{1+u} \, du - \int \frac{1}{1-u} \, du\right) \\[8pt] = {} & \frac 1 2 \ln\left(\frac{1+u}{1-u}\right) = \ln\left(\left(\frac{1+\sin(x)}{1-\sin(x)}\right)^{1/2}\right) \\[8pt] = {} & \ln \left(\frac{\sqrt{1+\sin(x)}}{\sqrt{1-\sin(x)}}\right) = \ln\left(\frac{\sqrt{1+\sin(x)}}{\sqrt{\cos(x)^2}}\right) \\[8pt] = {} & \ln\left(\frac{\sqrt{1+\sin(x)}}{\cos(x)}\right) \end{align}

Here's what my teacher got :

enter image description here

What's wrong with what I did ? Did I miss something ?


Alternatively, observe that: $$ \int \dfrac{1}{\cos x} dx = \int \sec x~dx = \int \sec x \left(\dfrac{\sec x + \tan x}{\sec x + \tan x}\right) dx = \int\dfrac{\sec^2 x + \sec x \tan x}{\sec x + \tan x} dx $$ Now let $u=\sec x + \tan x$ so that $du = (\sec x \tan x + \sec^2x)~dx$. Then we obtain: $$ \int\dfrac{(\sec x \tan x + \sec^2 x)~dx}{\sec x + \tan x} = \int \dfrac{du}{u}=\ln|u|+C= \boxed{\ln|\sec x + \tan x|+C} $$


\begin{align} & \int\frac{1}{1-u^2}\,du=\frac12\int\left(\frac{1}{1+u}+\frac{1}{1-u}\right) \,du \\[8pt] = {} & \frac12(\ln(1+u)-\ln(1-u))+\color{red }{\ln c} = \ln\left(\color{red }{c}\sqrt{\frac{1+u}{1-u}} \, \right) \end{align}


$$ \frac{\sqrt{1+\sin(x)}}{\sqrt{1-\sin(x)}} = \frac{\sqrt{1+\sin(x)}\sqrt{1+\sin(x)}}{\sqrt{1-\sin(x)}\sqrt{1+\sin(x)}} = \frac{1+\sin(x)}{\sqrt{\cos(x)^2}} =\text{etc.} $$


You can also remember that :$1/\cos(x)=\sec(x)$