# How I Impressed My Wife: Part 6g

This series was inspired by a question that my wife asked me: calculate

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

Originally, I multiplied the top and bottom of the integrand by $\tan^2 x$ and performed a substitution. However, as I’ve discussed in this series, there are four different ways that this integral can be evaluated.
Starting with today’s post, I’ll begin a fifth method. I really like this integral, as it illustrates so many different techniques of integration as well as the trigonometric tricks necessary for computing some integrals.

Since $Q$ is independent of $a$, I can substitute any convenient value of $a$ that I want without changing the value of $Q$. As shown in previous posts, substituting $a =0$ yields the following simplification:

$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{dx}{\cos^2 x + 2 \cdot 0 \cdot \sin x \cos x + (0^2 + b^2) \sin^2 x}$

$= \displaystyle \int_{0}^{2\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

$= \displaystyle \int_{-\pi}^{\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

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

$= \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1}$

$= 2\pi i \left[\displaystyle \frac{r_1}{r_1^2-1} + \displaystyle \frac{r_2}{r_2^2-1} \right]$,

where I’ve made the assumption that $|b| < 1$. In the above derivation, $C_R$ is the contour in the complex plane shown below (graphic courtesy of Mathworld).

Also,

$r_1 = \sqrt{1-b^2} + |b|i$

and

$r_2 = -\sqrt{1-b^2} + |b|i$

are the two poles of the final integrand that lie within this contour.

It now remains to simplify the final algebraic expression. To begin, I note

$\displaystyle \frac{r_1}{r_1^2-1} = \displaystyle \frac{\sqrt{1-b^2} + |b|i}{[\sqrt{1-b^2} + |b|i]^2 - 1}$

$= \displaystyle \frac{\sqrt{1-b^2} + |b|i}{1-b^2 + 2|b|i\sqrt{1-b^2} - |b|^2 - 1}$

$= \displaystyle \frac{\sqrt{1-b^2} + |b|i}{-2|b|^2 + 2|b|i\sqrt{1-b^2}}$

$= \displaystyle \frac{\sqrt{1-b^2} + |b|i}{2|b|i(|b|i +\sqrt{1-b^2})}$

$= \displaystyle \frac{1}{2|b|i}$.

Similarly,

$\displaystyle \frac{r_2}{r_2^2-1} = \displaystyle \frac{-\sqrt{1-b^2} + |b|i}{[-\sqrt{1-b^2} + |b|i]^2 - 1}$

$= \displaystyle \frac{-\sqrt{1-b^2} + |b|i}{1-b^2 - 2|b|i\sqrt{1-b^2} - |b|^2 - 1}$

$= \displaystyle \frac{-\sqrt{1-b^2} + |b|i}{-2|b|^2 - 2|b|i\sqrt{1-b^2}}$

$= \displaystyle \frac{-\sqrt{1-b^2} + |b|i}{2|b|i(|b|i -\sqrt{1-b^2})}$

$= \displaystyle \frac{1}{2|b|i}$.

Therefore,

$Q = 2\pi i \left[\displaystyle \frac{r_1}{r_1^2-1} + \displaystyle \frac{r_2}{r_2^2-1} \right] = 2\pi i \left[ \displaystyle \frac{1}{2|b|i} + \frac{1}{2|b| i} \right] = 2\pi i \displaystyle \frac{2}{2|b|i} = \displaystyle \frac{2\pi}{|b|}$.

And so, at long last, I’ve completed a fifth different evaluation of $Q$.

# How I Impressed My Wife: Part 6f

This series was inspired by a question that my wife asked me: calculate

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

Originally, I multiplied the top and bottom of the integrand by $\tan^2 x$ and performed a substitution. However, as I’ve discussed in this series, there are four different ways that this integral can be evaluated.
Starting with today’s post, I’ll begin a fifth method. I really like this integral, as it illustrates so many different techniques of integration as well as the trigonometric tricks necessary for computing some integrals.

Since $Q$ is independent of $a$, I can substitute any convenient value of $a$ that I want without changing the value of $Q$. As shown in previous posts, substituting $a =0$ yields the following simplification:

$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{dx}{\cos^2 x + 2 \cdot 0 \cdot \sin x \cos x + (0^2 + b^2) \sin^2 x}$

$= \displaystyle \int_{0}^{2\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

$= \displaystyle \int_{-\pi}^{\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

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

$= \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1}$,

where $C_R$ is the contour in the complex plane shown below (graphic courtesy of Mathworld).

Amazingly, contour integrals can be simply computed by evaluating the residues at every pole located inside of the contour. (See Wikipedia and Mathworld for more details.) I have already handled the case of $|b| = 1$ and $|b| > 1$. Today, I begin the final case of $|b| < 1$.

Earlier in this series, I showed that

$z^4 + (4b^2 - 2) z^2 + 1 = (z^2 + 2z \sqrt{1-b^2} + 1)(z^2 - 2z \sqrt{1-b^2} + 1)$

if $|b| < 1$, and so the quadratic formula can be used to find the four poles of the integrand:

$r_1 = \sqrt{1-b^2} + |b|i$,

$r_2 = -\sqrt{1-b^2} + |b|i$,

$r_3 = \sqrt{1-b^2} - |b|i$,

$r_4 = -\sqrt{1-b^2} - |b|i$.

Of these, only two lie ($r_1$ and $r_2$) within the contour for sufficiently large $R$ (actually, for $R > 1$ since all four poles lie on the unit circle in the complex plane).

As shown earlier in this series, the residue at each pole is given by

$\displaystyle \frac{r^2 + 1}{2r^3 + (4b^2-2)r}$

I’ll now simplify this considerably by using the fact that $r^4 + (4b^2-2)r^2 + 1 = 0$ at each pole:

$\displaystyle \frac{r^2 + 1}{2r^3 + (4b^2-2)r} = \displaystyle \frac{r(r^2+1)}{2r^4+(4b^2)-r^2}$

$= \displaystyle \frac{r(r^2+1)}{r^4+r^4 + (4b^2)-r^2}$

$= \displaystyle \frac{r(r^2+1)}{r^4-1}$

$= \displaystyle \frac{r(r^2+1)}{(r^2+1)(r^2-1)}$

$= \displaystyle \frac{r}{r^2-1}$.

Therefore, to evaluate the contour integral, I simply the sum of the residues within the contour and multiply the sum by $2\pi i$:

$Q = \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1} = 2\pi i \left[\displaystyle \frac{r_1}{r_1^2-1} + \displaystyle \frac{r_2}{r_2^2-1} \right]$.

So, to complete the evaluation of $Q$, I need to simplify the right-hand side. I’ll complete this in tomorrow’s post.

# How I Impressed My Wife: Part 6e

This series was inspired by a question that my wife asked me: calculate

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

Originally, I multiplied the top and bottom of the integrand by $\tan^2 x$ and performed a substitution. However, as I’ve discussed in this series, there are four different ways that this integral can be evaluated.
Starting with today’s post, I’ll begin a fifth method. I really like this integral, as it illustrates so many different techniques of integration as well as the trigonometric tricks necessary for computing some integrals.

Â nvenient value of $a$ that I want without changing the value of $Q$. As shown in previous posts, substituting $a =0$ yields the following simplification:

$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{dx}{\cos^2 x + 2 \cdot 0 \cdot \sin x \cos x + (0^2 + b^2) \sin^2 x}$

$= \displaystyle \int_{0}^{2\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

$= \displaystyle \int_{-\pi}^{\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

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

$= \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1}$

$= 2\pi \displaystyle \left[ \frac{1-r_1^2}{-2r_1^3 + (4b^2-2) r_1} +\frac{1-r_2^2}{-2r_2^3 + (4b^2-2) r_2} \right]$

where I’ve assumed $|b| > 1$, the contour $C_R$ in the complex plane is shown below (graphic courtesy of Mathworld),

and the positive constants $r_1$ and $r_2$ are given by

$r_1 = \sqrt{2b^2 - 1 + 2|b| \sqrt{b^2 - 1}}$,

$r_2 = \sqrt{2b^2 - 1 - 2|b| \sqrt{b^2 - 1}}$.

Now we have the small matter of simplifying our expression for $Q$. Actually, this isn’t a small matter because Mathematica 10.1 is not able to simplify this expression much at all:

Fortunately, humans can still do some things that computers can’t. The numbers $r_1$ and $r_2$ are chosen so that $\pm ir_1$ and $\pm ir_2$ are the roots of the denominator $z^4 + (4 b^2 - 2) z^2 + 1$. In other words,

$[ir_1]^4 + (4b^2 - 2) [ir_1]^2 + 1 = r_1^4 - [4b^2-2] r_1^2 + 1 = 0$,

$r_2^4 - [4b^2-2] r_2^2 + 1 = 0$

These relationships will be very handy for simplifying our expression for $Q$:

$Q = 2\pi \displaystyle \left[ \frac{1-r_1^2}{-2r_1^3 + (4b^2-2) r_1} +\frac{1-r_2^2}{-2r_2^3 + (4b^2-2) r_2} \right]$

$= 2\pi \left[ \displaystyle \frac{r_1^2-1}{2r_1^3-(4b^2-2)r_1} + \frac{r_2^2-1}{2r_2^3-(4b^2-2)r_2} \right]$

$= 2\pi \left[ \displaystyle \frac{r_1(r_1^2-1)}{2r_1^4-(4b^2-2)r_1^2} + \frac{r_2(r_2^2-1)}{2r_2^4-(4b^2-2)r_2^2} \right]$

$= 2\pi \left[ \displaystyle \frac{r_1(r_1^2-1)}{r_1^4 + r_1^4-(4b^2-2)r_1^2} + \frac{r_2(r_2^2-1)}{r_2^4+r_2^4-(4b^2-2)r_2^2} \right]$

$= 2\pi \left[ \displaystyle \frac{r_1(r_1^2-1)}{r_1^4 -1} + \frac{r_2(r_2^2-1)}{r_2^4-1} \right]$

$= 2\pi \left[ \displaystyle \frac{r_1(r_1^2-1)}{(r_1^2 -1)(r_1^2+1)} + \frac{r_2(r_2^2-1)}{(r_2^2-1)(r_2^2+1)} \right]$

$= 2\pi \left[ \displaystyle \frac{r_1}{r_1^2+1} + \frac{r_2}{r_2^2+1} \right]$

$= 2\pi \displaystyle \frac{r_1(r_2^2+1)+(r_1^2+1)r_2}{(r_1^2+1)(r_2^2+1)}$

$= 2\pi \displaystyle \frac{r_1 r_2^2+r_1+r_1^2 r_2 +r_2}{(r_1^2+1)(r_2^2+1)}$

$= 2\pi \displaystyle \frac{r_1 +r_2 + r_1 r_2 (r_1 + r_2)}{(r_1^2+1)(r_2^2+1)}$

$= 2\pi \displaystyle \frac{(r_1 +r_2)(1 + r_1 r_2)}{(r_1^2+1)(r_2^2+1)}$

To complete the calculation, we recall that

$r_1 = \sqrt{2b^2 - 1 + 2|b| \sqrt{b^2 - 1}}$,

$r_2 = \sqrt{2b^2 - 1 - 2|b| \sqrt{b^2 - 1}}$,

so that

$r_1^2 + r_2^2 = 4b^2 - 2$,

$r_1^2 r_2^2 = 1$,

and hence

$r_1 r_2 = 1$

since $r_1$ and $r_2$ are both positive. Also,

$(r_1 + r_2)^2 = r_1^2 + 2r_1 r_2 + r_2^2 = 4b^2 -2 + 2 = 4b^2$,

so that

$r_1 + r_2 = 2|b|$.

Finally,

$(r_1^2 + 1)(r_2^2 + 1) = (2b^2 + 2|b| \sqrt{b^2-1})(2b^2 - 2|b| \sqrt{b^2 -1})$

$= 4b^4 - 4b^2 (b^2-1)$

$= 4b^2$.

Therefore,

$Q = 2\pi \displaystyle \frac{(r_1 +r_2)(1 + r_1 r_2)}{(r_1^2+1)(r_2^2+1)} = 2\pi \displaystyle \frac{ 2|b| \cdot (1 + 1)}{4b^2} = \displaystyle \frac{8\pi |b|}{4 |b|^2} = \displaystyle \frac{2\pi}{|b|}$.

So far, I’ve evaluated the integral $Q$ for the cases $|b| = 1$ and $|b| > 1$. Beginning with tomorrow’s post, I’ll evaluate the integral for the case $|b| < 1$. As it turns out, the method presented above will again be utilized for simplifying the two residues.

# How I Impressed My Wife: Part 6d

This series was inspired by a question that my wife asked me: calculate

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

Originally, I multiplied the top and bottom of the integrand by $\tan^2 x$ and performed a substitution. However, as I’ve discussed in this series, there are four different ways that this integral can be evaluated.
Starting with today’s post, I’ll begin a fifth method. I really like this integral, as it illustrates so many different techniques of integration as well as the trigonometric tricks necessary for computing some integrals.

Â nvenient value of $a$ that I want without changing the value of $Q$. As shown in previous posts, substituting $a =0$ yields the following simplification:

$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{dx}{\cos^2 x + 2 \cdot 0 \cdot \sin x \cos x + (0^2 + b^2) \sin^2 x}$

$= \displaystyle \int_{0}^{2\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

$= \displaystyle \int_{-\pi}^{\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

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

$= \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1}$

$= 2\pi \displaystyle \left[ \frac{1-r_1^2}{-2r_1^3 + (4b^2-2) r_1} +\frac{1-r_2^2}{-2r_2^3 + (4b^2-2) r_2} \right]$

where I’ve assumed $|b| > 1$, the contour $C_R$ in the complex plane is shown below (graphic courtesy of Mathworld),

and the positive constants $r_1$ and $r_2$ are given by

$r_1 = \sqrt{2b^2 - 1 + 2|b| \sqrt{b^2 - 1}}$,

$r_2 = \sqrt{2b^2 - 1 - 2|b| \sqrt{b^2 - 1}}$.

Now we have the small matter of simplifying our expression for $Q$. Actually, this isn’t a small matter because Mathematica 10.1 is not able to simplify this expression much at all:

Fortunately, humans can still do some things that computers can’t. As observed yesterday, The numbers $r_1$ and $r_2$ are chosen so that $\pm ir_1$ and $\pm ir_2$ are the roots of the denominator $z^4 + (4 b^2 - 2) z^2 + 1$, so that

$r_1^2 + r_2^2 = 4b^2 - 2$,

$r_1 r_2 = 1$.

These relationships will be very handy for simplifying our expression for $Q$:

$Q = 2\pi \displaystyle \left[ \frac{1-r_1^2}{-2r_1^3 + (4b^2-2) r_1} +\frac{1-r_2^2}{-2r_2^3 + (4b^2-2) r_2} \right]$

$= 2\pi \left[ \displaystyle \frac{1-r_1^2}{r_1 (-2r_1^2 + 4b^2-2)} + \frac{1-r_2^2}{r_2(-2r_2^2 + 4b^2-2)} \right]$

$= 2\pi \left[ \displaystyle \frac{1-r_1^2}{r_1 (-2r_1^2 +r_1^2 + r_2^2)} + \frac{1-r_2^2}{r_2(-2r_2^2 + r_1^2 + r_2^2)} \right]$

$= 2\pi \left[ \displaystyle \frac{1-r_1^2}{r_1 (-r_1^2 +r_2^2)} + \frac{1-r_2^2}{r_2(r_1^2 -r_2^2)} \right]$

Â $= 2\pi \left[ \displaystyle \frac{r_1^2-1}{r_1 (r_1^2 -r_2^2)} + \frac{1-r_2^2}{r_2(r_1^2 -r_2^2)} \right]$

$= 2\pi \displaystyle \frac{(r_1^2-1)r_2 + r_1(1-r_2^2)}{r_1 r_2 (r_1^2 -r_2^2)}$

Â $= 2\pi \displaystyle \frac{r_1^2 r_2- r_2 + r_1- r_1 r_2^2)}{r_1 r_2 (r_1^2 -r_2^2)}$

$= 2\pi \displaystyle \frac{r_1 - r_2 + r_1 r_2 (r_1 - r_2)}{r_1 r_2 (r_1-r_2)(r_1 + r_2)}$

$= 2\pi \displaystyle \frac{(r_1 - r_2)(1 + r_1 r_2)}{r_1 r_2 (r_1-r_2)(r_1 + r_2)}$

$= 2\pi \displaystyle \frac{1 + r_1 r_2}{r_1 r_2 (r_1 + r_2)}$

$= 2\pi \displaystyle \frac{1 + 1}{1 \cdot (r_1 + r_2)}$

$= \displaystyle \frac{4\pi}{r_1 + r_2}$

To complete the calculation, I observe that

$(r_1 + r_2)^2 = r_1^2 + 2r_1 r_2 + r_2^2 = 4b^2 -2 + 2 = 4b^2$,

so that

$r_1 + r_2 = 2|b|$.

Therefore,

$Q = \displaystyle \frac{4\pi}{r_1 + r_2} = \displaystyle \frac{4\pi}{2|b|} = \displaystyle \frac{2\pi}{|b|}$.

In tomorrow’s post, I’ll present another way to simplify this nasty algebraic expression.

# How I Impressed My Wife: Part 6c

This series was inspired by a question that my wife asked me: calculate

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

Originally, I multiplied the top and bottom of the integrand by $\tan^2 x$ and performed a substitution. However, as I’ve discussed in this series, there are four different ways that this integral can be evaluated.
Starting with today’s post, I’ll begin a fifth method. I really like this integral, as it illustrates so many different techniques of integration as well as the trigonometric tricks necessary for computing some integrals.

Since $Q$ is independent of $a$, I can substitute any convenient value of $a$ that I want without changing the value of $Q$. As shown in previous posts, substituting $a =0$ yields the following simplification:

$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{dx}{\cos^2 x + 2 \cdot 0 \cdot \sin x \cos x + (0^2 + b^2) \sin^2 x}$

$= \displaystyle \int_{0}^{2\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

$= \displaystyle \int_{-\pi}^{\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

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

$= \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1}$,

where $C_R$ is the contour in the complex plane shown below (graphic courtesy of Mathworld).

Amazingly, contour integrals can be simply computed by evaluating the residues at every pole located inside of the contour. (See Wikipedia and Mathworld for more details.) I handled the case of $|b| = 1$ in yesterday’s post. Today, I’ll begin the case of $|b| > 1$.

To find the poles of the integrand, I use the quadratic formula to set the denominator equal to zero:

$z^4 + (4 b^2 - 2) z^2 + 1 = 0$

$z^2 = \displaystyle \frac{2-4b^2 \pm \sqrt{(4b^2-2)^2 - 4}}{2}$

$z^2 = \displaystyle \frac{2-4b^2 \pm \sqrt{16b^4 - 16b^2 + 4 - 4}}{2}$

$z^2 = \displaystyle \frac{2-4b^2 \pm \sqrt{16b^4 - 16b^2}}{2}$

$z^2 = \displaystyle \frac{2-4b^2 \pm 4|b| \sqrt{b^2 - 1}}{2}$

$z^2 = 1-2b^2 \pm 2|b| \sqrt{b^2 - 1}$

As shown earlier in this series, the right-hand side is negative if $|b| > 1$. So, for the sake of simplicity, I’ll define

$r_1 = \sqrt{2b^2 - 1 + 2|b| \sqrt{b^2 - 1}}$,

$r_2 = \sqrt{2b^2 - 1 - 2|b| \sqrt{b^2 - 1}}$,

so that the four poles of the integrand are $ir_1$, $ir_2$, $-ir_1$, and $-ir_2$. Of these, only two ($ir_1$ and $ir_2$) lie within the contour for sufficiently large $R$, and so I’ll need to compute the residues for these two poles.

Before starting that task, I notice that

$z^4 + (4 b^2 - 2) z^2 + 1 = (z - ir_1)(z + ir_1)(z - ir_2)(z + ir_2)$,

or

$z^4 + (4b^2 - 2)z^2 + 1 = (z^2 + r_1^2)(z^2 + r_2^2)$,

or

$z^4 + (4b^2 -2)z^2 + 1 = z^4 + (r_1^2 + r_2^2) z^2 + r_1^2 r_2^2$.

Matching coefficients, I see that

$r_1^2 + r_2^2 = 4b^2 - 2$,

$r_1^2 r_2^2 = 1$.

These will become very handy later in the calculation.

The integrand has the form $\displaystyle g(z)/h(z)$, and each pole has order one. As shown earlier in this series, the residue at such pole is equal to

$\displaystyle \frac{g(r)}{h'(r)}$.

In this case, $g(z) = 2(1+z^2)$ and $h(z) = z^4 + (4b^2-2)z^2 + 1$ so that $h'(z) = 4z^3 + 2(4b^2-2)z$, and so the residue at $r_1$ and $r_2$ are given by

$\displaystyle \frac{2(1+[ir_1]^2)}{4 [ir_1]^3 + 2(4b^2-2) [ir_1]} = \displaystyle \frac{-i(1-r_1^2)}{-2r_1^3 + (4b^2-2) r_1}$

and

$\displaystyle \frac{2(1+[ir_2]^2)}{4 [ir_2]^3 + 2(4b^2-2) [ir_2]} = \displaystyle \frac{-i(1-r_2^2)}{-2r_2^3 + (4b^2-2) r_2}$

Finally, to evaluate the contour integral, I simply the sum of the residues within the contour and then multiply the sum by $2\pi i$:

$Q = \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1} = 2\pi i \left[\frac{-i(1-r_1^2)}{-2r_1^3 + (4b^2-2) r_1} +\frac{-i(1-r_2^2)}{-2r_2^3 + (4b^2-2) r_2} \right]$

$= 2\pi \displaystyle \left[ \frac{1-r_1^2}{-2r_1^3 + (4b^2-2) r_1} +\frac{1-r_2^2}{-2r_2^3 + (4b^2-2) r_2} \right]$

So, to complete the evaluation of $Q$, I’m left with the small matter of simplifying the right-hand side. I’ll tackle this in tomorrow’s post.

# How I Impressed My Wife: Part 6b

This series was inspired by a question that my wife asked me: calculate

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

Originally, I multiplied the top and bottom of the integrand by $\tan^2 x$ and performed a substitution. However, as I’ve discussed in this series, there are four different ways that this integral can be evaluated.
Starting with today’s post, I’ll begin a fifth method. I really like this integral, as it illustrates so many different techniques of integration as well as the trigonometric tricks necessary for computing some integrals.

Since $Q$ is independent of $a$, I can substitute any convenient value of $a$ that I want without changing the value of $Q$. As shown in previous posts, substituting $a =0$ yields the following simplification:

$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{dx}{\cos^2 x + 2 \cdot 0 \cdot \sin x \cos x + (0^2 + b^2) \sin^2 x}$

$= \displaystyle \int_{0}^{2\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

$= \displaystyle \int_{-\pi}^{\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

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

$= \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1}$,

where $C_R$ is the contour in the complex plane shown below (graphic courtesy of Mathworld).

Amazingly, contour integrals can be simply computed by evaluating the residues at every pole located inside of the contour. (See Wikipedia and Mathworld for more details.) In today’s post, I’ll use this method if $|b| = 1$. In this case,

$Q = \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 \cdot 1 - 2) z^2 + 1}$

$= \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + 2 z^2 + 1}$

$= \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{(1+z^2)^2}$

$= \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2 dz}{1+z^2}$

