# The antiderivative of 1/(x^4+1): Index

I’m doing something that I should have done a long time ago: collecting a series of posts into one single post. The following links comprised my series on the computation of

$\displaystyle \int \frac{dx}{x^4+1}$

Part 1: Introduction.

Part 2: Factoring the denominator using De Moivre’s Theorem.

Part 3: Factoring the denominator using the difference of two squares.

Part 4: The partial fractions decomposition of the integrand.

Part 5: Partial evaluation of the resulting integrals.

Part 6: Evaluation of the remaining integrals.

Part 7: An apparent simplification using a trigonometric identity.

Part 8: Discussion of the angles for which the identity holds.

Part 9: Proof of the angles for which the identity holds.

Part 10: Implications for using this identity when computing definite integrals.

# How I Impressed My Wife: Index

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:

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

Yes, I married well indeed.

In this post, I collect the posts that I wrote last summer regarding various ways of computing this integral.

Part 1: Introduction
Part 2a, 2b, 2c, 2d, 2e, 2f: Changing the endpoints of integration, multiplying top and bottom by $\sec^2 x$, and the substitution $u = \tan x$.
Part 3a, 3b, 3c, 3d, 3e, 3f, 3g, 3h, 3i: Double-angle trig identity, combination into a single trig function, changing the endpoints of integration, and the magic substitution $u = \tan \theta/2$.
Part 4a, 4b, 4c, 4d, 4e, 4f, 4g, 4h: Double-angle trig identity, combination into a single trig function, changing the endpoints of integration, and contour integration using the unit circle
Part 5a, 5b, 5c, 5d, 5e, 5f, 5g, 5h, 5i, 5j: Independence of the parameter $a$, the magic substitution $u = \tan \theta/2$, and partial fractions.
Part 6a, 6b, 6c, 6d, 6e, 6f, 6g:Independence of the parameter $a$, the magic substitution $u = \tan \theta/2$, and contour integration using the real line and an expanding semicircle.
Part 7: Concluding thoughts… and ways that should work that I haven’t completely figured out yet.

# The antiderivative of 1/(x^4+1): Part 4

This antiderivative has arguable the highest ratio of “really hard to compute” to “really easy to write”:

$\displaystyle \int \frac{1}{x^4 + 1} dx$

So far, I’ve shown that the denominator can be factored over the real numbers:

$\displaystyle \int \frac{dx}{x^4 + 1} = \displaystyle \int \frac{dx}{\left(x^2 - x \sqrt{2} + 1 \right) \left(x^2 + x \sqrt{2} + 1\right)}$,

so that the technique of partial fractions can be applied. Since both quadratics in the denominator are irreducible (and the degree of the numerator is less than the degree of the denominator), the partial fractions decomposition has the form

$\displaystyle \frac{1}{\left(x^2 - x \sqrt{2} + 1 \right) \left(x^2 + x \sqrt{2} + 1\right)} = \displaystyle \frac{Ax + B}{\left(x^2 - x \sqrt{2} + 1 \right)} + \displaystyle \frac{Cx + D}{ \left(x^2 + x \sqrt{2} + 1\right)}$

Clearing out the denominators, I get

$1 = (Ax + B) \left(x^2 + x \sqrt{2} + 1\right) + (Cx + D) \left(x^2 - x \sqrt{2} + 1\right)$

or

$1 = Ax^3 + Bx^2 + Ax^2 \sqrt{2} + Bx\sqrt{2} + Ax + B + Cx^3 + Dx^2 - Cx^2 \sqrt{2} - Dx\sqrt{2} + Cx + D$

or

$0x^3 + 0x^2 + 0x + 1 = (A + C)x^3 + (A \sqrt{2} + B - C \sqrt{2} + D)x^2 + (A + B\sqrt{2} + C - D \sqrt{2} ) x + (B+D)$

Matching coefficients yields the following system of four equations in four unknowns:

$A + C = 0$

$A\sqrt{2} + B - C\sqrt{2} + D = 0$

$A + B \sqrt{2} + C - D\sqrt{2} = 0$

$B + D = 1$

Ordinarily, four-by-four systems of linear equations are somewhat painful to solve, but this system isn’t too bad. Since $A + C = 0$ from the first equation, the third equation becomes

