# What I Learned from Reading “Gamma: Exploring Euler’s Constant” by Julian Havil: Part 5

Check out this lovely integral, dubbed the Sophomore’s Dream, found by Johann Bernoulli in 1697 (Gamma, page 44):

$\displaystyle \int_0^1 \frac{dx}{x^x} = \displaystyle \frac{1}{1^1} + \frac{1}{2^2} + \frac{1}{3^3} + \frac{1}{4^4} + \dots$.

I’ll refer to either Wikipedia or Mathworld for the derivation.

When I researching for my series of posts on conditional convergence, especially examples related to the constant $\gamma$, the reference Gamma: Exploring Euler’s Constant by Julian Havil kept popping up. Finally, I decided to splurge for the book, expecting a decent popular account of this number. After all, I’m a professional mathematician, and I took a graduate level class in analytic number theory. In short, I don’t expect to learn a whole lot when reading a popular science book other than perhaps some new pedagogical insights.

Boy, was I wrong. As I turned every page, it seemed I hit a new factoid that I had not known before.

In this series, I’d like to compile some of my favorites — while giving the book a very high recommendation.

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

# Thoughts on Infinity (Part 3f)

In recent posts, we’ve seen the curious phenomenon that the commutative and associative laws do not apply to a conditionally convergent series or infinite product: while

$\displaystyle 1 - \frac{1}{2} + \frac{1}{3} - \frac{1}{4} + \frac{1}{5} - ... = \ln 2$,

a rearranged series can be something completely different:

$\displaystyle 1 + \frac{1}{3} - \frac{1}{2} + \frac{1}{5} + \frac{1}{7} - \frac{1}{4} + \frac{1}{9} + \frac{1}{11} - \frac{1}{6} ... = \displaystyle \frac{3}{2} \ln 2$.

This very counterintuitive result can be confirmed using commonly used technology — in particular, Microsoft Excel. In the spreadsheet below, I typed:

• =IF(MOD(ROW(A1),3)=0,ROW(A1)*2/3,IF(MOD(ROW(A1),3)=1,4*(ROW(A1)-1)/3+1,4*(ROW(A1)-2)/3+3)) in cell A1
• =POWER(-1,A1-1)/A1 in cell B1
• =B1 in cell C1
• I copied cell A1 into cell A2
• =POWER(-1,A2-1)/A2 in cell B2
• =C1+B2 in cell C2

The unusual command for cell A1 was necessary to get the correct rearrangement of the series.

Then I used the FILL DOWN command to fill in the remaining rows. Using these commands cell C9 shows the sum of all the entries in cells B1 through B9, so that

$\displaystyle 1 + \frac{1}{3} - \frac{1}{2} + \frac{1}{5} + \frac{1}{7} - \frac{1}{4} + \frac{1}{9} + \frac{1}{11} - \frac{1}{6} \approx 0.961544012$

Filling down to additional rows demonstrates that the sum converges to $\displaystyle \frac{3}{2}\ln 2$ and not to $\ln 2$. Here’s the sum up to 10,000 terms… the entry in column E is the first few digits in the decimal expansion of $\displaystyle \frac{3}{2} \ln 2$.

Clearly the partial sums are not approaching $\ln 2 \approx 0.693$, and there’s good visual evidence to think that the answer is $\displaystyle \frac{3}{2} \ln 2$ instead. (Incidentally, the 10,000th partial sum is very close to the limiting value because $10,000$ is one more than a multiple of 3.)

# Thoughts on Infinity (Part 3e)

In recent posts, we’ve seen the curious phenomenon that the commutative and associative laws do not apply to a conditionally convergent series or infinite product. Here’s another classic example of this fact that’s attributed to Cauchy.

We’ve already seen in this series (pardon the pun) that

$\displaystyle 1 - \frac{1}{2} + \frac{1}{3} - \frac{1}{4} + \frac{1}{5} - ... = \ln 2$.

