# How I Impressed My Wife: Part 6b

This series was inspired by a question that my wife asked me: calculate

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

Originally, I multiplied the top and bottom of the integrand by $\tan^2 x$ and performed a substitution. However, as I’ve discussed in this series, there are four different ways that this integral can be evaluated.
Starting with today’s post, I’ll begin a fifth method. I really like this integral, as it illustrates so many different techniques of integration as well as the trigonometric tricks necessary for computing some integrals.

Since $Q$ is independent of $a$, I can substitute any convenient value of $a$ that I want without changing the value of $Q$. As shown in previous posts, substituting $a =0$ yields the following simplification:

$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{dx}{\cos^2 x + 2 \cdot 0 \cdot \sin x \cos x + (0^2 + b^2) \sin^2 x}$

$= \displaystyle \int_{0}^{2\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

$= \displaystyle \int_{-\pi}^{\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

$= \displaystyle \int_{-\infty}^{\infty} \frac{ 2(1+u^2) du}{u^4 + (4 b^2 - 2) u^2 + 1}$

$= \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1}$,

where $C_R$ is the contour in the complex plane shown below (graphic courtesy of Mathworld).

Amazingly, contour integrals can be simply computed by evaluating the residues at every pole located inside of the contour. (See Wikipedia and Mathworld for more details.) In today’s post, I’ll use this method if $|b| = 1$. In this case,

$Q = \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 \cdot 1 - 2) z^2 + 1}$

$= \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + 2 z^2 + 1}$

$= \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{(1+z^2)^2}$

$= \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2 dz}{1+z^2}$

I now set the denominator equal to zero to find the poles:

$z^2 + 1 = 0$

$z^2 = -1$

$z = \pm i$.

For sufficiently large $R$, there is only one pole within the contour, namely $z_1 = i$.

The integrand has the form $\displaystyle g(z)/h(z)$, and the pole has order one. As shown earlier in this series, the residue at such pole is equal to

$\displaystyle \frac{g(z_1)}{h'(z_1)}$.

In this case, $g(z) = 2$ and $h(z) = 1+z^2$ so that $h'(z) = 2z$, and so the residue is $\displaystyle \frac{2}{2i} = -i$.

Finally, to evaluate the contour integral, I simply the sum of the residues within the contour by $2\pi i$:

$Q = \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2 dz}{1+z^2} = 2\pi i (-i) = 2\pi$.

Unsurprisingly, this matches the results found earlier. Somewhat surprisingly, all of the imaginary parts cancel themselves out, leaving only a real number.

The case of $|b| = 1$ was very straightforward. I’ll start the case of $|b| > 1$ in tomorrow’s post.