$0 + B \sqrt{2} - D \sqrt{2} = 0$, or $B = D$.

From the fourth equation, I can conclude that $B = 1/2$ and $D = 1/2$. The second and third equations then become

$A\sqrt{2} + \displaystyle \frac{1}{2} - C\sqrt{2} + \frac{1}{2} = 0$

$A + \displaystyle \frac{\sqrt{2}}{2} + C - \frac{\sqrt{2}}{2} = 0$,

or

$A - C = \displaystyle -\frac{\sqrt{2}}{2}$,

$A + C = 0$.

Adding the two equations yields $2A = -\displaystyle \frac{\sqrt{2}}{4}$, so that $A = -\displaystyle \frac{\sqrt{2}}{4}$ and $C = \displaystyle \frac{\sqrt{2}}{4}$.

Therefore, the integral can be rewritten as

$\displaystyle \int \left( \frac{ -\displaystyle \frac{\sqrt{2}}{4} x + \frac{1}{2}}{ x^2 - x \sqrt{2} + 1 } + \frac{ \displaystyle \frac{\sqrt{2}}{4} x + \frac{1}{2}}{ x^2 + x \sqrt{2} + 1 } \right) dx$

I’ll start evaluating this integral in tomorrow’s post.

# How I Impressed My Wife: Part 5j

Earlier in this series, I gave three different methods of showing 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|}.$

Using the fact that $Q$ is independent of $a$, I’ll now give a fourth method.
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 \int_{-\infty}^{\infty} \frac{ 2(1+u^2) du}{ ([u - \sqrt{1-b^2}]^2 +b^2)([u + \sqrt{1-b^2}]^2 +b^2}$

$\displaystyle \int_{-\infty}^{\infty} \left[ \frac{1}{[u - \sqrt{1-b^2}]^2 +b^2} + \frac{1}{[u + \sqrt{1-b^2}]^2 +b^2} \right] du$

if $|b| < 1$. (The cases $|b| = 1$ and $|b| > 1$ have already been handled earlier in this series.)

To complete the calculation, I employ the now-familiar antiderivative

$\displaystyle \int \frac{dx}{x^2 + b^2} = \displaystyle \frac{1}{|b|} \tan^{-1} \left( \frac{x}{b} \right)$.

Using this antiderivative and a simple substitution, I see that

$Q = \displaystyle \left[ \frac{1}{|b|} \tan^{-1} \left( \frac{u - \sqrt{1-b^2}}{b} \right) + \frac{1}{|b|} \tan^{-1} \left( \frac{u - \sqrt{1-b^2}}{b} \right) \right]^{\infty}_{-\infty}$

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

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

This completes the fourth method of evaluating the integral $Q$, using partial fractions.

There’s at least one more way that the integral $Q$ can be calculated, which I’ll begin with tomorrow’s post.

# How I Impressed My Wife: Part 5i

Earlier in this series, I gave three different methods of showing 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|}.$

