# How I Impressed My Wife: Part 6c

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.) I handled the case of $|b| = 1$ in yesterday’s post. Today, I’ll begin the case of $|b| > 1$.

To find the poles of the integrand, I use the quadratic formula to set the denominator equal to zero:

$z^4 + (4 b^2 - 2) z^2 + 1 = 0$

$z^2 = \displaystyle \frac{2-4b^2 \pm \sqrt{(4b^2-2)^2 - 4}}{2}$

$z^2 = \displaystyle \frac{2-4b^2 \pm \sqrt{16b^4 - 16b^2 + 4 - 4}}{2}$

$z^2 = \displaystyle \frac{2-4b^2 \pm \sqrt{16b^4 - 16b^2}}{2}$

$z^2 = \displaystyle \frac{2-4b^2 \pm 4|b| \sqrt{b^2 - 1}}{2}$

$z^2 = 1-2b^2 \pm 2|b| \sqrt{b^2 - 1}$

As shown earlier in this series, the right-hand side is negative if $|b| > 1$. So, for the sake of simplicity, I’ll define

$r_1 = \sqrt{2b^2 - 1 + 2|b| \sqrt{b^2 - 1}}$,

$r_2 = \sqrt{2b^2 - 1 - 2|b| \sqrt{b^2 - 1}}$,

so that the four poles of the integrand are $ir_1$, $ir_2$, $-ir_1$, and $-ir_2$. Of these, only two ($ir_1$ and $ir_2$) lie within the contour for sufficiently large $R$, and so I’ll need to compute the residues for these two poles.

Before starting that task, I notice that

$z^4 + (4 b^2 - 2) z^2 + 1 = (z - ir_1)(z + ir_1)(z - ir_2)(z + ir_2)$,

or

$z^4 + (4b^2 - 2)z^2 + 1 = (z^2 + r_1^2)(z^2 + r_2^2)$,

or

$z^4 + (4b^2 -2)z^2 + 1 = z^4 + (r_1^2 + r_2^2) z^2 + r_1^2 r_2^2$.

Matching coefficients, I see that

$r_1^2 + r_2^2 = 4b^2 - 2$,

$r_1^2 r_2^2 = 1$.

These will become very handy later in the calculation.

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

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

In this case, $g(z) = 2(1+z^2)$ and $h(z) = z^4 + (4b^2-2)z^2 + 1$ so that $h'(z) = 4z^3 + 2(4b^2-2)z$, and so the residue at $r_1$ and $r_2$ are given by

$\displaystyle \frac{2(1+[ir_1]^2)}{4 [ir_1]^3 + 2(4b^2-2) [ir_1]} = \displaystyle \frac{-i(1-r_1^2)}{-2r_1^3 + (4b^2-2) r_1}$

and

$\displaystyle \frac{2(1+[ir_2]^2)}{4 [ir_2]^3 + 2(4b^2-2) [ir_2]} = \displaystyle \frac{-i(1-r_2^2)}{-2r_2^3 + (4b^2-2) r_2}$

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

$Q = \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1} = 2\pi i \left[\frac{-i(1-r_1^2)}{-2r_1^3 + (4b^2-2) r_1} +\frac{-i(1-r_2^2)}{-2r_2^3 + (4b^2-2) r_2} \right]$

$= 2\pi \displaystyle \left[ \frac{1-r_1^2}{-2r_1^3 + (4b^2-2) r_1} +\frac{1-r_2^2}{-2r_2^3 + (4b^2-2) r_2} \right]$

So, to complete the evaluation of $Q$, I’m left with the small matter of simplifying the right-hand side. I’ll tackle this in tomorrow’s post.