# Evaluting: $\int\frac{1}{(1+\tan x)^2} dx$

I can solve this integral $$\int\frac{1}{(1+\tan x)^2} dx$$ using the substitution $t=\tan x$ i.e $x=\arctan t$. Does anyone know another way to solve this integral?

-
Would you know what to do with $$\frac12\int \frac{1+\cos\,2x}{1+\sin\,2x} \mathrm dx$$? – J. M. Jun 15 '12 at 10:10
This isn't any better than what you have, but the substitution $u=\tan(x/2)$ turns any rational expression in trig functions into a rational expression in $u$. – Gerry Myerson Jun 15 '12 at 10:46
Ask Wolfram, but this only gives a result (and not a good(!) explanation)... – draks ... Jun 15 '12 at 10:48

Using J.M.'s suggestion $$\int \frac{1}{( 1 + \tan x)^2} dx = \int \frac{\frac 12 (1 + \cos 2x)}{ \sin ^2x +2 \sin x \cos 2 + \cos ^2 x} dx = \frac 12 \int \frac{1 + \cos 2x}{1 + \sin 2x}dx$$ $$= \frac 12 \left [ \int \frac 1 {1 + \sin 2x} dx + \int \frac{\cos 2x}{1 + \sin 2x}dx\right ]$$

$$= \frac 1 2 \frac{\sin x}{\sin x + \cos x} + \frac 1 4 \ln (1 + \sin 2x) + C$$

$$= \frac 12 \left [ \frac{-1}{1 + \tan x} + \ln(\sin x + \cos x)\right ] + C$$

EDIT:: first half of split up integral $$\int \frac{1}{1 + \sin 2x} dx = \frac 1 2 \int \frac{1}{1 + \sin u} du$$ and Weierstrass substitution $$\frac 12 \int \frac{1}{1 + \frac{2t}{1 + t^2}}\frac{2dt}{1 + t^2} = \int \frac{1}{(1 + t)^2} dt$$ $$\implies \frac{-1}{1 + t} = \frac{-1}{1 + \tan x} = \frac{-\cos x}{\sin x + \cos x}$$

From wolfram I got $\int \frac{\sin x}{ \sin x + \cos x}$ Using Weierstrass substitution I got $\frac{-\cos x}{\sin x + \cos x}$ And it seems $$\frac{\sin x}{ \sin x + \cos x} - \frac{-\cos x}{\sin x + \cos x} = 1$$ Hence both are vaid :D :D

And by clicking show steps at Wolframalpha

-
Maybe the OP can follow all the steps you skipped, but I can't. How did you solve the first half of that split-up integral? – Mike Jun 15 '12 at 14:18
Sorry :( ... i got that result from wolframalpha, I updated .. above – Santosh Linkha Jun 15 '12 at 17:15
@experimentX $$\frac{\sin x}{ \sin x + \cos x} - \frac{-\cos x}{\sin x + \cos x} = 1 \neq 2$$ ;) – qoqosz Jun 15 '12 at 19:02
Hmm ... thanks for correction :) – Santosh Linkha Jun 15 '12 at 19:03

$$\frac{1}{(1+\tan x)^{2}} = \frac{(\cos x)^{2}}{(\sin x+\cos x)^{2}}$$ $$= \frac{(\cos x)^{2}(\sin x - \cos x)^{2}}{(\cos 2x)^{2}}$$ $$= \frac{(\cos 2x - 1)(1-\sin 2x)}{2(\cos 2x)^{2}}$$ $$= 1/2 (\sec 2x)-(\sec 2x)^{2}-(\tan 2x)+(\sec 2x)(\tan 2x)$$ $$\int (\sec 2x) = 1/2\ln (\sec 2x + \tan 2x)$$ $$\int(\sec 2x)^{2}=1/2\cdot \tan 2x$$ $$\int(\tan 2x) = 1/2 \ln (\cos 2x)$$ $$\int (\sec 2x)(\tan 2x)=1/2 \sec 2x$$

-