# How I Impressed My Wife: Part 4a

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

where $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).

In the previous solution, I used the “magic substitution” $u = \tan \displaystyle \frac{\phi}{2}$ to convert the last integrand to a simple rational function. Starting today, I’ll use a completely different technique to compute this last integral.

The technique that I’ll use is contour integration; see Wikipedia for more details. I will use Euler’s formula as a substitution (see here and here for more details): $z = e^{i \phi} = \cos \phi + i \sin \phi$,

so that the integral $Q$ is transformed to a contour integral in the complex plane.

Under this substitution, $\displaystyle \frac{1}{z} = e^{-i\phi} = \cos(-\phi) + i \sin(-\phi) = \cos \phi - i \sin \phi$

Using these last two equations, I can solve for $\cos \phi$ and $\sin \phi$ in terms of $z$ and $\displaystyle \frac{1}{z}$. I’ll begin with $\cos \phi$: $z + \displaystyle \frac{1}{z} = \cos \phi + i \sin \phi + \cos \phi - i \sin \phi$ $z + \displaystyle \frac{1}{z} = 2 \cos \phi$ $\displaystyle \frac{1}{2} \left[z + \displaystyle \frac{1}{z} \right] = \cos \phi$

Though not necessary for this particular, let me solve for $\sin \phi$ for completeness: $z - \displaystyle \frac{1}{z} = \cos \phi + i \sin \phi - [ \cos \phi - i \sin \phi]$ $z - \displaystyle \frac{1}{z} = 2i \sin \phi$ $\displaystyle \frac{1}{2i} \left[z - \displaystyle \frac{1}{z} \right] = \sin\phi$

Finally, let me solve for the differential $d\phi$: $z = e^{i \phi}$ $dz = i e^{i \phi} d\phi$ $\displaystyle \frac{1}{i} e^{-i \phi} dz = d\phi$ $-i e^{-i \phi} dz = d\phi$ $\displaystyle -\frac{i}{z} dz = d\phi$ I’ll continue with this different method of evaluating this integral in tomorrow’s post.