Let’s now see what happens if I rearrange the terms of this conditionally convergent series. Let

$T = \displaystyle 1 + \frac{1}{3} - \frac{1}{2} + \frac{1}{5} + \frac{1}{7} - \frac{1}{4} + \frac{1}{9} + \frac{11} - \frac{1}{6} \dots$,

where two positive numbers alternate with a single negative term. By all rights, this shouldn’t affect anything… right?

Let $s_n$ be the $n$th partial sum of this series, so that $s_{3n}$ contains $2n$ positive terms with odd denominators and $n$ negative terms with even denominators:

$s_{3n} = \displaystyle \sum_{k=1}^{2n} \frac{1}{2n-1} - \sum_{k=1}^n \frac{1}{2n}$.

Let me now add and subtract the “missing” even terms in the first sum:

$s_{3n} = \displaystyle \sum_{k=1}^{2n} \frac{1}{2n-1} + \sum_{k=1}^{2n} \frac{1}{2n} - \sum_{k=1}^{2n} \frac{1}{2n} - \sum_{k=1}^n \frac{1}{2n}$

$s_{3n} = \displaystyle \sum_{k=1}^{4n} \frac{1}{n} - \sum_{k=1}^{2n} \frac{1}{2n} - \sum_{k=1}^n \frac{1}{2n}$

$s_{3n} = \displaystyle \sum_{k=1}^{4n} \frac{1}{n} - \frac{1}{2} \sum_{k=1}^{2n} \frac{1}{n} - \frac{1}{2} \sum_{k=1}^n \frac{1}{n}$.

For reasons that will become apparent, I’ll now rewrite this as

$s_{3n} = \displaystyle \int_1^{4n} \frac{dx}{x} + \left( \sum_{k=1}^{4n} \frac{1}{k} - \displaystyle \int_1^{4n} \frac{dx}{x} \right)$

$- \displaystyle \frac{1}{2} \int_1^{2n} \frac{dx}{x} - \frac{1}{2} \left( \sum_{k=1}^{2n} \frac{1}{k} - \int_1^{2n} \frac{dx}{x} \right)$

$- \displaystyle \frac{1}{2} \int_1^{n} \frac{dx}{x} - \frac{1}{2} \left( \sum_{k=1}^{n} \frac{1}{k} - \int_1^{n} \frac{dx}{x} \right)$,

or

$s_{3n} = \ln(4n) - \ln 1 + \displaystyle \left( \sum_{k=1}^{4n} \frac{1}{k} - [\ln(4n) - \ln 1]\right)$

$- \displaystyle \frac{1}{2}[\ln (2n) - \ln 1] - \displaystyle \frac{1}{2} \left( \sum_{k=1}^{2n} \frac{1}{k} - [\ln (2n) - \ln 1]\right)$

$- \displaystyle \frac{1}{2}[\ln n - \ln 1] - \displaystyle \frac{1}{2} \left( \sum_{k=1}^{n} \frac{1}{k} - [\ln n - \ln 1]\right)$

Since $\ln 1 = 0$, $\ln(2n) = \ln 2 + \ln n$, and $\ln(4n) = \ln 4 + \ln n = 2\ln 2 + \ln n$, we have

$s_{3n} = 2\ln 2 + \ln n + \displaystyle \left( \sum_{k=1}^{4n} \frac{1}{k} - \ln 4n \right)$

$\displaystyle - \frac{\ln 2 + \ln n}{2} - \displaystyle \frac{1}{2} \left( \sum_{k=1}^{2n} \frac{1}{k} - \ln 2n \right)$

$\displaystyle - \frac{\ln n}{2} - \frac{1}{2} \displaystyle \left( \sum_{k=1}^{n} \frac{1}{k} - \ln n \right)$,

or

$s_{3n}= \displaystyle \frac{3}{2}\ln 2 + \displaystyle \left( \sum_{k=1}^{4n} \frac{1}{k} - \ln 4n \right) - \frac{1}{2}\left( \sum_{k=1}^{2n} \frac{1}{k} - \ln 2n\right) - \frac{1}{2}\left( \sum_{k=1}^{n} \frac{1}{k} - \ln n\right)$.

