๐Ÿงฎ Brain Teaser

The Integral of 11+tanโกnx\frac{1}{1+\tan^n x}

Compute, for any real n>0n > 0:

In=โˆซ0ฯ€/211+tanโกnxโ€‰dxI_n = \int_0^{\pi/2} \frac{1}{1 + \tan^n x}\, dx

King's substitutionsymmetrydefinite integralintegration bee

Answer: Integral of 1/(1+tan^n x)

Key Idea / Intuition

The substitution xโ†ฆฯ€2โˆ’xx \mapsto \frac{\pi}{2} - x swaps tanโกx\tan x with cotโกx=1/tanโกx\cot x = 1/\tan x. When you add the original integral to the substituted version, the two integrands sum to exactly 11 everywhere on [0,ฯ€/2][0, \pi/2]. So 2In=ฯ€/22I_n = \pi/2, regardless of nn.


Formal Proof / Solution

Step 1: Apply the King's substitution x=ฯ€2โˆ’tx = \frac{\pi}{2} - t.

Under this substitution, dx=โˆ’dtdx = -dt, and when x=0x=0, t=ฯ€/2t=\pi/2; when x=ฯ€/2x=\pi/2, t=0t=0. Also: tanโกโ€‰โฃ(ฯ€2โˆ’t)=cotโกt=1tanโกt\tan\!\left(\tfrac{\pi}{2} - t\right) = \cot t = \frac{1}{\tan t}

So: In=โˆซฯ€/2011+cotโกntโ€‰(โˆ’dt)=โˆซ0ฯ€/211+cotโกntโ€‰dtI_n = \int_{\pi/2}^{0} \frac{1}{1 + \cot^n t}\,(-dt) = \int_0^{\pi/2} \frac{1}{1 + \cot^n t}\,dt

Step 2: Simplify the new integrand.

11+cotโกnt=11+1tanโกnt=tanโกnt1+tanโกnt\frac{1}{1 + \cot^n t} = \frac{1}{1 + \dfrac{1}{\tan^n t}} = \frac{\tan^n t}{1 + \tan^n t}

Step 3: Add the two expressions.

2In=โˆซ0ฯ€/211+tanโกnxโ€‰dx+โˆซ0ฯ€/2tanโกnx1+tanโกnxโ€‰dx=โˆซ0ฯ€/21+tanโกnx1+tanโกnxโ€‰dx=โˆซ0ฯ€/21โ€‰dx=ฯ€22I_n = \int_0^{\pi/2} \frac{1}{1+\tan^n x}\,dx + \int_0^{\pi/2} \frac{\tan^n x}{1+\tan^n x}\,dx = \int_0^{\pi/2} \frac{1 + \tan^n x}{1 + \tan^n x}\,dx = \int_0^{\pi/2} 1\,dx = \frac{\pi}{2}

Step 4: Conclude.

In=ฯ€4\boxed{I_n = \frac{\pi}{4}}

for every n>0n > 0, independently of nn. The result is the same whether n=1,2,1000n = 1, 2, 1000, or ฯ€\pi.


Why this is surprising: The integrand 11+tanโกnx\frac{1}{1+\tan^n x} changes its shape dramatically as nn varies โ€” for large nn it becomes nearly a step function jumping at x=ฯ€/4x = \pi/4 โ€” yet the area is always exactly ฯ€/4\pi/4. The symmetry of the interval [0,ฯ€/2][0, \pi/2] about its midpoint ฯ€/4\pi/4 is the hidden reason.

Type: IntegrationEdit on GitHub โ†—