# Integrating $\int\frac{1}{cos(\theta)}d\theta$ by following certain steps

$\int\frac{1}{\cos\theta}d\theta$

So I have this integral here and the solution manual wants the solving to follow a specific level of steps. This integral is okay on it's own but I'm having trouble doing it the way the solutions have suggested. And I'd like to know how it's done.

1. Write it as $\int\frac{\cos\theta}{\cos^2\theta}d\theta$

2. Make the substitution $u = \sin\theta$

3. Use partial fractions to complete the integration

4. Multiply a fraction in your answer your answer top and bottom by $1+sin\theta$

5. Show that $\tan^2\theta+1 = \frac{1}{\cos^2\theta}$

6. Hence write your answer without using any trig functions except tan.

This confuses me because I'm not sure how to follow this step process. I believe the answer without the tan only restriction to be $log(\tan(θ) + \sec(θ)) + C$. But I could be wrong in my substitution methods.

Thank you in advance. :)

I think it should be $$\int\frac{1}{\cos{x}}dx=\int\frac{\cos{x}}{\cos^2x}dx=\int\frac{1}{1-\sin^2x}d(\sin{x})=$$ $$=\frac{1}{2}\int\left(\frac{1}{1-\sin{x}}+\frac{1}{1+\sin{x}}\right)d(\sin{x})=$$ $$=\frac{1}{2}\ln\frac{1+\sin{x}}{1-\sin{x}}+C=\ln\sqrt{\frac{1+\sin{x}}{1-\sin{x}}}+C=$$ $$=\ln\sqrt{\frac{1-\cos\left(\frac{\pi}{2}+x\right)}{1+\cos\left(\frac{\pi}{2}+x\right)}}+C=\ln\sqrt{\tan^2\left(\frac{\pi}{4}+\frac{x}{2}\right)}+C=\ln\left|\tan\left(\frac{\pi}{4}+\frac{x}{2}\right)\right|+C.$$
$1+\tan^2\theta=\frac{1}{\cos^2\theta}$, but here is useless I think.