I now set the denominator equal to zero to find the poles:

$z^2 + 1 = 0$

$z^2 = -1$

$z = \pm i$.

For sufficiently large $R$, there is only one pole within the contour, namely $z_1 = i$.

The integrand has the form $\displaystyle g(z)/h(z)$, and the pole has order one. As shown earlier in this series, the residue at such pole is equal to

$\displaystyle \frac{g(z_1)}{h'(z_1)}$.

In this case, $g(z) = 2$ and $h(z) = 1+z^2$ so that $h'(z) = 2z$, and so the residue is $\displaystyle \frac{2}{2i} = -i$.

Finally, to evaluate the contour integral, I simply the sum of the residues within the contour by $2\pi i$:

$Q = \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2 dz}{1+z^2} = 2\pi i (-i) = 2\pi$.

Unsurprisingly, this matches the results found earlier. Somewhat surprisingly, all of the imaginary parts cancel themselves out, leaving only a real number.

The case of $|b| = 1$ was very straightforward. I’ll start the case of $|b| > 1$ in tomorrow’s post.

# How I Impressed My Wife: Part 6a

This series was inspired by a question that my wife asked me: calculate

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

Originally, I multiplied the top and bottom of the integrand by $\tan^2 x$ and performed a substitution. However, as I’ve discussed in this series, there are four different ways that this integral can be evaluated.
Starting with today’s post, I’ll begin a fifth method. I really like this integral, as it illustrates so many different techniques of integration as well as the trigonometric tricks necessary for computing some integrals.
Since $Q$ is independent of $a$, I can substitute any convenient value of $a$ that I want without changing the value of $Q$. As shown in previous posts, substituting $a =0$ yields the following simplification:

