General formula for $\int_0^{\pi/2} \tan^{\alpha}(x) dx$?

There are already questions about how to find $$\int \tan^{1/2}(x) dx$$. But how to derive a general formula for $$\int_0^{\pi/2} \tan^{\alpha}(x) dx$$ (which converges if $$|\alpha|<1$$) ?

More details: I have to evaluate this integral because I want to derive Euler's reflection formula for gamma functions. The integral above is the result of using a substitution $$v=\tan^2(x)$$ in $$\int_0^\infty \frac{v^\beta}{1+v} dv$$

• Euler's Reflection Formula is proven in this answer, which is referenced in my answer below. – robjohn Feb 1 at 4:03

3 Answers

With $$u=\tan x$$, we have $$\int_0^{\frac \pi 2} \tan^\alpha (x)dx=\int_0^{+\infty}\frac{u^\alpha}{1+u^2}du$$ Now, according to this question: $$\int_0^\infty \frac{x^{\alpha}dx}{1+2x\cos\beta +x^{2}}=\frac{\pi\sin (\alpha\beta)}{\sin (\alpha\pi)\sin \beta }$$ So, plugging in $$\beta=\frac \pi 2$$ yields $$\int_0^{\frac \pi 2} \tan^\alpha (x)dx=\frac{\pi\sin(\frac {\alpha \pi}2)}{\sin(\alpha \pi)}=\frac{\pi}{2\cos(\frac{\alpha\pi}{2})}$$

Consider the integral $$I(a,b)=\int_0^{\pi/2}\sin(x)^a\cos(x)^b\mathrm dx,\qquad a,b>-1$$ Setting $$t=\sin(x)^2$$: $$I(a,b)=\frac12\int_0^1t^{\frac{a-1}2}(1-t)^{\frac{b-1}2}\mathrm dt$$ Then recall the definition of the beta function $$\mathrm{B}(a,b)=\int_0^1t^{a-1}(1-t)^{b-1}\mathrm dt=\frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}$$ We use this to see that $$I(a,b)=\frac{\Gamma(\frac{a+1}2)\Gamma(\frac{b+1}2)}{2\Gamma(\frac{a+b}2+1)}$$ Hence $$\int_0^{\pi/2}\tan(x)^a\mathrm dx=\frac12\Gamma\left(\frac{1+a}2\right)\Gamma\left(\frac{1-a}2\right)$$ Then using $$\Gamma(1-s)\Gamma(s)=\frac{\pi}{\sin\pi s}$$ It can be easily shown that $$\Gamma\left(\frac{1+s}2\right)\Gamma\left(\frac{1-s}2\right)=\pi\sec\frac{\pi s}2$$ So $$\int_0^{\pi/2}\tan(x)^a\mathrm dx=\frac\pi2\sec\frac{\pi a}2$$ Which you know works for $$|a|<1$$.

This can be used to show that $$\int_0^{\pi/2} \log^{n}[\tan x]\mathrm dx=\frac\pi2\left(\frac{d}{da}\right)^n\sec\frac{\pi a}2\,\bigg|_{a=0}$$ Or simply $$\int_0^{\pi/2} \tan(x)^{a}\log^{n}[\tan x]\mathrm dx=\frac\pi2\left(\frac{d}{da}\right)^n\sec\frac{\pi a}2$$ To show this just take $$\left(\frac{d}{da}\right)^n$$ on both sides for integer $$n$$.

\begin{align} \int_0^{\pi/2}\tan^\alpha(x)\,\mathrm{d}x &=\int_0^\infty\frac{x^\alpha}{1+x^2}\,\mathrm{d}x\tag1\\ &=\frac\pi2\csc\left(\pi\frac{\alpha+1}2\right)\tag2\\[3pt] &=\frac\pi2\sec\left(\frac{\pi\alpha}2\right)\tag3 \end{align} Explanation:
$$(1)$$: substitute $$x\mapsto\arctan(x)$$
$$(2)$$: use this answer
$$(3)$$: trigonometric identity