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

# How I Impressed My Wife: Part 3e

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

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

I now write $Q$ as a new sum $Q_5 + Q_6$ by again dividing the region of integration:

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

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

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

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

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

$Q_6 = 2 \displaystyle \int_{-\pi}^{0} \frac{du}{S + R \cos u} = 2 \displaystyle \int_{-\pi}^{0} \frac{d\phi}{S + R \cos \phi}$,

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

Therefore, $Q = Q_6 + Q_5$ becomes

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

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

Once again, the fact that the integrand is over an interval of length $2\pi$ allows me to shift the interval of integration.

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

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

# How I Impressed My Wife: Part 3c

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

To simplify the denominator even further, I will combine the two trigonometric terms in the denominator; this is possible because the argument of both the sine and cosine functions are the same. To this end, notice that

$2 a \sin \theta + (1 - a^2 - b^2) \cos \theta = R \displaystyle \left[ \frac{2a}{R} \sin \theta + \frac{1-a^2-b^2}{R} \cos \theta \right]$,

where

$R = \sqrt{(2a)^2 + (1-a^2-b^2)^2}$

Next, let $\alpha$ be the unique angle so that

$\cos \alpha = \displaystyle \frac{1-a^2-b^2}{\sqrt{(2a)^2 + (1-a^2-b^2)^2}}$,

$\sin \alpha = \displaystyle \frac{2a}{\sqrt{(2a)^2 + (1-a^2-b^2)^2}}$.

With this substitution, we find that

$2 a \sin \theta + (1 - a^2 - b^2) \cos \theta = R [\cos \theta \cos \alpha + \sin \theta \sin \alpha]$

$= R \cos(\theta - \alpha)$

Therefore, the integral $Q$ may be rewritten as

$Q = 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}$ and $S = 1 + a^2 + b^2$.

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

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

# How I Impressed My Wife: Part 3a

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.
For this next technique, I begin by using the trigonometric identities

$\sin^2 x = \displaystyle \frac{1-\cos 2x}{2}$,

$\cos^2x = \displaystyle \frac{1+\cos 2x}{2}$,

$2 \sin x \cos x = \sin 2x$.

Using these identities, we obtain

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

$= \displaystyle \int_0^{2\pi} \frac{2 \, dx}{1+\cos 2x + 2 a \sin 2x + (a^2 + b^2)(1-\cos 2x)}$

In this way, the exponents have been removed from the denominator, thus making the integrand somewhat less complicated.

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

# How I Impressed My Wife: Part 2f

Some husbands try to impress their wives by lifting extremely heavy objects or other extraordinary feats of physical prowess.

That will never happen in the Quintanilla household in a million years.

But she was impressed that I broke an impasse in her research and resolved a discrepancy between Mathematica 4 and Mathematica 8 by finding the following integral by hand in less than an hour:

$Q = \displaystyle \int_0^{2\pi} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x}$

In this series, I’ll explore different ways of evaluating this integral.So far in this series, I’ve shown that

$Q = 2 \displaystyle \int_{-\pi/2}^{\pi/2} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x}$

$= 2 \displaystyle \int_{-\pi/2}^{\pi/2} \frac{\sec^2 x dx}{1 + 2 a \tan x + (a^2 + b^2) \tan^2 x}$

$= 2 \displaystyle \int_{-\infty}^{\infty} \frac{du}{1 + 2 a u + (a^2+b^2) u^2}$

$= \displaystyle \frac{2}{a^2+b^2} \int_{-\infty}^{\infty} \frac{dv}{v^2 + \displaystyle \frac{b^2}{(a^2+b^2)^2} }$

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

This last integral can be evaluated using a standard trick. Let $\theta = \tan^{-1} w$, so that $w = \tan \theta$. We differentiate this last equation with respect to $w$:

$\displaystyle \frac{dw}{dw} = \sec^2 \theta \cdot \displaystyle \frac{d\theta}{dw}$

Employing a Pythagorean identity, we have

$1 = (1+ \tan^2 \theta) \cdot \displaystyle \frac{d\theta}{dw}$

Since $w = \tan \theta$, we may rewrite this as

$1 = (1+ w^2) \cdot \displaystyle \frac{d\theta}{dw}$

$\displaystyle \frac{1}{1+w^2} = \displaystyle \frac{d\theta}{dw}$

$\displaystyle \frac{1}{1+w^2} = \displaystyle \frac{d}{dw} \tan^{-1} w$

