# How I Impressed My Wife: Part 3d

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

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

where $R = \sqrt{(2a)^2 + (1-a^2-b^2)^2}$, $S = 1 + a^2 + b^2$, and $\alpha$ is a certain angle (that will soon become irrelevant).

I now write $Q$ as a new sum $Q_3 + Q_4$ by dividing the region of integration:

$Q_3 = 2 \displaystyle \int_{0}^{\alpha} \frac{d\theta}{S + R \cos (\theta - \alpha)}$,

$Q_4 = 2 \displaystyle \int_{\alpha}^{2\pi} \frac{d\theta}{S + R \cos (\theta - \alpha)}$.

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

$Q_3 = 2 \displaystyle \int_{2\pi}^{2\pi + \alpha} \frac{du}{S + R \cos (u - 2\pi - \alpha)}$

Next, I employ the trigonometric identity $\cos(u - 2\pi - \alpha) = \cos (u -\alpha)$:

$Q_3 = 2 \displaystyle \int_{2\pi}^{2\pi + \alpha} \frac{du}{S + R \cos (u - \alpha)} = 2 \displaystyle \int_{2\pi}^{2\pi + \alpha} \frac{d\theta}{S + R \cos (\theta - \alpha)}$,

where I have changed the dummy variable from $u$ back to $\theta$.

Therefore, $Q = Q_4 + Q_3$ becomes

$Q = 2 \displaystyle \int_{\alpha}^{2\pi} \frac{d\theta}{S + R \cos (\theta - \alpha)} + 2 \displaystyle \int_{2\pi}^{2\pi + \alpha} \frac{d\theta}{S + R \cos (\theta - \alpha)}$

$= 2 \displaystyle \int_{\alpha}^{2\pi + \alpha} \frac{d\theta}{S + R \cos (\theta - \alpha)}$.

Next, I employ the substitution $\phi = \theta - \alpha$, so that $d\phi = d\theta$ and the interval of integration changes from $\alpha \le \theta \le 2\pi + \alpha$ to $0 \le \phi \le 2\pi$:

$Q = 2 \displaystyle \int_{0}^{2\pi} \frac{d\phi}{S + R \cos \phi}$.

Almost by magic, the mysterious angle $\alpha$ has completely disappeared, making the integral that much easier to compute.

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