I now take the limit as $m \to \infty$:

$\displaystyle \lim_{n \to \infty} s_{3n} = \displaystyle \frac{3}{2}\ln 2 + \lim_{n \to \infty} \left( \sum_{k=1}^{4n} \frac{1}{k} - \ln 4n \right) - \frac{1}{2} \lim_{n \to \infty} \left( \sum_{k=1}^{2n} \frac{1}{k} - \ln 2n\right) - \frac{1}{2} \lim_{n \to \infty} \left( \sum_{k=1}^{n} \frac{1}{k} - \ln n\right)$.

This step reveals why I added and subtracted the integrals above: those gymnastics were necessary in order to reach a limit that converges.

As shown earlier in this series, if

$\displaystyle \lim_{m \to \infty} \left( \sum_{k=1}^m \frac{1}{k} - \ln m \right) = \gamma$,

the Euler-Mascheroni constant. Therefore, since the limit of any subsequence must converge to the same limit, we have

Applying these above, we conclude

$\displaystyle \lim_{m \to \infty} s_{3n} = \displaystyle \frac{3}{2}\ln 2 + \gamma - \frac{1}{2}\gamma - \frac{1}{2} \gamma = \displaystyle \frac{3}{2} \ln 2$,

which is different than $\ln 2$.

Technically, I’ve only shown so far that the limit of partial sums 3, 6, 9, … is $\displaystyle\frac{3}{2} \ln 2$. For the other partial sums, I note that

$\displaystyle \lim_{n \to \infty} t_{3n+1} = \displaystyle \lim_{n \to \infty} \left(s_{3n} + \displaystyle \frac{1}{4n+1} \right) = \displaystyle \frac{3}{2} \ln 2 + 0 = \displaystyle \frac{3}{2} \ln 2$

and

$\displaystyle \lim_{n \to \infty} t_{3n-1} = \displaystyle \lim_{n \to \infty} \left(s_{3n} - \displaystyle \frac{1}{2n} \right) = \displaystyle \frac{3}{2} \ln 2 - 0 = \displaystyle \frac{3}{2} \ln 2$.

Therefore, I can safely conclude that

$T = \displaystyle \lim_{n \to \infty} t_n = \displaystyle \frac{3}{2} \ln 2$,

which is different than the original sum $S$.

# Thoughts on Infinity (Part 3d)

In recent posts, we’ve seen the curious phenomenon that the commutative and associative laws do not apply to a conditionally convergent series or infinite product. Here’s another classic example of this fact that’s attributed to Cauchy.

In yesterday’s post, I showed that

$\displaystyle 1 - \frac{1}{2} + \frac{1}{3} - \frac{1}{4} + \frac{1}{5} - ... = \ln 2$.

This can be (sort of) confirmed using commonly used technology — in particular, Microsoft Excel. In the spreadsheet below, I typed:

• 1 in cell A1
• =POWER(-1,A1-1)/A1 in cell B1
• =B1 in cell C1
• =A1+1 in cell A2
• =POWER(-1,A2-1)/A2 in cell B2
• =C1+B2 in cell C2
• Then I used the FILL DOWN command to fill in the remaining rows. Using these commands cell C10 shows the sum of all the entries in cells B1 through B10, so that

$1 - \displaystyle \frac{1}{2} + \frac{1}{3} - \frac{1}{4} + \frac{1}{5} - \frac{1}{6} + \frac{1}{7} - \frac{1}{8} + \frac{1}{9} - \frac{1}{10} \approx 0.645634921$

Filling down to additional rows demonstrates that the sum converges to $\ln 2$, albeit very slowly (as is typical for conditionally convergent series). Here’s the sum up to 200 terms… the entry in column E is the first few digits in the decimal expansion of $\ln 2$.