Integrating both sides with respect to $w$, we obtain the antiderivative

$\displaystyle \int \frac{1}{1+w^2} = \tan^{-1} w + C$

We now employ this antiderivative to evaluate $Q$:

$Q = \displaystyle \frac{2}{|b|} \int_{-\infty}^{\infty} \frac{ dw }{w^2 +1}$

$= \displaystyle \frac{2}{|b|} \displaystyle \left[ \tan^{-1} w \right]^{\infty}_{-\infty}$

$= \displaystyle \frac{2}{|b|} \displaystyle \left[ \displaystyle \frac{\pi}{2} - \frac{-\pi}{2} \right]$

$= \displaystyle \frac{2\pi}{|b|}$

And so, at long last, we have arrived at the solution for the integral $Q$. Surprisingly, the answer is independent of the parameter $a$.

These last few posts illustrated the technique that I used to compute this integral for my wife in support of her recent paper in Physical Review A. However, I had more than a few false starts along the way… or, at the time, I thought they were false starts. It turns out that there are multiple ways of evaluating this integral, and I’ll explore another method of attack beginning with tomorrow’s post.

# How I Impressed My Wife: Part 2e

Some husbands try to impress their wives by lifting extremely heavy objects or other extraordinary feats of physical prowess.

That will never happen in the Quintanilla household in a million years.

But she was impressed that I broke an impasse in her research and resolved a discrepancy between Mathematica 4 and Mathematica 8 by finding the following integral by hand in less than an hour:

$Q = \displaystyle \int_0^{2\pi} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x}$

In this series, I’ll explore different ways of evaluating this integral.So far in this series, I’ve shown that

$Q = 2 \displaystyle \int_{-\pi/2}^{\pi/2} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x}$

$= 2 \displaystyle \int_{-\pi/2}^{\pi/2} \frac{\sec^2 x dx}{1 + 2 a \tan x + (a^2 + b^2) \tan^2 x}$

$= 2 \displaystyle \int_{-\infty}^{\infty} \frac{du}{1 + 2 a u + (a^2+b^2) u^2}$

$= \displaystyle \frac{2}{a^2+b^2} \int_{-\infty}^{\infty} \frac{dv}{v^2 + \displaystyle \frac{b^2}{(a^2+b^2)^2} }$

I now employ the substitution $v = \displaystyle \frac{b}{a^2+b^2} w$, so that $dv = \displaystyle \frac{b \, dw}{a^2 + b^2}$. If $b > 0$, then the interval of integration does not change under this substitution, and so

$Q = \displaystyle \frac{2}{a^2+b^2} \int_{-\infty}^{\infty} \frac{ \displaystyle \frac{b \, dw}{a^2 + b^2}}{\displaystyle \left( \displaystyle \frac{b}{a^2+b^2} w \right)^2 + \displaystyle \frac{b^2}{(a^2+b^2)^2} }$

$= \displaystyle \frac{2b}{(a^2+b^2)^2} \int_{-\infty}^{\infty} \frac{ dw }{\displaystyle \frac{b^2}{(a^2+b^2)^2} (w^2 +1)}$

$= \displaystyle \frac{2}{b} \int_{-\infty}^{\infty} \frac{ dw }{w^2 +1}$

On the other hand, if $b < 0$, then the interval of integration does not change under this substitution but the endpoints get flipped:

$Q = \displaystyle \frac{2}{a^2+b^2} \int_{\infty}^{-\infty} \frac{ \displaystyle \frac{b \, dw}{a^2 + b^2}}{\displaystyle \left( \displaystyle \frac{b}{a^2+b^2} w \right)^2 + \displaystyle \frac{b^2}{(a^2+b^2)^2} }$

$Q = \displaystyle -\frac{2}{a^2+b^2} \int_{-\infty}^{\infty} \frac{ \displaystyle \frac{b \, dw}{a^2 + b^2}}{\displaystyle \left( \displaystyle \frac{b}{a^2+b^2} w \right)^2 + \displaystyle \frac{b^2}{(a^2+b^2)^2} }$

$= \displaystyle -\frac{2b}{(a^2+b^2)^2} \int_{-\infty}^{\infty} \frac{ dw }{\displaystyle \frac{b^2}{(a^2+b^2)^2} (w^2 +1)}$

$= \displaystyle -\frac{2}{b} \int_{-\infty}^{\infty} \frac{ dw }{w^2 +1}$

