# Compute $\int^t \tan(x)dx$.

I tried to compute $\int^t \tan(x)dx$ in two different way, but I don't get the same result, why ?

First way : $$\int^t \tan(x)dx=\int^t\frac{\sin(x)}{\cos(x)}dx\underset{u=\cos(x)}{=}-\int^{\cos(t)}\frac{1}{u}du=-\ln(\cos(t)).$$

second way : $$\int ^t\tan(x)dx\underset{x=\arctan(u)}{=}\int^{\tan(t)}\frac{u}{u^2+1}du=\frac{1}{2}\ln(\tan^2(t)+1).$$

Since I don't have the same result, which technic is correct ?

For your first integral, it's $\ln(|\cos(t)|)$. Excepting this mistakes, both are correct since $$\frac{1}{2}\ln(\tan^2(x)+1)=\ln\left(\sqrt{\tan^2(x)+1}\right)$$ and $$\frac{1}{\cos^2(x)}=1+\tan^2(x).$$