Using the fact that $Q$ is independent of $a$, I’ll now give a fourth method.
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 \int_{-\infty}^{\infty} \frac{ 2(1+u^2) du}{ ([u - \sqrt{1-b^2}]^2 +b^2)([u + \sqrt{1-b^2}]^2 +b^2}$

if $|b| < 1$. (The cases $|b| = 1$ and $|b| > 1$ have already been handled earlier in this series.)

I will evaluate this integral using partial fractions. The denominator factors as the product of two irreducible quadratics, and so I must solve

$\displaystyle \frac{ 2(1+u^2)}{ ([u - \sqrt{1-b^2}]^2 +b^2)([u + \sqrt{1-b^2}]^2 +b^2)} = \displaystyle \frac{Au + B}{[u - \sqrt{1-b^2}]^2 +b^2} + \frac{Cu + D}{[u + \sqrt{1-b^2}]^2 +b^2}$,

or

$\displaystyle \frac{ 2(1+u^2)}{ ([u - \sqrt{1-b^2}]^2 +b^2)([u + \sqrt{1-b^2}]^2 +b^2)} = \displaystyle \frac{Au + B}{u^2 - 2u \sqrt{1-b^2} +1} + \frac{Cu + D}{u^2 + 2u\sqrt{1-b^2} + 1}$.

I now clear out the denominators:

$2(1+u^2) = (Au+B)(u^2 + 2u\sqrt{1-b^2} + 1) + (Cu+D)(u^2 - 2u\sqrt{1-b^2} + 1)$

Now I multiply out the right-hand side:

$Au^3 + 2Au^2 \sqrt{1-b^2} + Au + Bu^2 + 2Bu\sqrt{1-b^2} + B$

$+ Cu^3 - 2Cu^2 \sqrt{1-b^2} + Cu + Du^2 - 2Du\sqrt{1-b^2} + D$

Equating this with $2u^2 + 2$ and matching coefficients yields the following system of four equations in four unknowns:

$A + C = 0$

$2A\sqrt{1-b^2} + B - 2C \sqrt{1-b^2} + D = 2$

$Au + 2Bu \sqrt{1-b^2} + Cu - 2Du \sqrt{1-b^2} = 0$

$B + D = 2$

Ordinarily, four-by-four systems of equations are rather painful to solve, but this system isn’t so bad.

From the first equation, I see that $C = -A$.

From the third equation, I see that

$Au + 2Bu \sqrt{1-b^2} + Cu - 2Du \sqrt{1-b^2} = 0$

$Au + 2Bu \sqrt{1-b^2} -Au - 2Du \sqrt{1-b^2} = 0$

$2Bu \sqrt{1-b^2} - 2Du \sqrt{1-b^2} = 0$

$B - D = 0$

$B = D$.

From the fourth equation, I see that

$B + D = 2$

$B + B = 2$

$2B = 2$

$B = 1$,

so that $D =1$ as well. Finally, from the second equation, I see that

$2A\sqrt{1-b^2} + B - 2C \sqrt{1-b^2} + D = 2$

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

$4A\sqrt{1-b^2} = 0$

$A= 0$,

so that $C = 0$ as well. This yields the partial fractions decomposition

$\displaystyle \frac{ 2(1+u^2)}{ ([u - \sqrt{1-b^2}]^2 +b^2)([u + \sqrt{1-b^2}]^2 +b^2)} = \displaystyle \frac{1}{[u - \sqrt{1-b^2}]^2 +b^2} + \frac{1}{[u + \sqrt{1-b^2}]^2 +b^2}$.

This can be confirmed by directly adding the fractions on the right-hand side:

$\displaystyle \frac{1}{[u - \sqrt{1-b^2}]^2 +b^2} + \frac{1}{[u + \sqrt{1-b^2}]^2 +b^2}$

$= \displaystyle \frac{[u + \sqrt{1-b^2}]^2 +b^2 + [u - \sqrt{1-b^2}]^2 +b^2}{([u - \sqrt{1-b^2}]^2 +b^2)([u + \sqrt{1-b^2}]^2 +b^2)}$

$= \displaystyle \frac{u^2 + 2u\sqrt{1-b^2} + 1 - b^2 + b^2 + u^2 - 2u\sqrt{1-b^2} + 1 - b^2 + b^2}{([u - \sqrt{1-b^2}]^2 +b^2)([u + \sqrt{1-b^2}]^2 +b^2)}$

$= \displaystyle \frac{2u^2 + 2}{([u - \sqrt{1-b^2}]^2 +b^2)([u + \sqrt{1-b^2}]^2 +b^2)}$.

I’ll continue with this fourth evaluation of the integral, continuing the case $|b| < 1$, in tomorrow’s post.

# How I Impressed My Wife: Part 5g

Earlier in this series, I gave three different methods of showing 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|}.$

Using the fact that $Q$ is independent of $a$, I’ll now give a fourth method.
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 \int_{-\infty}^{\infty} \left[ \displaystyle \left( \frac{2 - 2k_1^2}{k_2^2 - k_1^2} \right) \frac{1}{u^2 + k_1^2} + \displaystyle \left( \frac{2 k_2^2 - 2}{k_2^2 - k_1^2} \right) \frac{1}{u^2 + k_2^2} \right] du$,

where $k_1$ and $k_2$ are the positive numbers so that

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

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

so that

