# integral of $\tan^2(x/2)$

Whats the integral of $$\tan^2(x/2)dx$$ so basically what i tried is integration by parts which gave me results like $$2\tan(x/2)\log|sec(x/2)|+\frac{1}{2}\int \sec^2(x/2).\log|sec(x/2)|dx$$ but after this i tried $sec(x/2)=u$ also IVP but dint help. Help is appreciated.

• $\displaystyle \tan^2(x)=\frac{\sin^2(x)}{\cos^2(x)}=\frac{1}{\cos^2(x)}-1$ and then the integral is immediate up to factors of the inner derivative. Mar 7, 2016 at 6:41

$$\int \tan^2 t \, dt = \int \sec^2 t - 1 \, dt = \tan t - t + C$$
Set $\nu=x/2$ and $d\nu=\frac 1 2 dx$
$$=2\int \tan^2 \nu d\nu$$
$$\color{blue}{\tan^2(\nu)=\sec^2(\nu)-1}$$
$$=2\int \left(\sec^2(\nu)-1\right)d\nu=2\tan(\nu)-2\nu+\mathcal C=\color{red}{2\tan\left(\frac x 2\right)-x+\mathcal C}$$