# How I Impressed My Wife: Part 3b

Previously in this series, I showed 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|}.$

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.
So far, I have shown 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 \int_0^{2\pi} \frac{2 \, dx}{1+\cos 2x + 2 a \sin 2x + (a^2 + b^2)(1-\cos 2x)}$

We now employ the substitution $\theta = 2x$, so that $d\theta = 2 \, dx$. Also, the limits of integration change from $0 \le x \le 2\pi$ to $0 \le \theta \le 4\pi$, so that

$Q = \displaystyle \int_0^{4\pi} \frac{d\theta}{1+\cos \theta + 2 a \sin \theta + (a^2 + b^2)(1-\cos \theta)}$

$= \displaystyle \int_0^{4\pi} \frac{d\theta}{(1+a^2+b^2) + 2 a \sin \theta + (1 - a^2 - b^2) \cos \theta}$

Next, I’ll divide write $Q = Q_1 + Q_2$ by dividing the interval of integration (not to be confused with the $Q_1$ and $Q_2$ used in the previous method), where

$Q_1 = \displaystyle \int_0^{2\pi} \frac{d\theta}{(1+a^2+b^2) + 2 a \sin \theta + (1 - a^2 - b^2) \cos \theta}$

$Q_2 = \displaystyle \int_{2\pi}^{4\pi} \frac{d\theta}{(1+a^2+b^2) + 2 a \sin \theta + (1 - a^2 - b^2) \cos \theta}$

For $Q_2$, I employ the substitution $u = \theta - 2\pi$, so that $\theta = u + 2\pi$ and $du = d\theta$. Under this substitution, the interval of integration changes from $2\pi \le \theta \le 4\pi$ to $0 \le u \le 2\pi$, and so

$Q_2 = \displaystyle \int_{0}^{2\pi} \frac{du}{(1+a^2+b^2) + 2 a \sin (u+2\pi) + (1 - a^2 - b^2) \cos (u+2\pi)}$

Next, I use the periodic property for both sine and cosine — $\sin(u + 2\pi) = \sin u$ and $\cos(u+ 2\pi) = \cos u$ — to rewrite $Q_2$ as

$Q_2 = \displaystyle \int_{0}^{2\pi} \frac{du}{(1+a^2+b^2) + 2 a \sin u + (1 - a^2 - b^2) \cos u}$

Except for the dummy variable $u$, instead of $\theta$, we see that $Q_2$ is identical to $Q_1$. Therefore,

$Q = Q_1 + Q_2 = 2 Q_1 = 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}$.

I’ll continue this different method of evaluating this integral in tomorrow’s post.