$u^4 + (4 b^2 - 2) u^2 + 1 = (u^2 + k_1^2) (u^2 + k_2^2)$

At this point in the calculation, we can employ the now familiar antiderivative

$\displaystyle \int \frac{du}{u^2 +k^2} = \displaystyle \frac{1}{k} \tan^{-1} \left( \frac{u}{k} \right) + C$,

so that

$Q = \left[ \displaystyle \left( \frac{2 - 2k_1^2}{k_2^2 - k_1^2} \right) \frac{1}{k_1}\tan^{-1} \left( \frac{u}{k_1} \right) + \displaystyle \left( \frac{2 k_2^2 - 2}{k_2^2 - k_1^2} \right) \displaystyle \frac{1}{k_2} \tan^{-1} \left( \frac{u}{k_2} \right) \right]^{\infty}_{-\infty}$

$= \displaystyle \left( \frac{2 - 2k_1^2}{k_2^2 - k_1^2} \right) \frac{1}{k_1} \left( \frac{\pi}{2} - \frac{-\pi}{2} \right) + \displaystyle \left( \frac{2 k_2^2 - 2}{k_2^2 - k_1^2} \right) \displaystyle \frac{1}{k_2} \tan^{-1} \left(\frac{\pi}{2} - \frac{-\pi}{2} \right)$

$= \displaystyle\frac{\pi}{k_2^2-k_1^2} \left( \frac{2 - 2k_1^2}{k_1} + \frac{2 .k_2^2 - 2}{k_2} \right)$

$= \displaystyle\frac{\pi}{k_2^2-k_1^2} \left( \frac{(2 - 2k_1^2)k_2 + (2 k_2^2 - 2)k_1 }{k_1 k_2} \right)$

$= \displaystyle\frac{\pi}{k_2^2-k_1^2} \left( \frac{2 k_2 - 2k_1^2 k_2 + 2 k_1 k_2^2 - 2 k_1 }{k_1 k_2} \right)$

$= \displaystyle\frac{2\pi}{k_2^2-k_1^2} \left( \frac{k_2 - k_1^2 k_2 + k_1 k_2^2 - k_1 }{k_1 k_2} \right)$

$= \displaystyle\frac{2\pi}{k_2^2-k_1^2} \left( \frac{k_2 - k_1 - k_1^2 k_2 + k_1 k_2^2 }{k_1 k_2} \right)$

$= \displaystyle\frac{2\pi}{(k_2-k_1)(k_2+k_1)} \left( \frac{(k_2 - k_1) + k_1 k_2 (k_2 - k_1)}{k_1 k_2} \right)$

$= \displaystyle\frac{2\pi}{(k_2-k_1)(k_2+k_1)} \left( \frac{(k_2 - k_1)(1+ k_1 k_2)}{k_1 k_2} \right)$

$= \displaystyle 2\pi \left( \frac{1+ k_1 k_2}{(k_2+k_1) k_1 k_2} \right)$.

Now it remains to simplify this fraction. To do this, we note that

$u^4 + (4 b^2 - 2) u^2 + 1 = (u^2 + k_1^2) (u^2 + k_2^2)$,

so that

$u^4 + (4b^2 - 2)u^2 + 1 = u^4 + (k_1^2 + k_2^2)u^2 + k_1^2 k_2^2$

Matching coefficients, we see that

$k_1^2 + k_2^2 = 4b^2 -2$,

$k_1^2 k_2^2 = 1$

Since both $k_1$ and $k_2$ are positive, we see that $k_1 k_2 = 1$ from the last equation. Therefore,

$k_1^2 + 2 k_1 k_2 + k_2^2 = 4b^2 -2 + 2$

$(k_1+k_2)^2 = 4b^2$

$k_1 + k_2 = 2|b|$

Plugging these in, we finally conclude that

$Q = \displaystyle 2\pi \left( \frac{1+ 1}{2 |b| \cdot 1} \right) = \displaystyle \frac{2\pi}{|b|}$,

again matching our earlier result.

Using the fourth method, I’ve shown that $Q = \displaystyle \frac{2\pi}{|b|}$ for the cases $|b| = 1$ and $|b| > 1$. With tomorrow’s post, I’ll consider the remaining case of $|b| < 1$.

