# How I Impressed My Wife: Part 4e

Previously in this series, I have used two different techniques to show that

$Q = \displaystyle \int_0^{2\pi} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x} = \displaystyle \frac{2\pi}{|b|}.$

Originally, my wife had asked me to compute this integral by hand because Mathematica 4 and Mathematica 8 gave different answers. At the time, I eventually obtained the solution by multiplying the top and bottom of the integrand by $\sec^2 x$ and then employing the substitution $u = \tan x$ (after using trig identities to adjust the limits of integration).
But this wasn’t the only method I tried. Indeed, I tried two or three different methods before deciding they were too messy and trying something different. So, for the rest of this series, I’d like to explore different ways that the above integral can be computed.
Here’s my progress so far:

$Q = \displaystyle \int_0^{2\pi} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x}$

$= \displaystyle \int_0^{2\pi} \frac{2 \, dx}{1+\cos 2x + 2 a \sin 2x + (a^2 + b^2)(1-\cos 2x)}$

$= 2 \displaystyle \int_0^{2\pi} \frac{d\theta}{(1+a^2+b^2) + 2 a \sin \theta + (1 - a^2 - b^2) \cos \theta}$

$= 2 \displaystyle \int_{0}^{2\pi} \frac{d\theta}{S + R \cos (\theta - \alpha)}$

$= 2 \displaystyle \int_{0}^{2\pi} \frac{d\phi}{S + R \cos \phi}$

$= \displaystyle -\frac{4i}{R} \oint_C \frac{dz}{z^2 + 2\frac{S}{R}z + 1}$

$= \displaystyle -\frac{4i}{R} \oint_C \frac{dz}{(z - r_1)(z- r_2)}$

where this last integral is taken over the complex plane on the unit circle, a closed contour oriented counterclockwise. Also,

$r_1 = \displaystyle \frac{-S + \sqrt{S^2 -R^2}}{R}$

and

$r_2 = \displaystyle \frac{-S - \sqrt{S^2 -R^2}}{R}$,

are the two distinct roots of the denominator (as long as $b \ne 0$). In these formulas,$R = \sqrt{(2a)^2 + (1-a^2-b^2)^2}$ and $S = 1 + a^2 + b^2$. (Also, $\alpha$ is a certain angle that is now irrelevant at this point in the calculation).

This contour integral looks complicated; however, it’s an amazing fact that integrals over closed contours can be easily evaluated by only looking at the poles of the integrand. In yesterday’s post, I established that $r_1$ lies inside the contour, but $r_2$ lies outside of the contour.

The next step of the calculation is finding the residue at $r_1$; see Wikipedia and Mathworld for more information. This means rewriting the rational function

$\displaystyle \frac{1}{(z - r_1)(z - r_2)}$

as a power series (technically, a Laurent series) about the point $z = r_1$. This can be done by using the formula for an infinite geometric series (see here, here, and here):

$\displaystyle \frac{1}{(z - r_1)(z - r_2)} = \displaystyle \frac{1}{z-r_1} \times \frac{1}{z-r_2}$

$= \displaystyle \frac{-1}{z-r_1} \times \frac{1}{r_2-z}$

$= \displaystyle \frac{-1}{z-r_1} \times \frac{1}{(r_2-r_1) - (z-r_1)}$

$= \displaystyle \frac{-1}{z-r_1} \times \frac{1}{r_2-r_1} \times \frac{ 1}{ 1 - \displaystyle \frac{z-r_1}{r_2-r_1} }$

$= \displaystyle \frac{-1}{z-r_1} \times \frac{1}{r_2-r_1} \left[ 1 + \left( \displaystyle \frac{z-r_1}{r_2-r_1} \right) + \left( \displaystyle \frac{z-r_1}{r_2-r_1} \right)^2 + \left( \displaystyle \frac{z-r_1}{r_2-r_1} \right)^3 + \dots \right]$

$= \displaystyle \frac{-1}{z-r_1} \times \frac{1}{r_2-r_1} - \frac{1}{(r_2-r_1)^2} - \frac{z-r_1}{(r_2-r_1)^3} - \frac{(z-r_1)^2}{(r_2-r_1)^4} \dots$

The residue of the function at $z = r_1$ is defined to be the constant multiplying the $\displaystyle \frac{1}{z-r_1}$ term in the above series. Therefore,

The residue at $x = r_1$ is $\displaystyle \frac{-1}{r_2-r_1} = \displaystyle \frac{1}{r_1-r_2}$

From the definitions of $r_1$ and $r_2$ above,

$\displaystyle \frac{1}{r_1-r_2} = \displaystyle \frac{1}{\displaystyle \frac{-S + \sqrt{S^2 -R^2}}{R} - \frac{-S - \sqrt{S^2 -R^2}}{R}}$

$= \displaystyle \frac{1}{ ~ 2 \displaystyle \frac{\sqrt{S^2-R^2}}{R} ~ }$

$= \displaystyle \frac{R}{ 2 \sqrt{S^2-R^2} }$

Now that I’ve identified the residue of the only root that lies inside of the contour, we are in position to evaluate the contour integral above. I’ll discuss this in tomorrow’s post.