Chapter IX · The logarithmic, exponential and circular functions of a real variable

The series for the inverse tangent

§221 30 min

The same integration trick gives arctan⁡x=x−x3/3+x5/5−…\arctan x = x - x^3/3 + x^5/5 - \dots for −1≤x≤1-1 \le x \le 1, hence π/4=1−1/3+1/5−…\pi/4 = 1 - 1/3 + 1/5 - \dots; and small arguments turn it into a practical way of computing π\pi.

Why this matters

In §163 the inverse tangent was identified with an integral, arctan⁡x=∫0xdt1+t2\arctan x = \int_0^x \frac{dt}{1+t^2}, taking the value between −12π-\tfrac12\pi and 12π\tfrac12\pi. The integrand is again a geometric series, now in −t2-t^2, so the method of §220 applies almost word for word. Hardy leaves the details to the reader in §221; this lesson supplies them. The payoff is the most famous series in mathematics, 14π=1−13+15−…\tfrac14\pi = 1 - \tfrac13 + \tfrac15 - \dots, and with it the first serious method of calculating π\pi.

The idea

For every real tt and every m≥1m \ge 1,

11+t2=1−t2+t4−⋯+(−1)m−1t2m−2+(−1)mt2m1+t2,\frac{1}{1+t^2} = 1 - t^2 + t^4 - \dots + (-1)^{m-1}t^{2m-2} + (-1)^m\frac{t^{2m}}{1+t^2},

as you can check by multiplying by 1+t21 + t^2. This time the denominator 1+t21 + t^2 never vanishes and is never less than 11, which makes the remainder even easier to control than for the logarithm.

Explore The arctan remainder as an area

Try this. Set x=1x = 1 and increase mm; then try x=−1x = -1 and x=0.5x = 0.5; finally move xx beyond 11.

ty
  • 11+t2\frac{1}{1+t^2}
  • the first mm terms of the geometric series
  • area between them over [0,x][0, x] = error
Sum of the first 3 terms of the series: 0.86666667; arctan⁡x=0.78539816\arctan x = 0.78539816; error 0.0813 (the shaded area is 0.0813). Bound: ∣Rm∣≤∣x∣2m+12m+1=0.143|R_m| \le \frac{|x|^{2m+1}}{2m+1} = 0.143. Inside the range of validity: more terms, smaller area.
What to notice

The picture is symmetric: 1/(1+t2)1/(1+t^2) is even, so the area from 00 to −x-x is minus the area from 00 to xx, and arctan⁡\arctan is odd. Unlike the logarithm, both endpoints x=1x = 1 and x=−1x = -1 work. Beyond ∣x∣=1|x| = 1 the polynomial runs off to ±∞\pm\infty and the error grows with mm.

Precise statements

Theorem Gregory's series for the inverse tangent Hardy: §221

If −1≤x≤1-1 \le x \le 1 then

arctan⁡x=x−x33+x55−⋯=∑n=0∞(−1)nx2n+12n+1,\arctan x = x - \frac{x^3}{3} + \frac{x^5}{5} - \dots = \sum_{n=0}^\infty \frac{(-1)^n x^{2n+1}}{2n+1},

where arctan⁡x\arctan x is the value between −12π-\tfrac12\pi and 12π\tfrac12\pi. For ∣x∣>1|x| > 1 the series diverges. In particular (Leibniz),

π4=1−13+15−17+… .\frac{\pi}{4} = 1 - \frac13 + \frac15 - \frac17 + \dots.

Proofs

Proof The series for arctan⁡x\arctan x
Strategy

Integrate the finite identity from 00 to xx and bound the remainder by integrating t2mt^{2m}. By oddness it is enough to treat 0≤x≤10 \le x \le 1.

The exact identity

Integrating from 00 to xx (valid for every real xx, since 1+t2>01 + t^2 > 0):

arctan⁡x=x−x33+⋯+(−1)m−1x2m−12m−1+(−1)mRm,Rm=∫0xt2m1+t2 dt.\arctan x = x - \frac{x^3}{3} + \dots + (-1)^{m-1}\frac{x^{2m-1}}{2m-1} + (-1)^m R_m, \qquad R_m = \int_0^x \frac{t^{2m}}{1+t^2}\,dt.

The bound for 0≤x≤10 \le x \le 1

Since 1+t2≥11 + t^2 \ge 1, we get 0≤Rm≤∫0xt2m dt=x2m+12m+1≤12m+10 \le R_m \le \int_0^x t^{2m}\,dt = \dfrac{x^{2m+1}}{2m+1} \le \dfrac{1}{2m+1}, which tends to 00.