# How I Impressed My Wife: Part 5f

Earlier in this series, I gave three different methods of showing 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|}.$

Using the fact that $Q$ is independent of $a$, I’ll now give a fourth method.
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}$

The four roots of the denominator satisfy

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

In yesterday’s post, I handled the case $|b| = 1$. In today’s post, I’ll consider the case $|b| > 1$, so that $u^2$ is a real number for the four roots of the denominator.

For the sake of simplicity, let me define the positive numbers $k_1$ and $k_2$ so that

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

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

Clearly $2b^2 + 2|b| \sqrt{b^2-1} - 1 > 0$ if $|b| > 1$, and so we can choose $k_1$ to be positive. For $k_2$, notice that

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

while

$\left[ 2|b| \sqrt{b^2-1} \right]^2 = 4b^2 (b^2 - 1) = 4b^4 - 4b^2$.

Therefore,

$(2b^2 - 1)^2 > \left[ 2|b| \sqrt{b^2-1} \right]^2$

$2b^2 - 1 > 2|b| \sqrt{b^2-1}$

$2b^2 - 2|b| \sqrt{b^2-1} - 1 > 0$

So $k_2$ can also be chosen to be a positive number.

Using $k_1$ and $k_2$, I can write

$u^4 + (4 b^2 - 2) u^2 + 1 = (u^2 + k_1^2)(u^2 + k_2^2)$,

and so the integrand must have the partial fractions decomposition

$\displaystyle \frac{ 2(1+u^2)}{u^4 + (4 b^2 - 2) u^2 + 1} = \displaystyle \frac{A}{u^2 + k_1^2} + \displaystyle \frac{B}{u^2 + k_2^2}$,

Notice that ordinarily, when the denominator contains an irreducible quadratic, the numerator of the partial fractions decomposition has the form $Au + B$ and not $A$. However, there are no $u^3$ and $u$ terms in the denominator, I can treat $u^2$ as the variable for the purposes of the decomposition. Since the right-hand side has linear terms in $u^2$, it suffices to use a constant for finding the decomposition.

To solve for the constants $A$ and $B$, I clear out the denominator:

$2u^2 + 2 = A \left[ u^2 + k_2^2 \right] + B \left[ u^2 + k_1^2 \right]$

Matching coefficients, this yields the system of equations

$A + B = 2$

$A k_2^2 + B k_1^2 = 2$

Substituting $B = 2-A$ into the second equation, I get

$A k_2^2 + (2-A) k_1^2 = 2$

$2 k_1^2 + A (k_2^2 - k_1^2) = 2$

$A (k_2^2 - k_1^2) = 2 - 2k_1^2$

$A = \displaystyle \frac{2 - 2k_1^2}{k_2^2 - k_1^2}$

Therefore,

$B = 2 - A = 2 - \displaystyle \frac{2 - 2k_1^2}{k_2^2 - k_1^2}$

$B = \displaystyle \frac{2(k_2^2 - k_1^2) - (2 - 2k_1^2)}{k_2^2 - k_1^2}$

$B = \displaystyle \frac{2 k_2^2 - 2}{k_2^2 - k_1^2}$

Therefore, the integrand has the partial fractions decomposition

$\displaystyle \frac{ 2(1+u^2)}{u^4 + (4 b^2 - 2) u^2 + 1} = \displaystyle \left( \frac{2 - 2k_1^2}{k_2^2 - k_1^2} \right) \frac{1}{u^2 + k_1^2} + \displaystyle \left( \frac{2 k_2^2 - 2}{k_2^2 - k_1^2} \right) \frac{1}{u^2 + k_2^2}$

I’ll continue with this fourth evaluation of the integral, continuing the case $|b| > 1$, in tomorrow’s post.

# Approximating pi

I was recently interviewed by my city’s local newspaper about $\pi$ Day and the general fascination with memorizing the digits of $\pi$. I was asked by the reporter if the only constraint in our knowledge of the digits of $\pi$ was the ability of computers to calculate the digits, and I answered in the affirmative.

Here’s the current state-of-the-art for calculating the digits of $\pi$. Amazingly, this expression was discovered  1995… in other words, very recently.

