Okay, so I'm trying to find $ \int \frac1{\cos x}\mathrm{d}x$ using the substitution $t = \tan\left(\frac{x}{2}\right)$.
I sub in the trig identity for $\sec$ as $\frac{1+t^2}{1-t^2}$ and then rearrange and substitute $\frac{\mathrm{d}t}{\mathrm{d}x} = \frac12 \left(1+ \tan^2\left(\frac{x}{2}\right)\right)$ so I am left with
$\frac2{1-t^2}$
I then used partial fractions to find
$\frac2{1-t^2} = \frac1{1+t} + \frac1{1-t}$
and therefore integrating I get
$\int \frac1{\cos x}dx = \ln(t+1) - \ln(t-1)$
But subbing in $t = \tan\left(\frac{x}{2}\right)$ doesn't seem to get me anywhere close to the solution that I want to find, which is:
$ \int \frac1{\cos x}\mathrm{d}x = \ln(\sec x + \tan x) + C$
Any help on this would be greatly appreciated.
Thanks!