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

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

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$

To compute this integral, I will use the technique of partial fractions. In yesterday’s post, I used De Moivre’s Theorem to factor the denominator over the complex plane, which then led to the factorization of the denominator over the real numbers.

In today’s post, I present an alternative way of factoring the denominator by completing the square. However, unlike the ordinary method of completing the square, I’ll do this by adding and subtracting the middle term and not the final term:

$x^4 + 1= x^4 + 2x^2 + 1 - 2x^2$

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

$= (x^2 + 1 + x\sqrt{2})(x^2 + 1 - x \sqrt{2})$.

The quadratic formula can then be used to confirm that both of these quadratics have complex roots and hence are irreducible over the real numbers, and so I have thus factored the denominator 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)}$.

and the technique of partial fractions can be applied.

There’s a theorem that says that any polynomial over the real numbers can be factored over the real numbers using linear terms and irreducible quadratic terms. However, as seen in this example, there’s no promise that the terms will have rational coefficients.

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

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

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$

To compute this integral, I will use the technique of partial fractions. This requires factoring the denominator over the real numbers, which can be accomplished by finding the roots of the denominator. In other words, I need to solve

$x^4 + 1 = 0$,

or

$z^4 = -1$.

I switched to the letter $z$ since the roots will be complex. The four roots of this quartic equation can be found with De Moivre’s Theorem by writing

$z = r (\cos \theta + i \sin \theta)$,

where $r$ is a real number, and

$-1 + 0i = 1(\cos \pi + \i \sin \pi)$

By De Moivre’s Theorem, I obtain

$r^4 (\cos 4\theta + i \sin 4 \theta) = 1 (\cos \pi + i \sin \pi)$.

Matching terms, I obtain the two equations

$r^4 = 1$ and $4\theta = \pi + 2\pi n$

or

$r = 1$ and $\theta = \displaystyle \frac{\pi}{4} + \displaystyle \frac{\pi n}{2}$

or

$r = 1$ and $\theta = \displaystyle \frac{\pi}{4}, \frac{3\pi}{4}, \frac{5\pi}{4}, \frac{7\pi}{4}$.

This yields the four solutions

$z = 1 \left[ \cos \displaystyle \frac{\pi}{4} + i \sin \frac{\pi}{4} \right] = \displaystyle \frac{\sqrt{2}}{2} + i \frac{\sqrt{2}}{2}$

$z = 1 \left[ \cos \displaystyle \frac{3\pi}{4} + i \sin \frac{3\pi}{4} \right] = -\displaystyle \frac{\sqrt{2}}{2} + i \frac{\sqrt{2}}{2}$

$z = 1 \left[ \cos \displaystyle \frac{5\pi}{4} + i \sin \frac{5\pi}{4} \right] = -\displaystyle \frac{\sqrt{2}}{2} - i \frac{\sqrt{2}}{2}$

$z = 1 \left[ \cos \displaystyle \frac{7\pi}{4} + i \sin \frac{7\pi}{4} \right] = \displaystyle \frac{\sqrt{2}}{2} - i \frac{\sqrt{2}}{2}$

Therefore, the denominator $x^4 + 1$ can be written as the following product of linear factors over the complex plane:

$\displaystyle \left(x - \left[ \displaystyle \frac{\sqrt{2}}{2} + i \frac{\sqrt{2}}{2} \right] \right)\left(x - \left[ \displaystyle \frac{\sqrt{2}}{2} - i \frac{\sqrt{2}}{2} \right] \right) \left(x - \left[ -\displaystyle \frac{\sqrt{2}}{2} + i \frac{\sqrt{2}}{2} \right] \right) \left(x - \left[ - \displaystyle \frac{\sqrt{2}}{2} - i \frac{\sqrt{2}}{2} \right] \right)$

or

$\displaystyle \left(\left[x - \displaystyle \frac{\sqrt{2}}{2} \right] - i \frac{\sqrt{2}}{2} \right)\left( \left[ x - \displaystyle \frac{\sqrt{2}}{2} \right] + i \frac{\sqrt{2}}{2} \right) \left( \left[ x + \displaystyle \frac{\sqrt{2}}{2} \right] - i \frac{\sqrt{2}}{2} \right) \left( \left[ x + \displaystyle \frac{\sqrt{2}}{2} \right] + i \frac{\sqrt{2}}{2} \right)$