$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{dx}{\cos^2 x + 2 \cdot 0 \cdot \sin x \cos x + (0^2 + b^2) \sin^2 x}$

$= \displaystyle \int_{0}^{2\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

$= \displaystyle \int_{-\pi}^{\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}$

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

Earlier, I evaluated this last integral using partial fractions, separating into the cases $|b| = 1$, $|b| > 1$, and $|b| < 1$. Now, I’ll calculate this same integral using contour integration. (See Wikipedia and Mathworld for more details.)

It turns out that $Q$ can be rewritten as

$Q = \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1}$,

where $C_R$ is the contour in the complex plane shown above (graphic courtesy of Mathworld). That’s because

$\displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1}$

$= \displaystyle \lim_{R \to \infty} \int_{-R}^R \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1} + \lim_{R \to \infty} \int_{\gamma_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1}$

$= \displaystyle \int_{-\infty}^{\infty} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1} + \lim_{R \to \infty} \int_{\gamma_R} \frac{ 2(1+z^2) du}{z^4 + (4 b^2 - 2) z^2 + 1}$

$= Q + \displaystyle \lim_{R \to \infty} \int_{\gamma_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1}$

To show that the limit of the last integral is equal to 0, I use the parameterization $z = R e^{i \theta}$, so that $dz = i R e^{i \theta}$:

$\displaystyle \lim_{R \to \infty} \left| \int_{\gamma_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1} \right|$

$= \displaystyle \lim_{R \to \infty} \left| \int_0^{\pi} \frac{ 2R(1+R^2 e^{2i\theta}) d\theta}{R^4 e^{4 i\theta} + (4 b^2 - 2) R^2 e^{2i\theta} + 1} \right|$

$\le \displaystyle \lim_{R \to \infty} \pi \max_{0 \le \theta \le \pi} \left| \frac{ 2R(1+R^2 e^{2i\theta})}{R^4 e^{4 i\theta} + (4 b^2 - 2) R^2 e^{2i\theta} + 1} \right|$

$= \displaystyle \pi \max_{0 \le \theta \le \pi} \lim_{R \to \infty} \left| \frac{ 2R(1+R^2 e^{2i\theta})}{R^4 e^{4 i\theta} + (4 b^2 - 2) R^2 e^{2i\theta} + 1} \right|$

$= \displaystyle \pi \max_{0 \le \theta \le \pi} 0$

$= 0$.

The above limit is equal to zero because the numerator grows like $R^3$ while the denominator grows like $R^4$. (This can be more laboriously established using L’Hopital’s rule).

Therefore, I have shown that

$Q = \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1}$,

and this contour integral can be computed using residues.