Negative xx

Both sides of the identity are odd functions of xx: the integral of an even function from 00 to −x-x is minus the integral from 00 to xx, and only odd powers occur on the right. So the case −1≤x<0-1 \le x < 0 follows from the case 0<−x≤10 < -x \le 1. In particular the endpoint x=−1x = -1 is covered, which was not so for the logarithm.

Divergence for ∣x∣>1|x| > 1

The terms ∣x∣2n+1/(2n+1)|x|^{2n+1}/(2n+1) tend to ∞\infty when ∣x∣>1|x| > 1, so the series cannot converge.

Which value of the arctangent?

The integral is a continuous odd function that increases from 00 and stays between −12π-\tfrac12\pi and 12π\tfrac12\pi (see §163), so the series gives the principal value. At x=1x = 1 this is 14π\tfrac14\pi.

Leibniz’s series is beautiful but, as a method of computing π\pi, hopeless: the bound 4/(2m+1)4/(2m+1) for the error of 4(1−13+… )4(1 - \tfrac13 + \dots) means two million terms for six decimals. The cure is to use the series only at small xx, where the error falls like x2mx^{2m}. Identities such as Euler’s 14π=arctan⁡12+arctan⁡13\tfrac14\pi = \arctan\tfrac12 + \arctan\tfrac13 and Machin’s 14π=4arctan⁡15−arctan⁡1239\tfrac14\pi = 4\arctan\tfrac15 - \arctan\tfrac1{239} (proved from the addition formula of §225) do exactly that.

Explore Three formulas for π\pi race each other

Try this. Step mm from 11 to 1010 and read off how many decimals each formula gives. How many terms does Machin's formula need for six decimals?

terms merror (log scale)
  • 4arctan⁡14\arctan 1
  • 4(arctan⁡12+arctan⁡13)4(\arctan\tfrac12 + \arctan\tfrac13)
  • 16arctan⁡15−4arctan⁡123916\arctan\tfrac15 - 4\arctan\tfrac1{239}
With 3 terms of each series: 4arctan⁡14\arctan 1 ≈ 3.466666666667 (0 correct decimals); 4(arctan⁡12+arctan⁡13)4(\arctan\tfrac12 + \arctan\tfrac13) ≈ 3.145576131687 (2 correct decimals); 16arctan⁡15−4arctan⁡123916\arctan\tfrac15 - 4\arctan\tfrac1{239} ≈ 3.141621029325 (4 correct decimals). Errors that reach about 10⁻¹⁵ are at the limit of double-precision arithmetic: the flat tails are rounding noise, not mathematics.
What to notice

On the log scale the Euler and Machin errors fall along straight lines: each term gains a fixed number of digits (about 0.60.6 for Euler, since (12)2=14(\frac12)^2 = \frac14, and 1.41.4 for Machin, since (15)2=125(\frac15)^2 = \frac1{25}). Leibniz's error barely moves: after 3030 terms it still has only one correct decimal. Machin passes six correct decimals at m=5m = 5.

Worked examples and exercises

Exercise The hyperbolic twin ●○○ Hardy: Examples XCII, 2

Show that for −1<x<1-1 < x < 1,

artanh⁡x=12log⁡1+x1−x=x+x33+x55+… .\operatorname{artanh} x = \tfrac12 \log\frac{1+x}{1-x} = x + \frac{x^3}{3} + \frac{x^5}{5} + \dots .

Why does this series, unlike the one for arctan⁡\arctan, fail at x=±1x = \pm 1?

Hint
Subtract the logarithmic series for log⁡(1−x)\log(1 - x) from the one for log⁡(1+x)\log(1 + x).
Hint
Alternatively, integrate 1/(1−t2)=1+t2+t4+…1/(1 - t^2) = 1 + t^2 + t^4 + \dots as in this lesson.

Solution

For ∣x∣<1|x| < 1 both log⁡(1+x)=x−12x2+13x3−…\log(1+x) = x - \tfrac12x^2 + \tfrac13x^3 - \dots and log⁡(1−x)=−x−12x2−13x3−…\log(1-x) = -x - \tfrac12x^2 - \tfrac13x^3 - \dots hold. Subtracting, the even powers cancel and the odd ones double: log⁡1+x1−x=2(x+13x3+15x5+… )\log\frac{1+x}{1-x} = 2(x + \tfrac13x^3 + \tfrac15x^5 + \dots). At x=±1x = \pm 1 the series becomes ±(1+13+15+… )\pm(1 + \frac13 + \frac15 + \dots), which diverges like the harmonic series; correspondingly artanh⁡x→±∞\operatorname{artanh} x \to \pm\infty there. The arctan series has the same terms with alternating signs, and alternation is what rescues it at x=±1x = \pm1.

