# How I Impressed My Wife: Part 4c

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}$,

where this last integral is taken over the complex plane on the unit circle, a closed contour oriented counterclockwise. Also, $R = \sqrt{(2a)^2 + (1-a^2-b^2)^2}$ and $S = 1 + a^2 + b^2$ (and $\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. In this case, that means finding which root(s) of the denominator lie inside the unit circle in the complex plane.

To begin, we use the quadratic formula to find the roots of the denominator:

$z^2 + 2\frac{S}{R}z + 1 = 0$

$Rz^2 + 2Sz + R = 0$

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

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

So we have the two roots $r_1 = \displaystyle \frac{-S + \sqrt{S^2 -R^2}}{R}$ and $r_2 = \displaystyle \frac{-S - \sqrt{S^2 -R^2}}{R}$. Earlier in this series, I showed that $S > R > 0$ as long as $b \ne 0$, and so the denominator has two distinct real roots. So the integral $Q$ may be rewritten as

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

Next, we have to determine if either $r_1$ or $r_2$ (or both) lies inside of the contour. I’ll discuss this in tomorrow’s post.