Here’s the result after 2000 terms:

20,000 terms:

And finally, 200,000 terms. (It takes a few minutes for Microsoft Excel to scroll this far.)

We see that, as expected, the partial sums are converging to $\ln 2$, as expected. Unfortunately, the convergence is extremely slow — we have to compute 10 times as many terms in order to get one extra digit in the final answer.

# Thoughts on Infinity (Part 3c)

In recent posts, we’ve seen the curious phenomenon that the commutative and associative laws do not apply to a conditionally convergent series or infinite product. Here’s another classic example of this fact that’s attributed to Cauchy.

Define

$S = \displaystyle 1 - \frac{1}{2} + \frac{1}{3} - \frac{1}{4} + \frac{1}{5} - ...$

By the alternating series test, this series converges. However,

$\displaystyle \sum_{n=1}^\infty |a_n| = \displaystyle \sum_{n=1} \frac{1}{n}$,

which is the divergent harmonic series which was discussed earlier in this series. Therefore, the series $S$ converges conditionally and not absolutely.

To calculate the value of $S$, let $s_n = \displaystyle \sum_{k=1}^n \frac{(-1)^{k-1}}{k}$, the $n$th partial sum of $S$. Since the series converges, we know that $\displaystyle \lim_{n \to \infty} s_n$ converges. Furthermore, the limit of any subsequence, like $\displaystyle \lim_{n \to \infty} s_{2n}$, must also converge to $S$.

If $n$ is even, so that $n = 2m$ and $m$ is an integer, then

$s_{2m} = \displaystyle \sum_{k=1}^n \frac{(-1)^{k-1}}{k}$

$= \displaystyle \sum_{k=1}^{m} \frac{1}{2k-1} - \sum_{k=1}^m \frac{1}{2k}$

$= \displaystyle \left( \sum_{k=1}^{2m} \frac{1}{k} - \sum_{k=1}^m \frac{1}{2k} \right) - \sum_{k=1}^m \frac{1}{2k}$

$= \displaystyle \sum_{k=1}^{2m} \frac{1}{k} - 2 \sum_{k=1}^m \frac{1}{2k}$

$= \displaystyle \sum_{k=1}^{2m} \frac{1}{k} - \sum_{k=1}^m \frac{1}{k}$.

For reasons that will become apparent, I’ll now rewrite this as

$s_{2m} = \displaystyle \int_1^{2m} \frac{dx}{x} + \left( \sum_{k=1}^{2m} \frac{1}{k} - \displaystyle \int_1^{2m} \frac{dx}{x} \right) - \displaystyle \int_1^m \frac{dx}{x} - \left( \sum_{k=1}^m \frac{1}{k} - \int_1^m \frac{dx}{x} \right)$,

or

$s_{2m} = \ln(2m) - \ln 1 + \displaystyle \left( \sum_{k=1}^{2m} \frac{1}{k} - [\ln(2m) - \ln 1]\right)$

$- [\ln m - \ln 1] - \displaystyle \left( \sum_{k=1}^m \frac{1}{k} - [\ln m - \ln 1]\right)$.

Since $ln 1 = 0$ and $\ln(2m) = \ln 2 + \ln m$, we have

$s_{2m} = \ln 2 + \ln m + \displaystyle \left( \sum_{k=1}^{2m} \frac{1}{k} - \ln 2m \right) - \ln m - \displaystyle \left( \sum_{k=1}^m \frac{1}{k} - \ln m \right)$

$= \ln 2 + \displaystyle \left( \sum_{k=1}^{2m} \frac{1}{k} - \ln 2m \right) - \left( \sum_{k=1}^m \frac{1}{k} - \ln m\right)$.

I now take the limit as $m \to \infty$:

$\displaystyle \lim_{m \to \infty} s_{2m} = \ln 2 + \displaystyle \lim_{m \to \infty} \left( \sum_{k=1}^{2m} \frac{1}{k} - \ln 2m\right) - \lim_{m \to \infty} \left( \sum_{k=1}^m \frac{1}{k} - \ln m \right)$.

