Solving $\int\frac{dx}{1+\tan x}$

calculusindefinite-integralsintegrationtrigonometric-integralstrigonometry

How do we solve $$\int\frac{dx}{1+\tan x}$$? I found two ways to solve it, one with the Weierstrass substitution ($t=\tan(\dfrac x2)$) and one with simply substituting $u=\tan x$ (which is better in my opinion). To solve it with the Weierstrass substitution, we get $$\int\dfrac{\frac{2}{1+t^2}}{1+\dfrac{2t}{1-t^2}}dt$$ Which is very complicated. But if we do $u=\tan x$ we would need to solve $$\int\frac{1}{(u+1)\left(u^2+1\right)}du$$Which is easier. Are there any other ways to solve this problem?

Best Answer

Alternatively, you can spot that \begin{align*} \frac{1}{1+\tan x}&=\frac{\cos x}{\cos x+\sin x} =\frac12\Big(1+\frac{\cos x-\sin x}{\cos x+\sin x}\Big), \end{align*} and noting that the latter term is of the form $f'/f$, $$\int \frac{dx}{1+\tan x}=\frac 12\Big(x+\log(\cos x+\sin x)\Big)+c.$$

Related Question