I’ll continue with this fifth evaluation of the integral, starting with the case $|b| = 1$, in tomorrow’s post.

# How I Impressed My Wife: Part 4h

So far in this series, I have used three different techniques to show 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|}$.

For the third technique, a key step in the calculation was showing that the residue of the function

$f(z) = \displaystyle \frac{1}{z^2 + 2\frac{S}{R}z + 1} = \displaystyle \frac{1}{(z-r_1)(z-r_2)}$

at the point

$r_1 = \displaystyle \frac{-S + \sqrt{S^2 -R^2}}{R}$

was equal to

$\displaystyle \frac{R}{ 2 \sqrt{S^2-R^2} }$.

Initially, I did this by explicitly computing the Laurent series expansion about $z = r_1$ and identifying the coefficient for the term $(z-r_1)^{-1}$.

In this post, I’d like to discuss another way that this residue could have been obtained.

Notice that the function $f(z)$ has the form $\displaystyle \frac{g(z)}{(z-r) h(z)}$, where $g$ and $h$ are differentiable functions so that $g(r) \ne 0$ and $h(r) \ne 0$. Therefore, we may rewrite this function using the Taylor series expansion of $\displaystyle \frac{g(z)}{h(z)}$ about $z = r$:

$f(z) = \displaystyle \frac{1}{z-r} \left[ \frac{g(z)}{h(z)} \right]$

