# Show $I = \int_0^{\pi} \frac{\mathrm{d}x}{1+\cos^2 x} = \frac{\pi}{\sqrt 2}$

Show $$I = \int_0^{\pi} \frac{\mathrm{d}x}{1+\cos^2 x} = \frac{\pi}{\sqrt 2}$$

-
The substitution $t=\tan(x)$ is suggested/explained by the so-called Règles de Bioche and reduces the problem to $\int\limits\frac{\mathrm dt}{t^2+2}$, an easy-to-crack nut. – Did Mar 29 '12 at 1:13

First notice that the function $\displaystyle{\frac{1}{1+\cos^2 x}}$ is an even function, and therefore

$$\int_0^{\pi} \frac{\mathrm{d}x}{1+\cos^2 x} = 2 \int_0^{\frac{\pi}{2}} \frac{\mathrm{d}x}{1+\cos^2 x}$$

\begin{align*} 2 \int_0^{\frac{\pi}{2}} \frac{1}{1+\cos^2 x} \,\mathrm{d}x &= 2 \int_0^{\frac{\pi}{2}} \frac{\frac{1}{\cos^2 x}}{\left(\frac{1}{\cos^2 x}+1\right)}\mathrm{d}x \\ &= 2 \int_0^{\frac{\pi}{2}} \frac{\sec^2 x}{\sec^2 x+1} \mathrm{d}x \\ &= 2 \int_0^{\frac{\pi}{2}} \frac{\sec^2 x}{(\tan^2 x+1)+1} \mathrm{d}x & (\text{because} \hspace{4pt} \sec^2 x=\tan^2 x+1)\\ &= \int_0^{\frac{\pi}{2}} \frac{{\small{2}} \sec^2 x}{\tan^2 x+2} \mathrm{d}x \\ &= \int_0^{\frac{\pi}{2}} \frac{\sec^2 x}{\left(\frac{\tan x}{\sqrt 2}\right)^2+1}\mathrm{d}x \end{align*} Now substitute $$\frac{\tan x}{\sqrt 2} = t \Longrightarrow \sec^2 x \; \mathrm{d}x = \sqrt 2 \; \mathrm{d}t \hspace{5pt}$$ applying the new limits, the integral gets simplfied to

\begin{align*} \sqrt 2 \int_0^\infty \frac{\mathrm{d}t}{t^2+1} &= \sqrt 2 \left( \left. \tan^{-1} t \right|_0^\infty \right) \\ &= \sqrt 2 \left(\frac{\pi}{2}\right) = \frac{\pi}{\sqrt{2}} \end{align*}

-
You wrote all that in five minutes!?! :-) – joriki Mar 28 '12 at 21:47
I had that in my notes somewhere (Well actually if you notice one of my earlier answers, I had both together in my notes) - took me 2 minutes to find it though :) – Kirthi Raman Mar 28 '12 at 21:49
I see -- nice coincidence. Still, +1 even just for $\TeX$ing all that in five minutes. Or do you take notes in $\TeX$? :-) – joriki Mar 28 '12 at 21:51
@joriki sorry, I misinterpreted that comment. (snipurl.com/22thxa1 is the earlier question. My math notes are all in Latex, so no need to type them) – Kirthi Raman Mar 28 '12 at 22:04

In case KV's solution seems a bit magical, it may be reassuring to know that there's a systematic way to integrate rational functions of trigonometric functions, the Weierstraß substitution.

With $\cos x=(1-t^2)/(1+t^2)$ and $\mathrm dx=2/(1+t^2)\mathrm dt$,

$$\begin{eqnarray} \int_0^\pi \frac{\mathrm dx}{1+\cos^2 x} &=& \int_0^\infty\frac2{1+t^2} \frac1{1+\left(\frac{1-t^2}{1+t^2}\right)^2}\mathrm dt \\ &=& \int_0^\infty \frac{2(1+t^2)}{(1+t^2)^2+(1-t^2)^2}\mathrm dt \\ &=& \int_0^\infty \frac{1+t^2}{1+t^4}\mathrm dt\;. \end{eqnarray}$$

Here's where it gets a bit tedious. The zeros of the denominator are the fourth roots of $-1$, and assembling the conjugate linear factors into quadratic factors yields

$$\begin{eqnarray} \int_0^\infty \frac{1+t^2}{1+t^4}\mathrm dt &=& \int_0^\infty \frac{1+t^2}{(t^2+\sqrt2t+1)(t^2-\sqrt2t+1)}\mathrm dt \\ &=& \frac12\int_0^\infty \frac1{(t^2+\sqrt2t+1)}+\frac1{(t^2-\sqrt2t+1)}\mathrm dt \\ &=& \frac12\left[\sqrt2\arctan(1+\sqrt2t)-\sqrt2\arctan(1-\sqrt2t)\right]_0^\infty \\ &=& \frac\pi{\sqrt2}\;. \end{eqnarray}$$

-
If we make the standard "Weierstrass" $t=\tan(x/2)$ substitution, we get $\cos t=\frac{1-t^2}{1+t^2}$ and $dx=\frac{2\,dt}{1+t^2}$. We end up quickly with $$\int_0^\infty \frac{1+t^2}{1+t^4}\,dt.$$ But $1+t^4=(1-\sqrt{2}t+t^2)(1+\sqrt{2}t +t^2)$, so by partial fractions our integrand is $$\frac{1}{2-2\sqrt{2}t+2t^2} +\frac{1}{2+2\sqrt{2}t+2t^2}.$$ Completing the squares, we end up with the integrand $$\frac{1}{1+(\sqrt{2}t-1)^2}+\frac{1}{1+(\sqrt{2}t+1)^2}.$$ The substitutions $u=\sqrt{2} t-1$ and $u=\sqrt{2}t+1$ give $$\int_{-1}^\infty \frac{1}{\sqrt{2}}\frac{du}{1+u^2}+\int_{1}^\infty \frac{1}{\sqrt{2}}\frac{du}{1+u^2}.$$ The first integral is $(1/\sqrt{2})(3\pi/4)$ and the second is $(1/\sqrt{2})(\pi/4)$. Add. We get $\pi/\sqrt{2}$.
Based on KV Raman,$\displaystyle{\frac{1}{1+\cos^2 x}}$ is even function.
$$\int_0^{\pi} \frac{\mathrm{d}x}{1+\cos^2 x} = 2 \int_0^{\frac{\pi}{2}} \frac{\mathrm{d}x}{1+\cos^2 x}$$ \begin{align*} \int_0^{\frac{\pi}{2}} \frac{1}{1+\cos^2 x} \,\mathrm{d}x &=\int_0^{\frac{\pi}{2}}\frac{\mathrm{d}x}{\sin^2 x+2\cos^2 x}\\ &= \int_0^{\frac{\pi}{2}}\frac{\sec^2 x\mathrm{d}x}{\tan ^2 x+2}\\ &=\int_0^{\frac{\pi}{2}}\frac{\mathrm{d}\tan x}{\tan ^2 x +2}\\ \end{align*} below is the same
Nice answer. There was an extra $x$ which edited out. +1 for this. – user21436 Mar 29 '12 at 3:13