Exercise How slow is Leibniz? ●○○ Hardy: §221

How many terms mm of 1−13+15−…1 - \frac13 + \frac15 - \dots does the bound Rm≤1/(2m+1)R_m \le 1/(2m+1) require before 4(1−13+⋯±12m−1)4(1 - \frac13 + \dots \pm \frac1{2m-1}) is guaranteed to be within 10−610^{-6} of π\pi?

Hint
You need 4/(2m+1)<10−64/(2m+1) < 10^{-6}.

Solution

4/(2m+1)<10−64/(2m+1) < 10^{-6} means 2m+1>4 000 0002m + 1 > 4\,000\,000, that is, m≥2 000 000m \ge 2\,000\,000. The bound is essentially sharp: the true error after mm terms is close to 1/m1/m, so about a million terms are genuinely needed. Machin’s formula needs five.

Exercise Machin's formula ●●○ Hardy: Examples XCII, 12

Assuming 14π=4arctan⁡15−arctan⁡1239\tfrac14\pi = 4\arctan\tfrac15 - \arctan\tfrac1{239} (proved in the lesson on §225), show how to compute π\pi to six decimals, and say how many terms of each series are enough.

Hint
With mm terms, the error in arctan⁡x\arctan x is at most x2m+1/(2m+1)x^{2m+1}/(2m+1). Multiply by the coefficients 1616 and 44.

Solution

π=16arctan⁡15−4arctan⁡1239\pi = 16\arctan\tfrac15 - 4\arctan\tfrac1{239}. Using mm terms of the series for arctan⁡15\arctan\tfrac15, the error in 16arctan⁡1516\arctan\tfrac15 is at most 16⋅5−(2m+1)/(2m+1)16 \cdot 5^{-(2m+1)}/(2m+1): for m=4m = 4 this is 16/(9⋅59)≈9.1×10−716/(9 \cdot 5^9) \approx 9.1 \times 10^{-7}, not quite enough; for m=5m = 5 it is 16/(11⋅511)≈3.0×10−816/(11 \cdot 5^{11}) \approx 3.0 \times 10^{-8}. For arctan⁡1239\arctan\tfrac1{239} two terms give an error at most 4⋅239−5/5≈1.0×10−124 \cdot 239^{-5}/5 \approx 1.0 \times 10^{-12} (even one term gives about 10−710^{-7}). With five and two terms:

16(15−1375+115625−1546875+117578125)−4(1239−13⋅2393)=16×0.19739556−4×0.00418408=3.15832899−0.01673630,16\Bigl(\tfrac15 - \tfrac1{375} + \tfrac1{15625} - \tfrac1{546875} + \tfrac1{17578125}\Bigr) - 4\Bigl(\tfrac1{239} - \tfrac1{3\cdot 239^3}\Bigr) = 16 \times 0.19739556 - 4 \times 0.00418408 = 3.15832899 - 0.01673630,

which is 3.14159273.1415927 with a total error below 4×10−84 \times 10^{-8}. So π=3.141593\pi = 3.141593 to six decimals. The widget above reproduces these numbers.

Exercise ●●● Hardy: Examples XCII, 19

Show that ∫0xdt1+t4=x−x55+x99−…\displaystyle\int_0^x \frac{dt}{1+t^4} = x - \frac{x^5}{5} + \frac{x^9}{9} - \dots for −1≤x≤1-1 \le x \le 1, and deduce that

1−15+19−113+⋯=π+2log⁡(2+1)42.1 - \frac15 + \frac19 - \frac1{13} + \dots = \frac{\pi + 2\log(\sqrt2 + 1)}{4\sqrt2}.
Hint
The first part is the method of this lesson with t4t^4 in place of t2t^2.
Hint
For the value, factor 1+t4=(t2+2 t+1)(t2−2 t+1)1 + t^4 = (t^2 + \sqrt2\,t + 1)(t^2 - \sqrt2\,t + 1) and use partial fractions.
Solution

The series. 11+t4=1−t4+⋯+(−1)m−1t4m−4+(−1)mt4m1+t4\frac{1}{1+t^4} = 1 - t^4 + \dots + (-1)^{m-1}t^{4m-4} + (-1)^m\frac{t^{4m}}{1+t^4}. Integrating, the remainder is at most ∫0∣x∣t4m dt=∣x∣4m+1/(4m+1)→0\int_0^{|x|} t^{4m}\,dt = |x|^{4m+1}/(4m+1) \to 0 for ∣x∣≤1|x| \le 1.