$f(z) = \displaystyle \frac{1}{z-r} \left[ a_0 + a_1 (z-r) + a_2 (z-r)^2 + a_3 (z-r)^3 + \dots \right]$

$f(z) = \displaystyle \frac{a_0}{z-r} + a_1 + a_2 (z-r) + a_3 (z-r)^2 + \dots$

Clearly,

$\displaystyle \lim_{z \to r} (z-r) f(z) = \displaystyle \lim_{z \to r} \left[ a_0 + a_1 (z-r) + a_2 (z-r)^2 + a_3 (z-r)^3 + \dots \right] = a_0$

Therefore, the residue at $z = r$ can be found by evaluating the limit $\displaystyle \lim_{z \to r} (z-r) f(z)$. Notice that

$\displaystyle \lim_{z \to r} (z-r) f(z) = \displaystyle \lim_{z \to r} \frac{(z-r) g(z)}{(z-r) h(z)}$

$= \displaystyle \lim_{z \to r} \frac{(z-r) g(z)}{H(z)}$,

where $H(z) = (z-r) h(z)$ is the original denominator of $f(z)$. By L’Hopital’s rule,

$a_0 = \displaystyle \lim_{z \to r} \frac{(z-r) g(z)}{H(z)} = \displaystyle \lim_{z \to r} \frac{g(z) + (z-r) g'(z)}{H'(z)} = \displaystyle \frac{g(r)}{H'(r)}$.

For the function at hand, $g(z) \equiv 1$ and $H(z) = z^2 + 2\frac{S}{R}z + 1$, so that $H'(z) = 2z + 2\frac{S}{R}$. Therefore, the residue at $z = r_1$ is equal to

$\displaystyle \frac{1}{2r_1+2 \frac{S}{R}} = \displaystyle \frac{1}{2 \displaystyle \frac{-S + \sqrt{S^2 -R^2}}{R} + 2 \frac{S}{R}}$

$= \displaystyle \frac{1}{ ~ 2 \displaystyle \frac{\sqrt{S^2 -R^2}}{R} ~ }$

$= \displaystyle \frac{R}{2 \sqrt{S^2-R^2}}$,

matching the result found earlier.

# How I Impressed My Wife: Part 4g

So far in this series, I have used three different techniques to show 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|}$.