I can consolidate these two cases by writing

$Q = \displaystyle \frac{2}{|b|} \int_{-\infty}^{\infty} \frac{ dw }{w^2 +1}$

Clearly, the integral diverges if $b = 0$, and so I’ll ignore this special case from now on.

I’m almost done; I’ll complete the evaluation of this integral in tomorrow’s post.

# How I Impressed My Wife: Part 2d

Some husbands try to impress their wives by lifting extremely heavy objects or other extraordinary feats of physical prowess.

That will never happen in the Quintanilla household in a million years.

But she was impressed that I broke an impasse in her research and resolved a discrepancy between Mathematica 4 and Mathematica 8 by finding the following integral by hand in less than an hour:

$Q = \displaystyle \int_0^{2\pi} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x}$

In this series, I’ll explore different ways of evaluating this integral.So far in this series, I’ve shown that

$Q = 2 \displaystyle \int_{-\pi/2}^{\pi/2} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x}$

$= 2 \displaystyle \int_{-\pi/2}^{\pi/2} \frac{\sec^2 x dx}{1 + 2 a \tan x + (a^2 + b^2) \tan^2 x}$

$= 2 \displaystyle \int_{-\infty}^{\infty} \frac{du}{1 + 2 a u + (a^2+b^2) u^2}$

To evaluate this last integral, I complete the square in the denominator. I first factor $(a^2+b^2)$ out of the denominator:

$Q = \displaystyle \frac{2}{a^2+b^2} \int_{-\infty}^{\infty} \frac{du}{u^2 + \displaystyle \frac{2 a}{a^2+b^2} u + \displaystyle \frac{1}{a^2+b^2} }$

$latex = \displaystyle \frac{2}{a^2+b^2} \int_{-\infty}^{\infty} \frac{du}{\left( u^2 + \displaystyle \frac{2 a}{a^2+b^2} u + \displaystyle \frac{a^2}{(a^2+b^2)^2} \right) + \displaystyle \frac{1}{a^2+b^2} – \displaystyle \frac{a^2}{(a^2+b^2)^2} }$

$latex = \displaystyle \frac{2}{a^2+b^2} \int_{-\infty}^{\infty} \frac{du}{\left( u + \displaystyle \frac{a}{a^2+b^2} \right)^2 + \displaystyle \frac{a^2+b^2}{(a^2+b^2)^2} – \displaystyle \frac{a^2}{(a^2+b^2)^2} }$

$latex = \displaystyle \frac{2}{a^2+b^2} \int_{-\infty}^{\infty} \frac{du}{\left( u + \displaystyle \frac{a}{a^2+b^2} \right)^2 + \displaystyle \frac{b^2}{(a^2+b^2)^2} }$

Next, I employ the substitution $v = u + \displaystyle \frac{a}{a^2+b^2}$, so that $dv = du$. The endpoint of the integral do not change with this substitution, and so

$latex Q = \displaystyle \frac{2}{a^2+b^2} \int_{-\infty}^{\infty} \frac{dv}{v^2 + \displaystyle \frac{b^2}{(a^2+b^2)^2} }$

I’ll continue with the evaluation of this integral in tomorrow’s post.

# How I Impressed My Wife: Part 2c

Some husbands try to impress their wives by lifting extremely heavy objects or other extraordinary feats of physical prowess.

That will never happen in the Quintanilla household in a million years.

But she was impressed that I broke an impasse in her research and resolved a discrepancy between Mathematica 4 and Mathematica 8 by finding the following integral by hand in less than an hour:

$Q = \displaystyle \int_0^{2\pi} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x}$

In this series, I’ll explore different ways of evaluating this integral.So far in this series, I’ve shown that

$Q = 2 \displaystyle \int_{-\pi/2}^{\pi/2} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x}$

$= 2 \displaystyle \int_{-\pi/2}^{\pi/2} \frac{\sec^2 x dx}{1 + 2 a \tan x + (a^2 + b^2) \tan^2 x}$

I now employ the substitution $u = \tan x$, so that $du = \sec^2 x dx$. Also, the endpoints change from $-\pi/2 < x < \pi/2$ to $-\infty < u < \infty$, so that

$Q = 2 \displaystyle \int_{-\infty}^{\infty} \frac{du}{1 + 2 a u + (a^2+b^2) u^2}$

I’ll continue with the evaluation of this integral in tomorrow’s post.