$\pi = \displaystyle \sum_{n=0}^\infty \frac{1}{16^n} \left( \frac{4}{8n+1} - \frac{2}{8n+4} - \frac{1}{8n+5} - \frac{1}{8n+6} \right)$

Because of the term $16^n$ in the denominator, this infinite series converges very quickly.

Proof: If $k < 8$, then we calculate the integral $I_k$, defined below:

$I_k = \displaystyle \int_0^{1/\sqrt{2}} \frac{x^{k-1}}{1-x^8} dx$

$= \displaystyle \int_0^{1/\sqrt{2}} x^{k-1} \sum_{n=0}^\infty x^{8n} dx$

$= \displaystyle \int_0^{1/\sqrt{2}} \sum_{n=0}^\infty x^{8n+k-1} dx$

$= \displaystyle \sum_{n=0}^\infty \int_0^{1/\sqrt{2}} x^{8n+k-1} dx$

$= \displaystyle \sum_{n=0}^\infty \left[ \frac{x^{8n+k}}{8n+k} \right]^{1/\sqrt{2}}_0$

$= \displaystyle \sum_{n=0}^\infty \frac{1}{8n+k} \left[ \left( \frac{1}{\sqrt{2}} \right)^{8n+k} - 0 \right]$

$= \displaystyle \sum_{n=0}^\infty \frac{1}{2^{k/2}} \frac{1}{16^n (8n+k)}$

We now form the linear combination $P = 4\sqrt{2} I_1 - 8 I_4 - 4\sqrt{2} I_5 - 8 I_6$:

$P = \displaystyle \sum_{n=0}^\infty \left( \frac{4\sqrt{2}}{2^{1/2}} \frac{1}{16^n (8n+1)} - \frac{8}{2^{4/2}} \frac{1}{16^n (8n+4)} - \frac{4\sqrt{2}}{2^{5/2}} \frac{1}{16^n (8n+5)} - \frac{8}{2^{6/2}} \frac{1}{16^n (8n+6)} \right)$

$P = \displaystyle \sum_{n=0}^\infty \frac{1}{16^n} \left( \frac{4}{8n+1} - \frac{2}{8n+4} - \frac{1}{8n+5} - \frac{1}{8n+6} \right)$

Also, from the original definition of the $I_k$,

$P = \displaystyle \int_0^{1/\sqrt{2}} \frac{4\sqrt{2} - 8x^3 -4\sqrt{2} x^4 - 8x^5}{1-x^8} dx$.

Employ the substitution $x = y/\sqrt{2}$:

$P = \displaystyle \int_ 0^1 \frac{4\sqrt {2} - 2\sqrt {2} y^3 - \sqrt {2} y^4 - \sqrt {2} y^5}{1 - y^8/16}\frac {dy} {\sqrt {2}}$

$P = \displaystyle \int_ 0^1 \frac{16 (4 - 2 y^3 - y^4 - y^5)}{16 - y^8} dy$

$P = \displaystyle \int_0^1 \frac{16(y-1)(y^2+2)(y^2+2y+2)}{(y^2-2)(y^2+2)(y^2+2y+2)(y^2-2y+2)} dy$

$P = \displaystyle \int_0^1 \frac{16y-16}{(y^2-2)(y^2-2y+2)} dy$

Using partial fractions, we find

$P = \displaystyle \int_ 0^1\frac{4 y}{y^2 - 2} dy - \int_ 0^1 \frac{4 y - 8}{y^2 - 2 y + 2} dy$

The expression on the right-hand side can be simplified using standard techniques from Calculus II and is equal to $\pi$.

So that’s the proof… totally accessible to a student who has mastered concepts in Calculus II. But this begs the question: how in the world did anyone come up with the idea of starting with the integrals $I_k$ to develop an infinite series that leads to $\pi$? Let me quote from page 118 of J. Arndt and C. Haenel, $\pi -$ Unleashed (Springer, New York, 2000):