For the third technique, a key step in the calculation was showing that the residue of the function

$f(z) = \displaystyle \frac{1}{z^2 + 2\frac{S}{R}z + 1} = \displaystyle \frac{1}{(z-r_1)(z-r_2)}$

at the point

$r_1 = \displaystyle \frac{-S + \sqrt{S^2 -R^2}}{R}$

was equal to

$\displaystyle \frac{R}{ 2 \sqrt{S^2-R^2} }$.

Initially, I did this by explicitly computing the Laurent series expansion about $z = r_1$ and identifying the coefficient for the term $(z-r_1)^{-1}$.

In this post and the next post, I’d like to discuss alternate ways that this residue could have been obtained.

Notice that the function $f(z)$ has the form $\displaystyle \frac{g(z)}{(z-r) h(z)}$, where $g$ and $h$ are differentiable functions so that $g(r) \ne 0$ and $h(r) \ne 0$. Therefore, we may rewrite this function using the Taylor series expansion of $\displaystyle \frac{g(z)}{h(z)}$ about $z = r$:

$f(z) = \displaystyle \frac{1}{z-r} \left[ \frac{g(z)}{h(z)} \right]$

$f(z) = \displaystyle \frac{1}{z-r} \left[ a_0 + a_1 (z-r) + a_2 (z-r)^2 + a_3 (z-r)^3 + \dots \right]$