or

$\displaystyle \left(\left[x - \displaystyle \frac{\sqrt{2}}{2} \right]^2 - \left[ i \frac{\sqrt{2}}{2} \right]^2 \right) \left( \left[ x + \displaystyle \frac{\sqrt{2}}{2} \right]^2 - \left[i \frac{\sqrt{2}}{2} \right]^2 \right)$

or

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

or

$\displaystyle \left(x^2 - x \sqrt{2} + 1 \right) \left(x^2 + x \sqrt{2} + 1\right)$.

We have thus factored the denominator 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)}$,

and the technique of partial fractions can be applied.

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

# How I Impressed My Wife: Part 3i

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

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

$= \displaystyle \frac{2}{|b|} \int_{-\infty}^{\infty} \frac{dv}{1 + v^2}$,

as long as $b \ne 0$. (In the above calculations, the constants $R$, $S$, and $\alpha$ depend on $a$ and $b$ but are no longer necessary at this point in the calculation.)

We can now directly compute this final integral using an antiderivative derived earlier in this series:

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

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

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

And so, with this completely different technique, we arrive at the same answer for the integral $Q$.

However, there are still different ways of computing $Q$. I’ll start on another method of attack with tomorrow’s post.

# How I Impressed My Wife: Part 3h

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

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

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

We now employ the substitution

$u = \displaystyle \sqrt{ \frac{S+R}{S-R} } v$,

so that

$du = \displaystyle \sqrt{ \frac{S+R}{S-R} } dv$.

Before going much further, let’s take a closer look at $R$ and $S$ to make sure that $\displaystyle \frac{S+R}{S-R}$ is positive (so that the square root is defined).

First, both $S$ and $R$ are clearly positive, and so $S+R > 0$.

Next, notice that

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

So $S^2 - R^2 > 0$ as long as $b > 0$. Therefore, since $S + R > 0$:

$S^2 - R^2 > 0$

$(S+R)(S-R) > 0$

$S - R > 0$

So, since $S + R > 0$ and $S - R > 0$, we have $\displaystyle \frac{S+R}{S-R} > 0$, and so the above substitution is well-defined.

We now employ the above substitution. The endpoints of integration remain unchanged, and so

$Q = 4 \displaystyle \int_{-\infty}^{\infty} \frac{\displaystyle \sqrt{ \frac{S+R}{S-R} } dv}{(S + R) + \left[ \displaystyle \sqrt{ \frac{S+R}{S-R} } v \right]^2 (S - R)}$

$= 4 \displaystyle \int_{-\infty}^{\infty} \frac{\displaystyle \sqrt{ \frac{S+R}{S-R} } dv}{(S + R) + (S + R) v^2}$

$= \displaystyle \frac{4}{S+R} \sqrt{ \frac{S+R}{S-R}} \int_{-\infty}^{\infty} \frac{dv}{1 + v^2}$

$= \displaystyle 4 \sqrt{ \frac{1}{(S+R)(S-R)}} \int_{-\infty}^{\infty} \frac{dv}{1 + v^2}$

$= \displaystyle 4 \sqrt{ \frac{1}{S^2-R^2}} \int_{-\infty}^{\infty} \frac{dv}{1 + v^2}$

$= \displaystyle 4 \sqrt{ \frac{1}{4b^2}} \int_{-\infty}^{\infty} \frac{dv}{1 + v^2}$

$= \displaystyle \frac{4}{2|b|} \int_{-\infty}^{\infty} \frac{dv}{1 + v^2}$

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

In the above calculation, I used the fact that $S^2 - R^2 = 4b^2$, which was derived above. Also, I was careful to avoid a common algebraic mistake.

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

# Square any number up to 1000 without a calculator

The Mathematical Association of America has an excellent series of 10-minute lectures on various topics in mathematics that are nevertheless accessible to the general public, including gifted elementary school students.  From the YouTube description:

Mathemagician Art Benjamin [professor of mathematics at Harvey Mudd College] demonstrates and explains the mathematics underlying a mental arithmetic technique for quickly squaring numbers.