This step reveals why I added and subtracted the integrals above: those gymnastics were necessary in order to reach a limit that converges.

In yesterday’s post, I showed that if

$t_m = \displaystyle \left( \sum_{k=1}^m \frac{1}{k} - \ln m \right)$

$\displaystyle \lim_{m \to \infty} t_m = \displaystyle \lim_{m \to \infty} \left( \sum_{k=1}^m \frac{1}{k} - \ln m \right) = \gamma$,

the Euler-Mascheroni constant. Therefore, the limit of any subsequence must converge to the same limit; in particular,

$\displaystyle \lim_{m \to \infty} t_{2m} =\displaystyle \lim_{m \to \infty} \left( \sum_{k=1}^{2m} \frac{1}{k} - \ln 2m \right)= \gamma$.

Applying these above, we conclude

$\displaystyle \lim_{m \to \infty} s_{2m} = \ln 2 + \gamma - \gamma$,

or

$S = \ln 2$.

# Thoughts on Infinity (Part 3b)

The five most important numbers in mathematics are $0$, $1$, $e$, $\pi$, and $i$. In sixth place (a distant sixth place) is probably $\gamma$, the Euler-Mascheroni constant. See Mathworld or Wikipedia for more details. (For example, it’s astounding that we still don’t know if $\gamma$ is irrational or not.)

In yesterday’s post, we’ve seen the curious phenomenon that the commutative and associative laws do not apply to a conditionally convergent series or infinite product. In tomorrow’s post, I’ll present another classic example of this phenomenon due to Cauchy. However, to be ready for this fact, I’ll need to see how $\gamma$ arises from a certain conditionally convergent series.

Separately define the even and odd terms of the sequence $\{a_n\}$ by

$a_{2n} = \displaystyle \int_n^{n+1} \frac{dx}{x}$

and

$a_{2n-1} = \displaystyle \frac{1}{n}$.

It’s pretty straightforward to show that this sequence is decreasing. The function $f(x) = \displaystyle \frac{1}{x}$ is clearly decreasing for $x > 0$, and so the maximum value of $f(x)$ on the interval $[n,n+1]$ must occur at the left endpoint, while the minimum value must occur at the right endpoint. Since the length of this interval is $1$, we have

$\displaystyle \frac{1}{n+1} \cdot 1 < \displaystyle \int_n^{n+1} \frac{dx}{x} < \displaystyle \frac{1}{n} \cdot 1$,

or

$a_{2n+1} < a_{2n} < a_{2n-1}$.

Since the subsequence $\{a_{2n-1}\}$ clearly decreases to $0$, this shows the full sequence $\{a_n\}$ is a decreasing sequence with limit $0$.

By the alternating series test, this implies that the series

$\displaystyle \sum_{n=1}^\infty (-1)^{n-1} a_n$

converges. This limit is called the

Since this series converges, that means that the limit of the partial sums converges to $\gamma$:

$\displaystyle \lim_{M \to \infty} \sum_{n=1}^M (-1)^{n-1} a_n = \gamma$.

Let’s take the upper limit to be an odd number $M$, where $M = 2N-1$ and $N$ is an integer. Then by separating the even and odd terms, we obtain

$\displaystyle \sum_{n=1}^{2N-1} (-1)^{n-1} a_n = \displaystyle \sum_{n=1}^{N} (-1)^{2n-1-1} a_{2n-1} + \sum_{n=1}^{N-1} (-1)^{2n-1} a_{2n}$

$= \displaystyle \sum_{n=1}^N a_{2n-1} - \sum_{n=1}^{N-1} a_{2n}$

$= \displaystyle \sum_{n=1}^N \frac{1}{n} - \sum_{n=1}^{N-1} \int_n^{n+1} \frac{dx}{x}$

$= \displaystyle \sum_{n=1}^N \frac{1}{n} - \int_1^N \frac{dx}{x}$.

