Evaluate the integral $$\int_0^{\pi/2} \frac{1}{1+\tan^\alpha{x}}\,\mathrm{d}x$$

  • $\begingroup$ No restrictions on $\alpha$? $\endgroup$ – John Dec 13 '13 at 17:37
  • $\begingroup$ Not as far as I know, but positive integers will probably suffice. $\endgroup$ – user85798 Dec 13 '13 at 17:38
  • $\begingroup$ Playing around with Wolfram Alpha may help. I can't do the general case with the free version but it looks like there are separate forms for the solutions for even $\alpha$ and odd $\alpha$. $\endgroup$ – John Dec 13 '13 at 17:46
  • 4
    $\begingroup$ In fact, unlike @RonGordon, mathematica spends a long time and returns the integral unevaluated. Yay! for humans. $\endgroup$ – Igor Rivin Dec 13 '13 at 18:11
  • 2
    $\begingroup$ I'm actually surprised that this hasn't (AFAICT) shown up on the site before! This is a long-time contest problem; I've most often seen it with $\alpha=\sqrt{2}$. $\endgroup$ – Steven Stadnicki Dec 13 '13 at 18:12

Use the fact that

$$\tan{\left (\frac{\pi}{2}-x\right)} = \frac{1}{\tan{x}}$$


$$\frac1{1+\tan^{\alpha}{x}} = 1-\frac{\tan^{\alpha}{x}}{1+\tan^{\alpha}{x}} = 1-\frac1{1+\frac1{\tan^{\alpha}{x}}} = 1-\frac1{1+\tan^{\alpha}{\left (\frac{\pi}{2}-x\right)}}$$

Therefore, if the sought-after integral is $I$, then

$$I = \frac{\pi}{2}-I$$


  • $\begingroup$ That's brilliant. $\endgroup$ – John Dec 13 '13 at 18:12
  • $\begingroup$ This is excellent! $\endgroup$ – user85798 Dec 13 '13 at 18:22
  • 3
    $\begingroup$ And the answer doesn't even depend on $\alpha$! Way cool. $\endgroup$ – John Dec 13 '13 at 18:27
  • $\begingroup$ This only works if $\alpha$ is a positive integer, very nice solution though. For other values all the answers to the integral are different. $\endgroup$ – Jeff Faraci Dec 13 '13 at 19:01
  • $\begingroup$ @Jeff: why? What would be the value when $\alpha \lt 0$? $\endgroup$ – Ron Gordon Dec 13 '13 at 19:02

The answer given by Gordon is very good for computing the integral. But it does not provide much why it works. The following figure might help with that

specal case a is the root of two

This is the integral for $\alpha=\sqrt{2}$. It looks as if the area under the function is exactly half of the dashed rectangle... A good guess is therefore $$ \int_0^{\pi/2} \frac{\mathrm{d}x}{1 + \tan(x)^\sqrt{2}} = \frac{1}{2}\left(\frac{\pi}{2}\right) $$ This striking symmetry can be shown true for any choice of $\alpha$, play around in geogebra or any ploting tool you fancy =)

The symmetry of such integrals is studied further in the paper Symmetri and Integration by Roger Nielsen Where it is shown that if $f(x) + f(a+b-x)$ is constant for all $x\in[a,b]$ - meaning it has this nice symmetric property.

Then the area can calculated as $$ \int_a^b f(x) \mathrm{d}x = \frac{f(a)+f(b)}{2}(b-a) = f\left(\frac{a+b}{2}\right)(b-a)\,. $$ I will leave it to you to check that $f(x)+f(a+b-x)$ is constant.

Alternatively the integral can also be computed as follows \begin{align*} \int_0^{\pi/2} \frac{\mathrm{d}\theta}{(1 + (\tan \theta)^b} = \int_0^\infty \frac{\mathrm{d}x}{(1+x^2)(1+x^b)} = \frac{1}{2} \int_0^\infty \frac{\mathrm{d}x}{1 + x^2} = \frac{\pi}{4} \end{align*} Where the substitution $u \mapsto \tan \theta$ was used and that $$ \int_0^\infty \frac{R(x)}{x^b+1}\mathrm{d}x = \frac{1}{2} \int_0^\infty R(x)\,\mathrm{d}x $$ Given that $R(x) = R(1/x)/x^2$, again check that this holds for $1/(1+x^2)$. A proof of the latter can be found on page $27$ here, section 1.9. More directly one has by the same methods \begin{align*} \int_0^\infty \frac{\mathrm{d}x}{(1+x^2)(1+x^b)} & = \int_0^1 \frac{\mathrm{d}x}{(1+x^2)(1+x^b)} + \int_1^\infty \frac{\mathrm{d}x}{(1+x^2)(1+x^b)} \\ & = \int_0^1 \frac{1}{(1+x^2)(1+x^b)} + \frac{x^b}{(1+x^2)(1+x^b)} \mathrm{d}x \\ & = \int_0^1 \frac{\mathrm{d}x}{1+x^2} = \frac{1}{2} \int_0^\infty \frac{\mathrm{d}x}{1+x^2} = \frac{\pi}{4} \end{align*} Where the substitution $x \mapsto 1/x$ was used in the last integral. These theorems and ideas are not the simplest way to attack the problem. But it might give you some broader insight further down the road.

  • 6
    $\begingroup$ I'm not entirely sure what you mean by "it does not provide much why it works." My derivation, I think, could not be any more clear about why it works: the first line I wrote says it all. $\endgroup$ – Ron Gordon Dec 13 '13 at 20:22
  • 7
    $\begingroup$ You use a "magical" substitution that in the end "happens" to work out. I try to justify the usage of $x \mapsto a+b-x$. Saying use this substitution here, does not give much explanation to as why you used it. Since $$ \int_a^b f(x) \mathrm{d}x = \int_a^b f(a+b-x) \mathrm{d}x $$ Then the integral must me constant if $f(x)+f(a+b-x)$ is constant. If the latter is constant, it means that $f$ is symmetric about the point $(c,f(x))$, where $c=(a+b)/2$. $\endgroup$ – N3buchadnezzar Dec 13 '13 at 20:32
  • 3
    $\begingroup$ Of course it "happens" to work out - that's why it's the tangent (or cotangent) function in the integrand and not, say, a log. Really, the plots are nice and numerical examples always help, but you really are making too much of this. The integral is beautiful because it is so simple...because of this unique property of the tangent. That's it. Nothing magical about it at all. $\endgroup$ – Ron Gordon Dec 13 '13 at 21:08
  • 3
    $\begingroup$ It is simple because a first grader can look at the figure and say, oh it must be $\pi/4$ =) The substitution exploits symmetry which I showcased in my answer.There hundreds upon hundreds of integrals that have this intrinsic property $\endgroup$ – N3buchadnezzar Dec 13 '13 at 21:17
  • 3
    $\begingroup$ Stop it guys, they were both good answers! $\endgroup$ – Bennett Gardiner Dec 15 '13 at 12:39

