# How I Impressed My Wife: Part 3h

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

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

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

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

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

We now employ the substitution

$u = \displaystyle \sqrt{ \frac{S+R}{S-R} } v$,

so that

$du = \displaystyle \sqrt{ \frac{S+R}{S-R} } dv$.

Before going much further, let’s take a closer look at $R$ and $S$ to make sure that $\displaystyle \frac{S+R}{S-R}$ is positive (so that the square root is defined).

First, both $S$ and $R$ are clearly positive, and so $S+R > 0$.

Next, notice that

$S^2 - R^2 = (1+a^2+b^2)^2 - (1-a^2-b^2)^2 - (2a)^2$

$S^2 - R^2 = [(1 + a^2 + b^2) + (1-a^2-b^2)][(1 + a^2 + b^2) - (1 - a^2 -b^2)] - 4a^2$

$S^2 - R^2 = 2[2 a^2 + 2b^2] - 4a^2$

$S^2 - R^2 = 4b^2$

So $S^2 - R^2 > 0$ as long as $b > 0$. Therefore, since $S + R > 0$:

$S^2 - R^2 > 0$

$(S+R)(S-R) > 0$

$S - R > 0$

So, since $S + R > 0$ and $S - R > 0$, we have $\displaystyle \frac{S+R}{S-R} > 0$, and so the above substitution is well-defined.

We now employ the above substitution. The endpoints of integration remain unchanged, and so

$Q = 4 \displaystyle \int_{-\infty}^{\infty} \frac{\displaystyle \sqrt{ \frac{S+R}{S-R} } dv}{(S + R) + \left[ \displaystyle \sqrt{ \frac{S+R}{S-R} } v \right]^2 (S - R)}$

$= 4 \displaystyle \int_{-\infty}^{\infty} \frac{\displaystyle \sqrt{ \frac{S+R}{S-R} } dv}{(S + R) + (S + R) v^2}$

$= \displaystyle \frac{4}{S+R} \sqrt{ \frac{S+R}{S-R}} \int_{-\infty}^{\infty} \frac{dv}{1 + v^2}$

$= \displaystyle 4 \sqrt{ \frac{1}{(S+R)(S-R)}} \int_{-\infty}^{\infty} \frac{dv}{1 + v^2}$

$= \displaystyle 4 \sqrt{ \frac{1}{S^2-R^2}} \int_{-\infty}^{\infty} \frac{dv}{1 + v^2}$

$= \displaystyle 4 \sqrt{ \frac{1}{4b^2}} \int_{-\infty}^{\infty} \frac{dv}{1 + v^2}$

$= \displaystyle \frac{4}{2|b|} \int_{-\infty}^{\infty} \frac{dv}{1 + v^2}$

$= \displaystyle \frac{2}{|b|} \int_{-\infty}^{\infty} \frac{dv}{1 + v^2}$

In the above calculation, I used the fact that $S^2 - R^2 = 4b^2$, which was derived above. Also, I was careful to avoid a common algebraic mistake.

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