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