# $\int_0^{\pi/2}\frac{1}{1+\tan^{n}x}dx$

I am trying to solve the integral: $$I=\int_0^{\pi/2}\frac{1}{1+\tan^{n}x}dx$$ I have tried several methods shown below: $$I(n)=\int_0^{\pi/2}\frac{1}{1+\tan^nx}dx$$ $$x=\arctan(u)$$ $$I(n)=\int_0^\infty\frac{1}{1+u^n}\frac{1}{1+u^2}du$$ but this does not seem to lead anywhere. I also tried: $$I(a)=\int_0^{\pi/2}\frac{1}{1+\tan^ax}dx$$ $$I'(a)=\int_0^{\pi/2}\frac{\ln(\tan x)}{\left(1+\tan^ax\right)^2}dx$$ but this just seems to complicate it more.

I also see that it can be expressed as: $$I(b)=\int_0^{\pi/2}\frac{1}{1+\tan^b(x)}dx=\int_0^{\pi/2}\frac{\cos^b(x)}{\cos^b(x)+\sin^b(x)}dx$$ a final thought is using the identity: $$\int_a^bf(x)dx=\int_a^bf(a+b-x)dx$$ so: $$\int_0^{\pi/2}\frac{\cos^b(x)}{\cos^b(x)+\sin^b(x)}dx=\int_0^{\pi/2}\frac{\sin^b(x)}{\sin^b(x)+\cos^b(x)}$$ and therefore: $$2I(b)=\int_0^{\pi/2}1dx=\pi/2$$ $$I(b)=\pi/4$$ $$I=\pi/4$$ does this work? Thanks

• What tf is $\tan^\pi x$ lmao... is it $(\tan x)^\pi$? – terrace Oct 7 '18 at 15:26
• Your last attempt does work. It is $\pi/2$. I handled a very, very similar integrand here. – Parcly Taxel Oct 7 '18 at 15:27
• yes $\tan^\pi(x)=(\tan x)^\pi$ – Henry Lee Oct 7 '18 at 15:28
• @terrace: wtf else could it be? – TonyK Oct 7 '18 at 15:36
• I've nominated to reopen this because I challenge the duplicate. The two questions are amenable to the same solution technique, but the problems themselves are very different. Besides which, good luck finding the unique oldest problem on here solvable that way. – J.G. Oct 7 '18 at 20:29

I would like to remark that your substitution $$x = \arctan{u}$$ works too; as follows:

Let $$u \mapsto {u}^{-1}$$ then $$\displaystyle I(n)=\int_0^\infty\frac{1}{1+{u}^{-n}}\frac{1}{1+u^{-2}} \cdot \frac{1}{u^2}\,du =\int_0^\infty\frac{1}{1+{u}^{-n}}\frac{1}{1+u^{2}} \, du$$

Hence $$\displaystyle 2I(n) = \int_0^{\infty} \frac{1}{u^2+1}\bigg(\frac{1}{1+u^n}+\frac{1}{1+u^{-n}}\bigg)\,du$$ but $$\displaystyle \frac{1}{1+u^n}+\frac{1}{1+u^{-n}} = 1$$.

Hence $$\displaystyle 2I(n) = \int_0^{\infty} \frac{1}{u^2+1}\,{du} = \frac{\pi}{2}$$ therefore $$\displaystyle I(n) = \frac{\pi}{4}$$ as you have correctly found.

Seems fine, but you got a typo at the last part. It should be $$I(b) = \pi/4$$ not $$\pi/2$$. Also we could do this quicker: $$I = \int_0^{\pi/2} \frac {\mathrm dx} {1+\tan(x)^\pi} = \int_0^{\pi/2} \frac {\mathrm dx} {1 + \cot(x)^\pi} = \int_0^{\pi/2} \frac {\tan(x)^\pi \mathrm dx}{1+ \tan(x)^\pi} \implies 2I = \frac \pi 2 \implies I = \frac \pi 4.$$

Use $$\int _a^b f(a+b-x)dx=\int_a^b f(x)dx$$ and see the magic happen. The answer is $$\frac{\pi}{4 }$$ actually it's true for any non-negative number .

• have you read the end of my answer – Henry Lee Oct 7 '18 at 15:36
• I just mean the answer in general, and why is it not true for all positive numbers? – Henry Lee Oct 7 '18 at 15:38

The usual method for integrals of this form is to use

$$t=\tan\frac{u}{2}$$

• that would give a polynomial to the power of and unknown number (or $\pi$) and it doesn't really work – Henry Lee Oct 7 '18 at 15:41