$\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
 A: 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.  
$$
A: 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. 
A: 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
.
A: The usual method for integrals of this form is to use
$$t=\tan\frac{u}{2}$$