Certainly not by chance, even if luck played some part in the discovery. All three parties [David Bailey, Peter Borwein and Simon Plouffe] are established mathematicians who have been working with the number $\pi$ for a considerable time… Yet the series was not discovered through mathematical deduction or inference. Instead, the researchers used a tool called Computer Algebra System and a particular procedure called the “PSQL algorithm” to generate their series. They themselves write that they found their formula “through a combination of inspired testing and extensive searching.”

The original paper that announced the discovery of this series can be found at http://www.cecm.sfu.ca/personal/pborwein/PAPERS/P123.pdf.

# Fun lecture on geometric series (Part 5): The Fibonacci sequence

Every once in a while, I’ll give a “fun lecture” to my students. The rules of a “fun lecture” are that I talk about some advanced applications of classroom topics, but I won’t hold them responsible for these ideas on homework and on exams. In other words, they can just enjoy the lecture without being responsible for its content.

In this series of posts, I’m describing a fun lecture on generating functions that I’ve given to my Precalculus students. In the previous post, we looked at the famed Fibonacci sequence

$1, 1, 2, 3, 5, 8, 13, 21, 34, 55, \dots$

We also looked at that (slightly less famous) Quintanilla sequence

$1, 1, 3, 5, 11, 21, 43, 85, \dots$

which is defined so that each term is the sum of the previous term and twice the term that’s two back in the sequence. Using the concept of a generating function, we found that the $n$th term of the Quintanilla sequence is

$Q_n = \displaystyle \frac{2^{n+1} + (-1)^n}{3}$

To close out the fun lecture, I’ll then verify that this formula works by using mathematical induction. As seen below, it’s a lot less work to verify the formula with mathematical induction than to derive it from the generating function.

$n=0$: $Q_0 = \displaystyle \frac{2+1}{3} = 1$.

$n = 1$: $Q_1 = \displaystyle \frac{2^2-1}{3} = 1$.

$n-1$ and $n$: Assume the formula works for $Q_{n-1}$ and $Q_n$.

$n+1$:

$Q_{n+1} = Q_n + 2 Q_{n-1}$

$Q_{n+1} = \displaystyle \frac{2^{n+1} + (-1)^n}{3} + 2 \cdot \frac{2^n + (-1)^{n-1}}{3}$

$Q_{n+1} = \displaystyle \frac{2^{n+1} + (-1)^n + 2 \cdot 2^n + 2 \cdot (-1)^{n-1}}{3}$

$Q_{n+1} = \displaystyle \frac{2^{n+1} + 2^{n+1} + (-1)^n - 2 \cdot (-1)^n}{3}$

$Q_{n+1} = \displaystyle \frac{2 \cdot 2^{n+1} - (-1)^n}{3}$

$Q_{n+1} = \displaystyle \frac{2^{n+2} + (-1)^{n+1}}{3}$

That’s the formula if $n$ is replaced by $n+1$, and so we’re done.

Let me note parenthetically that the above simplification is not all intuitive when encountered by students for the first time — even really bright students who know the laws of exponents cold and who know full well that $x + x = 2x$ and $x - 2x = -x$. That said, I’ve found that simplifications like $2^{n+1} + 2^{n+1} = 2 \cdot 2^{n+1} = 2^{n+2}$ are usually a little intimidating to most students at first blush, though they can quickly get the hang of it.

By this point, I’m usually near the end of my 50-minute fun lecture. Since students are not responsible for replicating the contents of the fun lecture, I’ve found that most students are completely comfortable with this pace of presentation.

Then I ask my students which way they’d prefer: generating functions or mathematical induction? They usually respond induction. However, they also are able to realize that the thing that makes mathematical induction is also the challenge: they have to guess the correct formula and then use induction to verify that the formula actually works. On the other hand, with generating functions, there’s no need to guess the correct answer… you just follow the steps and see what comes out the other side.

Finally, to close the fun lecture, I tell them that the above steps can be used to find a closed-form expression for the Fibonacci sequence. (I devised the Quintanilla sequence for pedagogical purposes: since the denominator of its generating function easily factors, the subsequent steps aren’t too messy.) I won’t go through all the steps here, so I’ll leave it as a challenge for the reader to start with the generating function

$f(x) = \displaystyle \frac{1}{1-x-x^2}$,

