# How I Impressed My Wife: Part 4d

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 more 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. For this integral, that means finding the values of $z$ where the denominator is equal to 0, and then determining which of those values lie inside of the closed contour.

Let’s now see if either of the two roots of the denominator lies inside of the unit circle in the complex plane. In other words, let’s determine if $|r_1| < 1$ and/or $|r_2| < 1$.

I’ll begin with $r_1$. Clearly, the numbers $R$, $\sqrt{S^2-R^2}$, and $S$ are the lengths of three sides of a right triangle with hypotenuse $S$. So, since the hypotenuse is the longest side,

$S > \sqrt{S^2-R^2}$

or

$0 > -S + \sqrt{S^2-R^2}$

so that

$0 > \displaystyle \frac{-S + \sqrt{S^2-R^2}}{R}$.

Also, by the triangle inequality,

$R + \sqrt{S^2 - R^2} > S$

$-S + \sqrt{S^2 - R^2} > -R$

$\displaystyle \frac{-S + \sqrt{S^2-R^2}}{R} > -1$

Combining these inequalities, we see that

$-1 < \displaystyle \frac{-S + \sqrt{S^2-R^2}}{R} < 0$,

and so I see that $|r_1| < 1$, so that $r_1$ does lie inside of the contour $C$.

The second root $r_2$ is easier to handle:

$|r_2| = \left| \displaystyle \frac{-S - \sqrt{S^2 -R^2}}{R} \right| = \left| \displaystyle \frac{S + \sqrt{S^2 -R^2}}{R} \right| > \displaystyle \frac{S}{R} > 1$.

Therefore, since $r_2$ lies outside of the contour, this root is not important for the purposes of computing the above contour integral.

Now that I’ve identified the root that lies inside of the contour, I now have to compute the residue at this root. I’ll discuss this in tomorrow’s post.