The value. At x=1x = 1 the left side is ∫01dt1+t4\int_0^1 \frac{dt}{1+t^4}. Partial fractions give an antiderivative (check by differentiating)

F(t)=142{log⁡t2+2t+1t2−2t+1+2arctan⁡(2t+1)+2arctan⁡(2t−1)}.F(t) = \frac{1}{4\sqrt2}\left\{\log\frac{t^2 + \sqrt2 t + 1}{t^2 - \sqrt2 t + 1} + 2\arctan(\sqrt2 t + 1) + 2\arctan(\sqrt2 t - 1)\right\}.

At t=0t = 0 everything vanishes (the two arctangents are ±14π\pm\tfrac14\pi). At t=1t = 1, 2+22−2=(2+1)2\frac{2 + \sqrt2}{2 - \sqrt2} = (\sqrt2 + 1)^2, so the logarithm is 2log⁡(2+1)2\log(\sqrt2 + 1); and arctan⁡(2+1)+arctan⁡(2−1)=12π\arctan(\sqrt2 + 1) + \arctan(\sqrt2 - 1) = \tfrac12\pi because the two arguments are reciprocals of each other (both positive). Hence ∫01dt1+t4=2log⁡(2+1)+π42≈0.866973\int_0^1 \frac{dt}{1+t^4} = \frac{2\log(\sqrt2 + 1) + \pi}{4\sqrt2} \approx 0.866973.

Check yourself

Check yourself Enter a number

What is the smallest mm for which the bound 4/(2m+1)4/(2m+1) on the error of 4(1−13+⋯±12m−1)4\bigl(1 - \frac13 + \dots \pm \frac{1}{2m-1}\bigr) is less than 0.010.01?

Why

4/(2m+1)<0.014/(2m+1) < 0.01 means 2m+1>4002m + 1 > 400, so m≥200m \ge 200 (at m=199m = 199 the bound is 4/399>0.014/399 > 0.01). Two hundred terms for two decimals.

Check yourself True or false?

Putting x=2x = 2 in the series gives arctan⁡2=2−83+325−…\arctan 2 = 2 - \frac83 + \frac{32}{5} - \dots.

Why

False. For ∣x∣>1|x| > 1 the terms ∣x∣2n+1/(2n+1)|x|^{2n+1}/(2n+1) grow without bound, so the series diverges, even though arctan⁡2\arctan 2 exists. To compute arctan⁡2\arctan 2 use arctan⁡2=12π−arctan⁡12\arctan 2 = \tfrac12\pi - \arctan\tfrac12 and the series at 12\tfrac12.

Check yourself Choose one

Why does the arctan series converge at x=−1x = -1, while the logarithmic series diverges there?

Why

The log integrand 1/(1+t)1/(1+t) blows up at t=−1t = -1, and the series at x=−1x = -1 is minus the harmonic series. The arctan integrand is at most 11 everywhere, so the bound ∣Rm∣≤∣x∣2m+1/(2m+1)|R_m| \le |x|^{2m+1}/(2m+1) holds on both sides, which is the oddness of arctan⁡\arctan seen in the series. At x=−1x = -1 the series is −(1−13+15−… )=−14π-(1 - \frac13 + \frac15 - \dots) = -\frac14\pi. It converges only conditionally there (the absolute values give 1+13+15+…1 + \frac13 + \frac15 + \dots, which diverges), and the fact that arctan⁡\arctan is defined everywhere is no help: the series still diverges for ∣x∣>1|x| > 1.

Hardy’s language

The value of arc tan x which is represented by the series is of course that which lies between −½π and ½π.

— G. H. Hardy, §221

Summary

Summary
  • arctan⁡x=x−13x3+15x5−…\arctan x = x - \frac13 x^3 + \frac15 x^5 - \dots for −1≤x≤1-1 \le x \le 1 (principal value); at x=1x = 1, 14π=1−13+15−…\frac14\pi = 1 - \frac13 + \frac15 - \dots.
  • Proof: integrate the finite geometric sum in −t2-t^2; the remainder satisfies ∣Rm∣≤∣x∣2m+1/(2m+1)|R_m| \le |x|^{2m+1}/(2m+1).
  • Both endpoints work because 1/(1+t2)≤11/(1+t^2) \le 1 and the function is odd; for ∣x∣>1|x| > 1 the series diverges.
  • The error falls like ∣x∣2m|x|^{2m}, so the series should be used at small xx: Machin’s π=16arctan⁡15−4arctan⁡1239\pi = 16\arctan\frac15 - 4\arctan\frac1{239} gives six decimals with five terms.