factor the denominator by finding the two real roots of $1 - x - x^2 = 0$, and then mimicking the above steps. If you want to cheat, just use the following Google search to find the answer: http://www.google.com/#q=fibonacci+%22generating+function%22

I conclude this post with some pedagogical reflections. I taught this fun lecture to about 10 different Precalculus classes, and it was a big hit each time. I think that my students were thoroughly engaged with the topic and liked seeing an unorthodox application of the various topics in Precalculus that they were learning (sequences, series, partial fractions, factoring polynomials over $\mathbb{R}$, mathematical induction). So even though they would likely receive a fuller treatment of generating functions in a future course like Discrete Mathematics, I liked giving them this little hint of what was lying out there for them in the future.

I covered the content of this series of five posts in a 50-minute lecture. I’d usually finish the proof by induction as time expired and then would challenge them to think about how to similarly find the formula for the Fibonacci sequence. The rules of a “fun lecture” were important to pull this off — I made it clear that students would not have to do this for homework, so the pressure was off them to understand the fine details during the lecture. Instead, the idea was for them to appreciate the big picture of how topics in Precalculus can be used in future courses.

# Fun lecture on geometric series (Part 4): The Fibonacci sequence

Every once in a while, I’ll give a “fun lecture” to my students. The rules of a “fun lecture” are that I talk about some advanced applications of classroom topics, but I won’t hold them responsible for these ideas on homework and on exams. In other words, they can just enjoy the lecture without being responsible for its content.

In this series of posts, I’m describing a fun lecture on generating functions that I’ve given to my Precalculus students. In the previous post, we looked at the famed Fibonacci sequence

$1, 1, 2, 3, 5, 8, 13, 21, 34, 55, \dots$

We also looked at that (slightly less famous) Quintanilla sequence

$1, 1, 3, 5, 11, 21, 43, 85, \dots$

which is defined so that each term is the sum of the previous term and twice the term that’s two back in the sequence. We also used the Bag of Tricks to find that the generating function is

$Q(x) = \displaystyle \frac{1}{1-x-2x^2}$

To get a closed-form definition of the Quintanilla sequence, let’s find the partial-fraction decomposition of $Q(x)$. Notice that the denominator factors easily, so that

$Q(x) = \displaystyle \frac{1}{(1+x)(1-2x)}$

To find the partial fraction decomposition, we need to find the constants $A$ and $B$ so that

$\displaystyle \frac{A}{1+x} + \frac{B}{1-2x} = \displaystyle \frac{1}{(1+x)(1-2x)}$,

or

$A(1-2x) + B(1+x) = 1$

Perhaps the easiest way of finding $A$ and $B$ is by substituting conveniently easy values of $x$.

• If $x = \displaystyle \frac{1}{2}$, then we obtain $\displaystyle \frac{3}{2} B = 1$, or $B = \displaystyle \frac{2}{3}$.
• If $x = -1$, then we obtain $3A =1$, or $A = \displaystyle \frac{1}{3}$.

Therefore,

$Q(x) = \displaystyle \frac{1}{3} \cdot \frac{1}{1+x} + \frac{2}{3} \cdot \frac{1}{1-2x}$

Finally, let’s write the rational functions on the right-hand side as infinite series. Using the formula for an infinite geometric series, we find

$Q(x) = \displaystyle \frac{1}{3} \left(1 - x + x^2 - x^3 + x^4 - x^5 \dots \right) + \frac{2}{3} \left( 1 + 2x + 4x^2 + 8x^3 + 16x^4 + 32 x^5 \dots \right)$

Notice that this matches the terms of the Quintanilla sequence! For example, the coefficient of the $x^5$ term is

$\displaystyle -\frac{1}{3} + \frac{2}{3}(32) = \displaystyle \frac{63}{3} = 31$,

which is a term of the Quintanilla sequence.

In general, the coefficient of the $x^n$ term is

$\displaystyle \frac{(-1)^n}{3} + \frac{2 \cdot 2^n}{3} = \displaystyle \frac{2^{n+1} + (-1)^n}{3}$

This is the long-awaited closed-form expression for the Quintanilla sequence. For example, we quickly see that the 12th term is $\displaystyle \frac{2^{13} + 1}{3} = 2731$, which was obtained without knowing the 10th and 11th terms.