Therefore,

$\displaystyle \lim_{N \to \infty} \left( \sum_{n=1}^N \frac{1}{n} - \int_1^N \frac{dx}{x} \right) = \gamma$.

With this interpretation, the sum can be viewed as the sum of the $N$ rectangles in the above picture, while the integral is the area under the hyperbola. Therefore, the limit $\gamma$ can be viewed as the limit of the blue part of the above picture.

In other words, it’s an amazing fact that while both

$\displaystyle \sum_{n=1}^\infty \frac{1}{n}$

and

$\displaystyle \int_1^\infty \frac{dx}{x}$

diverge, somehow the difference

$\displaystyle \lim_{N \to \infty} \left(\sum_{n=1}^N \frac{1}{n} - \int_1^N \frac{dx}{x} \right)$

converges… and this limit is defined to be the number $\gamma$.

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

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$

As we’ve seen in this series, the answer is

$\displaystyle \frac{\sqrt{2}}{8} \ln \left(\frac{x^2 + x\sqrt{2} + 1}{x^2 - x\sqrt{2} + 1} \right) + \frac{\sqrt{2}}{4} \tan^{-1} ( x\sqrt{2} - 1 ) + \frac{\sqrt{2}}{4} \tan^{-1}( x \sqrt{2} + 1) + C$

Also, as long as $x \ne 1$ and $x \ne -1$, there is an alternative answer:

$\displaystyle \int \frac{1}{x^4 + 1} dx = \displaystyle \frac{\sqrt{2}}{8} \ln \left(\frac{x^2 + x\sqrt{2} + 1}{x^2 - x\sqrt{2} + 1} \right) + \frac{\sqrt{2}}{4} \tan^{-1} \left( \displaystyle \frac{x \sqrt{2}}{1 - x^2} \right) + C$.

In this concluding post of this series, I’d like to talk about the practical implications of the assumptions that $x \ne 1$ and $x \ne -1$.

For the sake of simplicity for the rest of this post, let

$F(x) = \displaystyle \frac{\sqrt{2}}{8} \ln \left(\frac{x^2 + x\sqrt{2} + 1}{x^2 - x\sqrt{2} + 1} \right) + \frac{\sqrt{2}}{4} \tan^{-1} ( x\sqrt{2} - 1 ) + \frac{\sqrt{2}}{4} \tan^{-1}( x \sqrt{2} + 1)$

and

$G(x) = \displaystyle \int \frac{1}{x^4 + 1} dx = \displaystyle \frac{\sqrt{2}}{8} \ln \left(\frac{x^2 + x\sqrt{2} + 1}{x^2 - x\sqrt{2} + 1} \right) + \frac{\sqrt{2}}{4} \tan^{-1} \left( \displaystyle \frac{x \sqrt{2}}{1 - x^2} \right)$.

If I evaluate a definite integral of $\displaystyle \frac{1}{x^4+1}$ over an interval that contains neither $x = 1$ or $x = -1$, then either $F$ or $G$ can be used. Courtesy of Mathematica:

However, if the region of integration contains either $x = -1$ or $x =1$ (or both), then only using $F$ returns the correct answer.

So this should be a cautionary tale about solving for angles, as the innocent-looking $+n\pi$ that appeared several posts ago ultimately makes a big difference in the final answers that are obtained.

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

In the course of evaluating the antiderivative

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

I have stumbled across a very curious trigonometric identity:

$\tan^{-1} ( x\sqrt{2} - 1 ) + \tan^{-1}( x \sqrt{2} + 1) = \tan^{-1} \left( \displaystyle \frac{x \sqrt{2}}{1 - x^2} \right) -\pi$ if $x < x_2$,

$\tan^{-1} ( x\sqrt{2} - 1 ) + \tan^{-1}( x \sqrt{2} + 1) = \tan^{-1} \left( \displaystyle \frac{x \sqrt{2}}{1 - x^2} \right)$ if $x_2 < x < x_1$,

