$$\int\sec x \,\mathrm dx = \ln\left|\sec{x} + \tan{x}\right|+ C = \ln{\left|\tan\left(\frac{x}{2} + \frac{\pi}{4}\right)\right|} + C$$
My question is how? How are these derived?
$$\int\sec x \,\mathrm dx = \ln\left|\sec{x} + \tan{x}\right|+ C = \ln{\left|\tan\left(\frac{x}{2} + \frac{\pi}{4}\right)\right|} + C$$
My question is how? How are these derived?
It is well-known that
$$ \int \csc x dx = \ln \tan \frac x 2. $$ Shifting the integration variable by $\pi/2$ gives, using the fact that $\sin(x+\pi/2) = \cos x$,
$$ \int \sec x dx= \ln \tan \left({\frac x 2 + \frac \pi 4 }\right). $$
To prove the first integral, write $$ \csc x = \frac{1}{2 \sin(x/2) \cos(x/2) } = \frac 1 2 \left[\cot \frac x 2 + \tan \frac x 2 \right]. $$