The integral can be solved by using the fact that $\tan\left(\dfrac{\pi}{2}-x\right)=\dfrac{1}{\tan x}$ and $$ \int_a^b f(x)\;dx=\int_a^b f(a+b-x)\;dx. $$ Let $$ I(\alpha)=\int_0^{\frac{\Large\pi}{2}} \frac{dx}{1+\tan^\alpha x}, $$ then $$ \begin{align} I(\alpha)&=\int_0^{\frac{\Large\pi}{2}} \frac{dx}{1+\tan^\alpha\left(\frac{\pi}{2}+0-x\right)}\\ &=\int_0^{\frac{\Large\pi}{2}} \frac{dx}{1+\dfrac{1}{\tan^\alpha x}}\\ &=\int_0^{\frac{\Large\pi}{2}} \frac{\tan^\alpha x}{1+\tan^\alpha x}dx. \end{align} $$ Adding the two $I(\alpha)$'s yields $$ \begin{align} 2I(\alpha)&=\int_0^{\frac{\Large\pi}{2}} \frac{1}{1+\tan^\alpha x}dx+\int_0^{\frac{\Large\pi}{2}} \frac{\tan^\alpha x} {1+\tan^\alpha x}dx\\ &=\int_0^{\frac{\Large\pi}{2}}\;dx\\ &=\frac{\pi}{2}\\ I(\alpha)&=\large\color{blue}{\frac{\pi}{4}}. \end{align} $$


I did NOT copy Ron Gordon's answer since this answer is taken from the similar problem that I posted on Brilliant.org - Trigonometric Integral of The Year. A similar problem can also be found on Mathworld Wolfram - Definite Integral.

  • 1
    $\begingroup$ What exactly was the point of bumping a 6 month year old question with an answer that is identical to the accepted answer then? $\endgroup$ – user85798 Jun 1 '14 at 19:20
  • 7
    $\begingroup$ @Oliver And what is exactly the reason that I cannot answer this question? Is there a rule that restricts it? $\endgroup$ – Tunk-Fey Jun 1 '14 at 19:22
  • 2
    $\begingroup$ @Tunk-Fey , if everybody is going to given exactly the same answer to a question then this is going to get very boring and ridiculous, evne more hwn you bump up a question 6 months old. This adds nothing to the asker nor to any other member. Furthermore, your claim that you didn't copy tRon's answer cannot be checked, and it indeed looks like you did copy his answer. $\endgroup$ – Timbuc Oct 28 '14 at 4:34
  • 1
    $\begingroup$ This is not identical to the crowned answer, but it is not but a formalised formulation of it. $\endgroup$ – awllower Oct 28 '14 at 4:36

Set $I(\alpha):=\int_0^{\pi/2} f(\alpha,x)dx$ where $f(\alpha,x):\mathbb{R}\times (0,\pi/2)\to \mathbb{R}$ is defined as $f(\alpha,x):=\frac{1}{1+\tan^\alpha(x)}$.

Since both $\frac{d}{d\alpha}f(\alpha,x)=-\frac{\tan^\alpha(x)\log(\tan(x))}{(1+\tan^\alpha(x))^2}$ and $f(\alpha,x)$ are continuous on $(0,\pi/2)\to \mathbb{R}$ we can apply the Leibniz integral rule obtaining

$$I'(\alpha)=\frac{d}{d\alpha}\int_0^{\pi/2}f(\alpha,x)\,dx=\int_0^{\pi/2}\frac{d}{d\alpha}f(\alpha,x)\,dx=0$$ since $\frac{d}{d\alpha}f(\alpha,\frac{\pi}{4}+x)=\frac{d}{d\alpha}f(\alpha,\frac{\pi}{4}-x)$ for $x\in[0,\frac{\pi}{4})$.

Hence $I(\alpha)$ is constant on $\mathbb{R}$ and $$I(\alpha)=I(0)=\int_0^{\pi/2}\frac{dx}{1+1}=\color{red}{\frac{\pi}{4}}.$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.