$\tan^{-1} ( x\sqrt{2} - 1 ) + \tan^{-1}( x \sqrt{2} + 1) = \tan^{-1} \left( \displaystyle \frac{x \sqrt{2}}{1 - x^2} \right) + \pi$ if $x> x_1$,

where $x_1$ and $x_2$ are the unique values so that

$\tan^{-1} ( x_1\sqrt{2} - 1 ) + \tan^{-1}( x_1 \sqrt{2} + 1) = \displaystyle \frac{\pi}{2}$,

$\tan^{-1} ( x_2\sqrt{2} - 1 ) + \tan^{-1}( x_2 \sqrt{2} + 1) = -\displaystyle \frac{\pi}{2}$.

I will now show that $x_1 = 1$ and $x_2 = -1$. Indeed, it’s apparent that these have to be the two transition points because these are the points where $\displaystyle \frac{x \sqrt{2}}{1 - x^2}$ is undefined. However, it would be more convincing to show this directly.

To show that $x_1 = 1$, I need to show that

$\tan^{-1} (\sqrt{2} - 1 ) + \tan^{-1}( \sqrt{2} + 1) = \displaystyle \frac{\pi}{2}$.

I could do this with a calculator…

…but that would be cheating.

Instead, let $\alpha = \tan^{-1} (\sqrt{2} - 1 )$ and $\beta = \tan^{-1} (\sqrt{2} + 1 )$, so that

$\tan \alpha = \sqrt{2} - 1$,

$\tan \beta = \sqrt{2} + 1$.

Indeed, by SOHCAHTOA, the angles $\alpha$ and $\beta$ can be represented in the figure below:

The two small right triangles make one large triangle, and I will show that the large triangle is also a right triangle. To do this, let’s find the lengths of the three sides of the large triangle. The length of the longest side is clearly $\sqrt{2} - 1 + \sqrt{2} + 1 = 2\sqrt{2}$. I will use the Pythagorean theorem to find the lengths of the other two sides. For the small right triangle containing $\alpha$, the missing side is

$\sqrt{ \left(\sqrt{2} - 1 \right)^2 + 1^2} = \sqrt{2 - 2\sqrt{2} + 1 + 1} = \sqrt{4-2\sqrt{2}}$

Next, for the small right triangle containing $\beta$, the missing side is

$\sqrt{ \left(\sqrt{2} + 1 \right)^2 + 1^2} = \sqrt{2 + 2\sqrt{2} + 1 + 1} = \sqrt{4+2\sqrt{2}}$

So let me redraw the figure, eliminating the altitude from the previous figure:

Notice that the condition of the Pythagorean theorem is satisfied, since

$\left( \sqrt{4-2\sqrt{2}} \right)^2 + \left( \sqrt{4+2\sqrt{2}} \right)^2 = 4 - 2\sqrt{2} + 4 + 2 \sqrt{2} = 8$,

or

$\left( \sqrt{4-2\sqrt{2}} \right)^2 + \left( \sqrt{4+2\sqrt{2}} \right)^2 = \left( 2\sqrt{2} \right)^2$.

Therefore, by the converse of the Pythagorean theorem, the above figure must be a right triangle (albeit a right triangle with sides of unusual length), and so $\alpha + \beta = \pi/2$. In other words, $x_1 = 1$, as required.

To show that $x_2 = -1$, I will show that the function $f(x) = \tan^{-1} ( x\sqrt{2} - 1 ) + \tan^{-1}( x \sqrt{2} + 1)$ is an odd function using the fact that $\tan^{-1} x$ is also an odd function:

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

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

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

$= - \left[ \tan^{-1} ( x\sqrt{2} + 1 ) + \tan^{-1}( x \sqrt{2} - 1) \right]$

$= -f(x)$.

Therefore, $f(-1) = -f(1) = -\displaystyle \frac{\pi}{2}$, and so $x_2 = -1$.