$f(z) = \displaystyle \frac{a_0}{z-r} + a_1 + a_2 (z-r) + a_3 (z-r)^2 + \dots$

Therefore, the residue at $z = r$ is equal to $a_0$, or the constant term in the Taylor expansion of $\displaystyle \frac{g(z)}{h(z)}$ about $z = r$. Therefore,

$a_0 = \displaystyle \frac{g(r)}{h(r)}$

For the function at hand $g(z) \equiv 1$ and $h(z) = z-r_2$. Therefore, the residue at $z = r_1$ is equal to $\displaystyle \frac{1}{r_1 - r_2}$, matching the result found earlier.

# How I Impressed My Wife: Part 4f

Previously in this series, I have used two different techniques to show 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|}.$

Originally, 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.
Previously in this series, I have used two different techniques to show 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|}.$

Originally, 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.
Here’s my progress so far:

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

$= \displaystyle -\frac{4i}{R} \oint_C \frac{dz}{z^2 + 2\frac{S}{R}z + 1}$,

where this last integral is taken over the complex plane on the unit circle, a closed contour oriented counterclockwise. In these formulas, $R = \sqrt{(2a)^2 + (1-a^2-b^2)^2}$ and $S = 1 + a^2 + b^2$. (Also, $\alpha$ is a certain angle that is now irrelevant at this point in the calculation).

This contour integral looks complicated; however, it’s an amazing fact that integrals over closed contours can be easily evaluated by only looking at the poles of the integrand. In recent posts, I established that there was only one pole inside the contour, and the residue at this pole was equal toÂ $\displaystyle \frac{R}{ 2 \sqrt{S^2-R^2} }$.

This residue can be used to evaluate the contour integral. Ordinarily, integrals are computed by subtracting the values of the antiderivative at the endpoints. However, there is an alternate way of computing a contour integral using residues. It turns out that the value of the contour integral is $2\pi i$ times the sum of the residues within the contour; see Wikipedia and Mathworld for more information.

Therefore,

$Q = \displaystyle -\frac{4i}{R} \oint_C \frac{dz}{(z - r_1)(z- r_2)}$

$= \displaystyle -\frac{4i}{R} \cdot 2\pi i \cdot \frac{R}{ 2 \sqrt{S^2-R^2} }$

$= \displaystyle \frac{4\pi}{\sqrt{S^2-R^2}}$

Next, I use some algebra to simplify the denominator:

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

Therefore,

$Q = \displaystyle \frac{4\pi}{\sqrt{4b^2}} = \displaystyle \frac{4\pi}{2|b|} = \frac{2\pi}{|b|}$

Once again, this matches the solution found with the previous methods… and I was careful to avoid a common algebraic mistake.

In tomorrow’s post, I’ll discuss an alternative way of computing the residue.