# Computing $\int_0^{\pi\over2} \frac{dx}{1+\sin^2(x)}$?

How would you compute$$\int_0^{\pi\over2} \frac{dx}{1+\sin^2(x)}\, \, ?$$

• by residues, of course :) – Start wearing purple May 14 '13 at 15:50
• how could one use residues? I can't seem to see where this function (if it were complex) has a pole! – user53076 May 14 '13 at 16:14
• Well you have to 1) use parity to extend the integration domain to $[-\pi/2,\pi/2]$, then 2) express $\sin^2x$ in terms of $\cos2x$, and then 3) pass to the complex variable $z=e^{2ix}$ (contour of integration then becomes the unit circle $|z|=1$). – Start wearing purple May 14 '13 at 16:20

Put $z=e^{i x}$; then the integral is equal to

$$i \oint_{|z|=1} dz \frac{z}{z^4-6 z^2+1}$$

There are four poles at

$$z = \pm \sqrt{2} \pm 1$$

only two of which are within the unit circle ($z = \pm (\sqrt{2}-1)$). The residues from each of these poles are equal and are each

$$\frac{i}{4 (\sqrt{2}-1)^2-12} = \frac{-i}{8 \sqrt{2}}$$

The sum of the residues is double that residue. The integral is then $i 2 \pi$ times that sum; I get

$$\int_0^{\pi/2} \frac{dx}{1+\sin^2{x}} = \frac{\pi}{2 \sqrt{2}}$$

• He has only a quarter of unit circle initially. – Start wearing purple May 14 '13 at 16:53
• @O.L.: That is built into my analysis. The factor of $1/4$ cancels an equal factor in the denominator. – Ron Gordon May 14 '13 at 16:57
• WHOA! How did you get the first bit? – user53076 May 14 '13 at 17:28
• $z=e^{i x}$, $dx = -i dz/z$. Then use $\sin{x} = (z-z^{-1})/(2 i)$. Do the algebra. Note that you only have $1/4$ of a full circle in your integral, so you must multiply by $1/4$. – Ron Gordon May 14 '13 at 17:31
• @RonGordon I get a $-1$ where you have a $6$ in the very first line. Are we totally sure that the $6$ is correct? – The Count Jan 5 '17 at 2:47

HINT:

$$\int_0^{\pi\over2} \frac{dx}{1+\sin^2(x)}= \int_0^{\pi\over2} \frac{\csc^2xdx}{\csc^2x+1}=\int_0^{\pi\over2} \frac{\csc^2xdx}{\cot^2x+2}$$

Put $\cot x=u$

$$\int_0^{\frac \pi 2} \frac{1}{1 + \sin^2x}dx = \int_0^{\frac \pi 2} \frac{2}{3 - \cos 2x} dx = \int_0^\pi \frac{d\theta}{3 - \cos \theta } = \frac 12\int_0^{2\pi}\frac{d\theta}{3 - \cos \theta}$$

To evaluate $\displaystyle \int_0^{2\pi}\frac{1}{3 - \cos \theta}d\theta$ let $\displaystyle z = e^{i\theta} \implies \cos \theta = \frac{z^2 + 1}{2z}, d\theta = \frac{1}{iz}dz$

$$\int_0^{2\pi}\frac{1}{3 - \cos \theta}d\theta = \frac 2{i}\oint_{|z| = 1} \frac{1}{-z^2 + 6z - 1}dz$$

The poles are $3 - 2 \sqrt 2$ and $3 + 2 \sqrt 2$, and since $3 + 2 \sqrt 2 > 1$,

$$\frac 2{i}\oint_{|z| = 1} \frac{1 }{-z^2 + 6z - 1}dz = 4\pi \text{Res}\left[ \frac{1}{-z^2 + 6z - 1} , 3 - 2 \sqrt 2\right] = \frac{\pi}{\sqrt 2}$$

So $\displaystyle \int_0^{\frac \pi 2} \frac{1}{1 + \sin^2x}dx = \frac{\pi }{2 \sqrt 2}$

\begin{align} \int_0^{\pi/2} \dfrac{dx}{1+\sin^2(x)} & = \int_0^{\pi/2}\sum_{k=0}^{\infty}(-1)^k \sin^{2k}(x) dx = \sum_{k=0}^{\infty}(-1)^k \int_0^{\pi/2}\sin^{2k}(x) dx\\ & = \sum_{k=0}^{\infty} \dfrac{(-1)^k}{4^k} \dbinom{2k}k\dfrac{\pi}2 = \dfrac1{\sqrt{1-4\times \left(\dfrac{-1}4\right)}} \dfrac{\pi}2 = \dfrac{\pi}{2\sqrt2} \end{align} where we used

$\dfrac1{1+r} = \displaystyle \sum_{k=0}^{\infty}(-r)^k$; $\displaystyle \int_0^{\pi/2} \sin^{2k}(x) dx = \dbinom{2k}k \dfrac{\pi}{2^{2k+1}}$; $\dfrac1{\sqrt{1-4x}} = \displaystyle\sum_{k=0}^{\infty} \dbinom{2k}k x^k \,\, \forall x \in \left[-\dfrac14,\dfrac14 \right)$