# How I Impressed My Wife: Part 3f

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

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

There are actually a couple of ways for computing this last integral. Today, I’ll lay the foundation for the “magic substitution” $u = \tan \displaystyle \frac{\phi}{2}$

With this substitution, the above integral will become a rational function, which can then be found using standard techniques.

First, we use some trig identities to rewrite $\cos 2x$ in terms of $\tan x$: $\cos 2x = 2\cos^2 x - 1$ $= \displaystyle \frac{ \sec^2 x (2 \cos^2 x - 1)}{\sec^2 x}$ $= \displaystyle \frac{ 2 - \sec^2 x)}{\sec^2 x}$ $= \displaystyle \frac{ 2 - [ 1 + \tan^2 x])}{1 + \tan^2 x}$ $= \displaystyle \frac{1- \tan^2 x}{1 + \tan^2 x}$

Next, I’ll replace $x$ by $\phi/2$: $\cos \phi = \displaystyle \frac{1- \tan^2 (\phi/2)}{1 + \tan^2 (\phi/2)} = \displaystyle \frac{1-u^2}{1+u^2}$.

Second, for the sake of completeness (even though it isn’t necessary for this particular integral), I’ll rewrite $\sin 2x$ in terms of $\tan x$: $\sin 2x = 2\sin x \cos x$ $= \displaystyle \frac{2\sin x \cos x \sec^2 x}{\sec^2 x}$ $= \displaystyle \frac{ ~ \displaystyle \frac{2 \sin x}{\cos x} ~ }{\sec^2 x}$ $= \displaystyle \frac{ 2 \tan x }{\sec^2 x}$ $= \displaystyle \frac{ 2 \tan x }{1 + \tan^2 x}$ $= \displaystyle \frac{2 \tan x}{1 + \tan^2 x}$

Next, I’ll replace $x$ by $\phi/2$: $\sin \phi = \displaystyle \frac{2 \tan^2 (\phi/2)}{1 + \tan^2 (\phi/2)} = \displaystyle \frac{2u}{1+u^2}$.

Third, again for the sake of completeness, $\tan \phi = \displaystyle \frac{\sin u}{\cos u} = \displaystyle \frac{ ~ \displaystyle \frac{2u}{1+u^2} ~ }{ ~ \displaystyle \frac{1-u^2}{1+u^2} ~ } = \displaystyle \frac{2u}{1-u^2}$.

Finally, I need to worry about what happens to the $d\phi$: $u = \tan \displaystyle \frac{\phi}{2}$ $du = \displaystyle \frac{1}{2} \sec^2 \displaystyle \frac{\phi}{2} \, d\phi$ $du = \displaystyle \frac{1}{2} \left[ 1 + \tan^2 \displaystyle \frac{\phi}{2} \right] d\phi$ $du = \displaystyle \frac{1}{2} (1+u^2) d\phi$ $\displaystyle \frac{2 du}{1+u^2} = d\phi$

These four substitutions can be used to convert trigonometric integrals into some other integral. Usually, the new integrand is pretty messy, and so these substitutions should only be used sparingly, as a last resort. I’ll continue this different method of evaluating this integral in tomorrow’s post.