Ran Wei/ Calculus/Module 15
中文
Calculus · Part IV · Sequences and series

Module 15Power series and Taylor series

Turn functions into polynomials that never end. You will find where a power series converges, build the series of the standard functions, bound the error of every approximation with Taylor’s theorem, and use series to compute e, π and ln 2, evaluate limits, simplify formulas of physics and see how a computer evaluates a sine. At the end, the series of the exponential, the sine and the cosine combine into Euler’s formula.

⏱ 270 minYou need: Modules 1 to 14, especially the rules of differentiation (Modules 4 to 7), the Mean Value Theorem (Module 8) and series with the ratio test (Module 14)

In this module you will

  • Find the radius and the interval of convergence of a power series with the ratio test, checking the endpoints separately
  • Build power series from the geometric series, and differentiate and integrate them term by term
  • Find Taylor and Maclaurin series from derivatives, and know the standard series and where they converge
  • Bound the error of a Taylor polynomial with Taylor’s theorem, and prove that ex,e^x\mathclose{\text{,}} sin⁡x\sin x and cos⁡x\cos x equal their series
  • Use series to compute constants and limits, and to make the approximations of physics and of mathematics libraries
  • Derive Euler’s formula eiθ=cos⁡θ+isin⁡θe^{i\theta} = \cos\theta + i\sin\theta from the series, and use it to explain oscillating solutions of differential equations
1

Power series

Module 14 summed the geometric series: for every xx with ∣x∣<1,\abs{x} < 1\mathclose{\text{,}}

1+x+x2+x3+⋯=11−x.1 + x + x^2 + x^3 + \cdots = \frac{1}{1 - x}.

Read as a function of x,x\mathclose{\text{,}} the left side is a polynomial that never ends. Its partial sums

Sn(x)=1+x+x2+⋯+xn=1−xn+11−x(x≠1)\begin{aligned} S_n(x) &= 1 + x + x^2 + \cdots + x^n \\ &= \frac{1 - x^{n+1}}{1 - x} \qquad (x \ne 1) \end{aligned}

are ordinary polynomials, and for each xx between −1-1 and 1 they approach 1/(1−x)1/(1 - x) as nn grows. Figure 15.1 (left) shows them: inside the interval (−1,1)(-1, 1) the polynomials hug the curve more and more closely; outside it they peel away. The table follows three values of x:x\mathclose{\text{:}}

nnSn(0.5)S_n(0.5)Sn(−0.9)S_n(-0.9)Sn(1.1)S_n(1.1)
111.51.50.10.12.12.1
221.751.750.910.913.313.31
551.968751.968750.246610.246617.715617.71561
10101.999021.999020.6914790.69147918.531218.5312
20202.000002.000000.5839050.58390564.002564.0025
50502.000002.000000.5287570.5287571281.301281.30

At x=0.5x = 0.5 the partial sums close in on 1/(1−0.5)=21/(1 - 0.5) = 2 quickly. At x=−0.9x = -0.9 they swing above and below 1/1.9≈0.5263161/1.9 \approx 0.526316 and close in slowly. At x=1.1x = 1.1 they grow without bound, although 1/(1−1.1)=−101/(1 - 1.1) = -10 is a perfectly good number: there the series and the function part company.

Left: the partial sums Sn(x) = 1 + x + cdots + x^n for n = 1, 2, 5 and 10, with y = 1/(1 - x) (blue). In the green band, -1 < x < 1, they close in on the curve; outside it they do not. Right: the partial sums 1 - x^2 + x^4 - cdots pm x^{2m} for m = 1, 2, 5 and 20 close in on y = 1/(1 + x^2) only for -1 < x < 1, although this function is smooth on the whole line (Section 15.2).
Figure 15.1

Left: the partial sums Sn(x)=1+x+⋯+xnS_n(x) = 1 + x + \cdots + x^n for n=1,n = 1\mathclose{\text{,}} 2, 5 and 10, with y=1/(1−x)y = 1/(1 - x) (blue). In the green band, −1<x<1,-1 < x < 1\mathclose{\text{,}} they close in on the curve; outside it they do not. Right: the partial sums 1−x2+x4−⋯±x2m1 - x^2 + x^4 - \cdots \pm x^{2m} for m=1,m = 1\mathclose{\text{,}} 2, 5 and 20 close in on y=1/(1+x2)y = 1/(1 + x^2) only for −1<x<1,-1 < x < 1\mathclose{\text{,}} although this function is smooth on the whole line (Section 15.2).

Definition 15.1Power series

A power series centred at aa (or about aa) is a series of the form

∑n=0∞cn(x−a)n=c0+c1(x−a)+c2(x−a)2+⋯ ,\begin{aligned} &\sum_{n=0}^{\infty} c_n (x - a)^n \\ &= c_0 + c_1(x - a) + c_2(x - a)^2 + \cdots, \end{aligned}

where xx is a variable and the coefficients c0,c1,c2,…c_0, c_1, c_2, \dots are constants. For each number xx it is a series of numbers, which converges or diverges; where it converges, its sum is a function of x.x\mathclose{\text{.}}

The sum reads “the sum from n=0n = 0 to infinity of cnc_n times xx minus a,a\mathclose{\text{,}} to the nn”. Its first term is c0(x−a)0,c_0(x - a)^0\mathclose{\text{,}} where (x−a)0(x - a)^0 means 1 even when x=a.x = a\mathclose{\text{.}} So every power series converges at its centre, to c0,c_0\mathclose{\text{,}} because all its other terms are 0 there. The geometric series is the power series with centre 0 and every cn=1;c_n = 1\mathclose{\text{;}} a polynomial is a power series whose coefficients are 0 from some point on.

Where a power series converges

The geometric series converges on an interval around its centre and diverges outside it. Every power series behaves in this way.

Theorem 15.1Where a power series converges

For a power series ∑cn(x−a)n,\sum c_n(x - a)^n\mathclose{\text{,}} exactly one of the following holds:

  1. it converges only at x=a;x = a\mathclose{\text{;}}
  2. it converges absolutely for every real number x;x\mathclose{\text{;}}
  3. there is a number R>0R > 0 such that the series converges absolutely when ∣x−a∣<R\abs{x - a} < R and diverges when ∣x−a∣>R.\abs{x - a} > R\mathclose{\text{.}}
Proof

The heart of the proof is a comparison with a geometric series. Suppose the series converges at some x1≠a,x_1 \ne a\mathclose{\text{,}} and let xx be closer to a:a\mathclose{\text{:}} ∣x−a∣<∣x1−a∣.\abs{x - a} < \abs{x_1 - a}\mathclose{\text{.}} The terms of a convergent series tend to 0 (otherwise the divergence test of Module 14 would make it diverge), so the terms cn(x1−a)nc_n(x_1 - a)^n tend to 0, and they are bounded: from some nn on they lie between −1-1 and 1, and the finitely many before are no larger in size than the largest of them. So there is a number MM with ∣cn(x1−a)n∣≤M\abs{c_n (x_1 - a)^n} \le M for every n.n\mathclose{\text{.}} With q=∣x−a∣/∣x1−a∣,q = \abs{x - a}/\abs{x_1 - a}\mathclose{\text{,}} which is less than 1,

∣cn(x−a)n∣=∣cn(x1−a)n∣ qn≤Mqn.\abs{c_n (x - a)^n} = \abs{c_n (x_1 - a)^n}\, q^n \le M q^n.

The geometric series ∑Mqn\sum Mq^n converges, so by the comparison test ∑∣cn(x−a)n∣\sum \abs{c_n (x - a)^n} converges: the series converges absolutely at x.x\mathclose{\text{.}} Turned round, if the series diverges at some x2,x_2\mathclose{\text{,}} it diverges at every xx farther from aa than x2,x_2\mathclose{\text{,}} since convergence there would force convergence at x2.x_2\mathclose{\text{.}}

Now consider the distances ∣x1−a∣\abs{x_1 - a} of all the points x1x_1 at which the series converges. If 0 is the only one, case 1 holds. If they include numbers as large as you please, then every xx is closer to aa than some point of convergence, and case 2 holds. Otherwise these distances are bounded, and they have a least upper bound R:R\mathclose{\text{:}} the smallest number that is at least as large as each of them. That such a number exists is the completeness of the real numbers, the property behind the Monotone Convergence Theorem of Module 14. R>0,R > 0\mathclose{\text{,}} because the series converges at some x1≠a.x_1 \ne a\mathclose{\text{.}} If ∣x−a∣<R,\abs{x - a} < R\mathclose{\text{,}} then ∣x−a∣\abs{x - a} is not an upper bound, so there is a point of convergence x1x_1 with ∣x−a∣<∣x1−a∣,\abs{x - a} < \abs{x_1 - a}\mathclose{\text{,}} and the series converges absolutely at x.x\mathclose{\text{.}} If ∣x−a∣>R,\abs{x - a} > R\mathclose{\text{,}} the series diverges at x,x\mathclose{\text{,}} because ∣x−a∣\abs{x - a} is larger than every distance at which it converges.

∎
Definition 15.2Radius and interval of convergence

The number RR of Theorem 15.1 is the radius of convergence of the series. In case 1 the radius is R=0,R = 0\mathclose{\text{,}} and in case 2 it is R=∞.R = \infty\mathclose{\text{.}} The set of all xx at which the series converges is its interval of convergence.

When 0<R<∞,0 < R < \infty\mathclose{\text{,}} the interval of convergence runs from a−Ra - R to a+R.a + R\mathclose{\text{.}} Theorem 15.1 says nothing about the two endpoints x=a−Rx = a - R and x=a+R:x = a + R\mathclose{\text{:}} at each of them the series may converge or diverge. So the interval of convergence is one of (a−R,a+R),(a - R, a + R)\mathclose{\text{,}} [a−R,a+R),[a - R, a + R)\mathclose{\text{,}} (a−R,a+R](a - R, a + R] and [a−R,a+R],[a - R, a + R]\mathclose{\text{,}} and the examples below meet all four.

Finding the radius

The ratio test of Module 14 usually finds R.R\mathclose{\text{.}} For the terms cn(x−a)n,c_n(x - a)^n\mathclose{\text{,}} with every cn≠0c_n \ne 0 and x≠a,x \ne a\mathclose{\text{,}} the ratio of consecutive terms is

∣cn+1(x−a)n+1cn(x−a)n∣=∣cn+1cn∣ ∣x−a∣.\abs{\frac{c_{n+1}(x - a)^{n+1}}{c_n (x - a)^n}} = \abs{\frac{c_{n+1}}{c_n}}\,\abs{x - a}.

If ∣cn+1/cn∣\abs{c_{n+1}/c_n} approaches a limit L,L\mathclose{\text{,}} this ratio approaches L∣x−a∣,L\abs{x - a}\mathclose{\text{,}} and the ratio test gives absolute convergence where L∣x−a∣<1L\abs{x - a} < 1 and divergence where L∣x−a∣>1.L\abs{x - a} > 1\mathclose{\text{.}} So R=1/L,R = 1/L\mathclose{\text{,}} with R=∞R = \infty if L=0,L = 0\mathclose{\text{,}} and R=0R = 0 if ∣cn+1/cn∣→∞.\abs{c_{n+1}/c_n} \to \infty\mathclose{\text{.}} At the endpoints the limit of the ratio is exactly 1, where the ratio test says nothing: test them separately, with the other tests of Module 14.

Example 15.1Three intervals of convergence✓ Checked

Find the radius and the interval of convergence of (a) ∑n=1∞xnn\displaystyle\sum_{n=1}^{\infty} \frac{x^n}{n} and (b) ∑n=1∞xnn2,\displaystyle\sum_{n=1}^{\infty} \frac{x^n}{n^2}\mathclose{\text{,}} and compare them with the geometric series ∑xn.\sum x^n\mathclose{\text{.}}

(a) Here cn=1/n,c_n = 1/n\mathclose{\text{,}} so

∣cn+1cn∣=nn+1→1,\abs{\frac{c_{n+1}}{c_n}} = \frac{n}{n + 1} \to 1,

and R=1:R = 1\mathclose{\text{:}} the series converges absolutely for ∣x∣<1\abs{x} < 1 and diverges for ∣x∣>1.\abs{x} > 1\mathclose{\text{.}} At x=1x = 1 it is the harmonic series ∑1/n,\sum 1/n\mathclose{\text{,}} which diverges. At x=−1x = -1 it is ∑(−1)n/n,\sum (-1)^n/n\mathclose{\text{,}} which converges by the alternating series test, since the sizes 1/n1/n decrease to 0. The interval of convergence is [−1,1).[-1, 1)\mathclose{\text{.}}

(b) Now ∣cn+1/cn∣=n2/(n+1)2→1,\abs{c_{n+1}/c_n} = n^2/(n + 1)^2 \to 1\mathclose{\text{,}} so again R=1.R = 1\mathclose{\text{.}} At x=±1x = \pm 1 the series of absolute values is ∑1/n2,\sum 1/n^2\mathclose{\text{,}} a convergent pp-series, so the series converges absolutely at both endpoints. The interval is [−1,1].[-1, 1]\mathclose{\text{.}}

The geometric series also has radius 1, and at x=±1x = \pm 1 its terms, 1 or (−1)n,(-1)^n\mathclose{\text{,}} do not tend to 0, so its interval is (−1,1).(-1, 1)\mathclose{\text{.}} Three series with the same radius have three different intervals: the endpoints must always be checked.

Example 15.2Radius ∞\infty and radius 0✓ Checked

Find the radius of convergence of ∑n=0∞xnn!\displaystyle\sum_{n=0}^{\infty} \frac{x^n}{n!} and of ∑n=0∞n! xn,\displaystyle\sum_{n=0}^{\infty} n!\,x^n\mathclose{\text{,}} where 0!=1.0! = 1\mathclose{\text{.}}

For the first, cn=1/n!,c_n = 1/n!\mathclose{\text{,}} and since (n+1)!=(n+1) n!,(n + 1)! = (n + 1)\,n!\mathclose{\text{,}}

∣cn+1cn∣=n!(n+1)!=1n+1→0.\abs{\frac{c_{n+1}}{c_n}} = \frac{n!}{(n + 1)!} = \frac{1}{n + 1} \to 0.

The ratio of the terms tends to 0⋅∣x∣=0<10 \cdot \abs{x} = 0 < 1 for every x:x\mathclose{\text{:}} the series converges absolutely for every x,x\mathclose{\text{,}} and R=∞.R = \infty\mathclose{\text{.}} For the second, ∣cn+1/cn∣=(n+1)!/n!=n+1→∞.\abs{c_{n+1}/c_n} = (n + 1)!/n! = n + 1 \to \infty\mathclose{\text{.}} For every x≠0x \ne 0 the ratio of the terms, (n+1)∣x∣,(n + 1)\abs{x}\mathclose{\text{,}} grows without bound, so the series diverges, and R=0:R = 0\mathclose{\text{:}} it converges only at its centre. The first series returns in Section 15.4 as the series of ex.e^x\mathclose{\text{.}}

Example 15.3A series centred at 3✓ Checked

Find the interval of convergence of ∑n=1∞(−1)n(x−3)nn 2n.\displaystyle\sum_{n=1}^{\infty} \frac{(-1)^n (x - 3)^n}{n\,2^n}\mathclose{\text{.}}

Here cn=(−1)nn 2n,c_n = \dfrac{(-1)^n}{n\,2^n}\mathclose{\text{,}} and

∣cn+1cn∣=n 2n(n+1) 2n+1=n2(n+1)→12.\begin{aligned} \abs{\frac{c_{n+1}}{c_n}} &= \frac{n\,2^n}{(n + 1)\,2^{n+1}} \\ &= \frac{n}{2(n + 1)} \to \frac12. \end{aligned}

So R=2:R = 2\mathclose{\text{:}} the series converges absolutely when ∣x−3∣<2,\abs{x - 3} < 2\mathclose{\text{,}} that is, 1<x<5,1 < x < 5\mathclose{\text{,}} and diverges when ∣x−3∣>2.\abs{x - 3} > 2\mathclose{\text{.}} At x=5,x = 5\mathclose{\text{,}} (x−3)n=2n,(x - 3)^n = 2^n\mathclose{\text{,}} and the series is ∑(−1)n/n,\sum (-1)^n/n\mathclose{\text{,}} which converges by the alternating series test. At x=1,x = 1\mathclose{\text{,}} (x−3)n=(−2)n=(−1)n2n,(x - 3)^n = (-2)^n = (-1)^n 2^n\mathclose{\text{,}} and the terms are (−1)n(−1)n2nn 2n=1n:\dfrac{(-1)^n(-1)^n 2^n}{n\,2^n} = \dfrac1n\mathclose{\text{:}} the harmonic series, which diverges. The interval of convergence is (1,5],(1, 5]\mathclose{\text{,}} centred at 3 with radius 2.

Watch out

Two slips with the ratio test. It works with absolute values: the condition in Example 15.3 is ∣x−3∣<2,\abs{x - 3} < 2\mathclose{\text{,}} an interval centred at 3, not x−3<2,x - 3 < 2\mathclose{\text{,}} which would let in every x<5.x < 5\mathclose{\text{.}} And at the endpoints, where the ratio tends to exactly 1, the test is silent: declaring them in or out without testing them is the most common error with intervals of convergence.

2

Functions as power series

Section 15.1 started from a series and found its sum. Now turn the question round: given a function, find a power series whose sum it is. The geometric series is the source of many. For every number uu with ∣u∣<1,\abs{u} < 1\mathclose{\text{,}}

11−u=∑n=0∞un=1+u+u2+⋯ ,\frac{1}{1 - u} = \sum_{n=0}^{\infty} u^n = 1 + u + u^2 + \cdots,

and uu may be replaced by any expression in x,x\mathclose{\text{,}} provided the condition ∣u∣<1\abs{u} < 1 is translated too. With u=−x,u = -x\mathclose{\text{,}} for ∣x∣<1,\abs{x} < 1\mathclose{\text{,}}

11+x=1−x+x2−x3+⋯=∑n=0∞(−1)nxn.\begin{aligned} \frac{1}{1 + x} &= 1 - x + x^2 - x^3 + \cdots \\ &= \sum_{n=0}^\infty (-1)^n x^n. \end{aligned}

With u=−x2,u = -x^2\mathclose{\text{,}} which satisfies ∣u∣<1\abs{u} < 1 exactly when ∣x∣<1,\abs{x} < 1\mathclose{\text{,}}

11+x2=1−x2+x4−x6+⋯=∑n=0∞(−1)nx2n.\begin{aligned} \frac{1}{1 + x^2} &= 1 - x^2 + x^4 - x^6 + \cdots \\ &= \sum_{n=0}^\infty (-1)^n x^{2n}. \end{aligned}

At x=±1x = \pm 1 the terms of both series have size 1 and do not tend to 0, so both intervals of convergence are (−1,1).(-1, 1)\mathclose{\text{.}} The second is a surprise. The function 1/(1+x2)1/(1 + x^2) is defined and smooth on the whole real line, with nothing special at ±1,\pm 1\mathclose{\text{,}} yet its series stops converging there (Figure 15.1, right). The reason lies off the real line, and Section 15.7 reveals it.

Example 15.4Series from the geometric series✓ Checked

Find a power series for each function, centred where stated, with its interval of convergence:

  • (a) 12−x,\dfrac{1}{2 - x}\mathclose{\text{,}} centred at 0;
  • (b) x1−x2,\dfrac{x}{1 - x^2}\mathclose{\text{,}} centred at 0;
  • (c) 1x,\dfrac1x\mathclose{\text{,}} centred at 1.

(a) Make the 1 of 1/(1−u)1/(1 - u) appear by taking out the factor 2:

12−x=12⋅11−x/2=12∑n=0∞(x2)n=∑n=0∞xn2n+1=12+x4+x28+⋯ .\begin{aligned} \frac{1}{2 - x} &= \frac12\cdot\frac{1}{1 - x/2} = \frac12\sum_{n=0}^\infty \Big(\frac{x}{2}\Big)^n \\ &= \sum_{n=0}^\infty \frac{x^n}{2^{n+1}} \\ &= \frac12 + \frac{x}{4} + \frac{x^2}{8} + \cdots. \end{aligned}

This needs ∣x/2∣<1,\abs{x/2} < 1\mathclose{\text{,}} that is, ∣x∣<2.\abs{x} < 2\mathclose{\text{.}} At x=±2x = \pm 2 the terms have size 12\tfrac12 and do not tend to 0, so the interval is (−2,2).(-2, 2)\mathclose{\text{.}}

(b) With u=x2,u = x^2\mathclose{\text{,}} 11−x2=∑x2n\dfrac{1}{1 - x^2} = \sum x^{2n} for ∣x∣<1.\abs{x} < 1\mathclose{\text{.}} Multiplying every term by xx multiplies the sum by x,x\mathclose{\text{,}} so for ∣x∣<1\abs{x} < 1

x1−x2=∑n=0∞x2n+1=x+x3+x5+⋯ .\begin{aligned} \frac{x}{1 - x^2} &= \sum_{n=0}^\infty x^{2n+1} \\ &= x + x^3 + x^5 + \cdots. \end{aligned}

At x=±1x = \pm 1 every term is ±1,\pm 1\mathclose{\text{,}} so the interval is (−1,1).(-1, 1)\mathclose{\text{.}}

(c) A series centred at 1 is a series in powers of x−1.x - 1\mathclose{\text{.}} Write x=1+(x−1)x = 1 + (x - 1) and use u=−(x−1):u = -(x - 1)\mathclose{\text{:}}

1x=11+(x−1)=∑n=0∞(−1)n(x−1)n,\frac1x = \frac{1}{1 + (x - 1)} = \sum_{n=0}^\infty (-1)^n (x - 1)^n,

for ∣x−1∣<1,\abs{x - 1} < 1\mathclose{\text{,}} that is, 0<x<2.0 < x < 2\mathclose{\text{.}} At x=0x = 0 and x=2x = 2 the terms have size 1, so the interval is (0,2):(0, 2)\mathclose{\text{:}} centred at 1, with radius 1.

One function can have different series about different centres. About 0, 12−x=∑xn/2n+1;\dfrac{1}{2 - x} = \sum x^n/2^{n+1}\mathclose{\text{;}} about 1, 12−x=11−(x−1)=∑(x−1)n,\dfrac{1}{2 - x} = \dfrac{1}{1 - (x - 1)} = \sum (x - 1)^n\mathclose{\text{,}} for ∣x−1∣<1.\abs{x - 1} < 1\mathclose{\text{.}} Each series describes the function on its own interval.

Watch out

Two slips with substitution. Losing the factor in front: 12−x\dfrac{1}{2 - x} is 12∑(x/2)n,\dfrac12\sum (x/2)^n\mathclose{\text{,}} and without the 12\tfrac12 the series is that of 22−x.\dfrac{2}{2 - x}\mathclose{\text{.}} And forgetting to translate the condition: ∑(x/2)n\sum (x/2)^n converges for ∣x∣<2,\abs{x} < 2\mathclose{\text{,}} not ∣x∣<1.\abs{x} < 1\mathclose{\text{.}} A quick test at one point catches both: at x=1x = 1 the series of Example 15.4(a) is 12+14+18+⋯=1,\tfrac12 + \tfrac14 + \tfrac18 + \cdots = 1\mathclose{\text{,}} and indeed 12−1=1.\dfrac{1}{2 - 1} = 1\mathclose{\text{.}}

3

Differentiating and integrating series

Inside its interval of convergence a power series can be treated like a polynomial: differentiated and integrated term by term.

Theorem 15.2Term-by-term differentiation and integration

Let ∑cn(x−a)n\sum c_n(x - a)^n have radius of convergence R>0R > 0 (possibly R=∞),R = \infty\mathclose{\text{),}} and for ∣x−a∣<R\abs{x - a} < R let

f(x)=∑n=0∞cn(x−a)n.f(x) = \sum_{n=0}^\infty c_n (x - a)^n.

Then, for every xx with ∣x−a∣<R:\abs{x - a} < R\mathclose{\text{:}}

  1. ff is differentiable at x,x\mathclose{\text{,}} and f′(x)=∑n=1∞n cn(x−a)n−1;\displaystyle f'(x) = \sum_{n=1}^\infty n\,c_n (x - a)^{n-1}\mathclose{\text{;}}
  2. ∫axf(t) dt=∑n=0∞cnn+1(x−a)n+1.\displaystyle \int_a^x f(t)\,dt = \sum_{n=0}^\infty \frac{c_n}{n + 1}(x - a)^{n+1}\mathclose{\text{.}}

Both new series have radius of convergence R.R\mathclose{\text{.}}

Applying part 1 again and again shows that a power series has derivatives of every order inside its interval of convergence, each found term by term. The radius never changes, but the endpoints can. The series ∑xn/n2\sum x^n/n^2 of Example 15.1 converges at both x=1x = 1 and x=−1;x = -1\mathclose{\text{;}} its derivative ∑xn−1/n\sum x^{n-1}/n converges at −1-1 only; and the next derivative, ∑(n−1)xn−2/n,\sum (n - 1)x^{n-2}/n\mathclose{\text{,}} at neither, because its terms do not tend to 0 there.

The proof is in the Going deeper box below; its key step is the Mean Value Theorem of Module 8. A first reading may take the theorem on trust.

Watch out

Term-by-term differentiation is a theorem about power series inside their interval of convergence, not about every series of functions. The series ∑n=1∞sin⁡(n2x)n2\displaystyle\sum_{n=1}^\infty \frac{\sin(n^2x)}{n^2} converges for every x,x\mathclose{\text{,}} by comparison with ∑1/n2;\sum 1/n^2\mathclose{\text{;}} but differentiating it term by term gives ∑cos⁡(n2x),\sum \cos(n^2x)\mathclose{\text{,}} which at x=0x = 0 is 1+1+1+⋯1 + 1 + 1 + \cdots and diverges.

Going deeperWhy term-by-term differentiation works

Take a=0;a = 0\mathclose{\text{;}} for another centre, write x−ax - a for xx throughout.

The derived series has the same radius. Let ∣x∣<R,\abs{x} < R\mathclose{\text{,}} and choose rr with ∣x∣<r<R.\abs{x} < r < R\mathclose{\text{.}} The series converges at r,r\mathclose{\text{,}} so its terms are bounded, as in the proof of Theorem 15.1: ∣cn∣rn≤M\abs{c_n} r^n \le M for every n.n\mathclose{\text{.}} Then, with q=∣x∣/r<1,q = \abs{x}/r < 1\mathclose{\text{,}}

∣ncnxn−1∣=n ∣cn∣rn qn−1r≤Mr nqn−1,\abs{n c_n x^{n-1}} = \frac{n\,\abs{c_n} r^n\, q^{n-1}}{r} \le \frac{M}{r}\, n q^{n-1},

and ∑nqn−1\sum n q^{n-1} converges by the ratio test when q>0:q > 0\mathclose{\text{:}} (n+1)qn/(nqn−1)→q<1.(n + 1)q^n/(n q^{n-1}) \to q < 1\mathclose{\text{.}} When q=0,q = 0\mathclose{\text{,}} only its first term is nonzero, so it converges too. Thus the derived series converges absolutely for ∣x∣<R.\abs{x} < R\mathclose{\text{.}} It diverges for ∣x∣>R:\abs{x} > R\mathclose{\text{:}} otherwise, by Theorem 15.1, it would converge absolutely at some yy with R<∣y∣<∣x∣,R < \abs{y} < \abs{x}\mathclose{\text{,}} and since ∣cnyn∣≤∣y∣ ∣ncnyn−1∣\abs{c_n y^n} \le \abs{y}\,\abs{n c_n y^{n-1}} for n≥1,n \ge 1\mathclose{\text{,}} so would the original series, which is impossible beyond its radius. The same argument, applied to the derived series, shows that the twice-derived series ∑n(n−1)cnxn−2\sum n(n - 1)c_n x^{n-2} has radius RR too.

The derivative. Let g(x)=∑ncnxn−1,g(x) = \sum n c_n x^{n-1}\mathclose{\text{,}} fix xx with ∣x∣<r<R,\abs{x} < r < R\mathclose{\text{,}} and let h≠0h \ne 0 be so small that ∣x+h∣<r.\abs{x + h} < r\mathclose{\text{.}} For n≥2,n \ge 2\mathclose{\text{,}} the Mean Value Theorem gives (x+h)n−xn=nξn−1h(x + h)^n - x^n = n\xi^{n-1}h for some ξ\xi between xx and x+h,x + h\mathclose{\text{,}} and, applied again, nξn−1−nxn−1=n(n−1)ηn−2(ξ−x)n\xi^{n-1} - nx^{n-1} = n(n - 1)\eta^{n-2}(\xi - x) for some η\eta between xx and ξ.\xi\mathclose{\text{.}} Since ∣ξ∣\abs{\xi} and ∣η∣\abs{\eta} are less than rr and ∣ξ−x∣≤∣h∣,\abs{\xi - x} \le \abs{h}\mathclose{\text{,}}

∣(x+h)n−xnh−nxn−1∣≤n(n−1) rn−2 ∣h∣,\begin{aligned} &\abs{\frac{(x + h)^n - x^n}{h} - n x^{n-1}} \\ &\qquad\le n(n - 1)\, r^{n-2}\,\abs{h}, \end{aligned}

and for n=0n = 0 and n=1n = 1 the left side is 0. The three series for f(x+h),f(x + h)\mathclose{\text{,}} f(x)f(x) and g(x)g(x) converge, so they may be combined term by term:

∣f(x+h)−f(x)h−g(x)∣≤∣h∣∑n=2∞n(n−1)∣cn∣rn−2.\begin{aligned} &\abs{\frac{f(x + h) - f(x)}{h} - g(x)} \\ &\qquad\le \abs{h} \sum_{n=2}^\infty n(n - 1)\abs{c_n} r^{n-2}. \end{aligned}

The last series converges, because the twice-derived series converges absolutely at r<R.r < R\mathclose{\text{.}} So the left side tends to 0 as h→0:h \to 0\mathclose{\text{:}} f′(x)=g(x).f'(x) = g(x)\mathclose{\text{.}}

The integral. The series F(x)=∑cnxn+1/(n+1)F(x) = \sum c_n x^{n+1}/(n + 1) has the original series as its derived series, so by the first step it has radius R,R\mathclose{\text{,}} and by the second, F′=fF' = f on (−R,R).(-R, R)\mathclose{\text{.}} Since F(0)=0,F(0) = 0\mathclose{\text{,}} the Fundamental Theorem of Calculus (Module 10) gives ∫0xf(t) dt=F(x)−F(0)=F(x).\displaystyle\int_0^x f(t)\,dt = F(x) - F(0) = F(x)\mathclose{\text{.}}

The logarithm and the arctangent

Integrating geometric series gives series for two functions that have nothing geometric about them.

Example 15.5Series for ln⁡(1+x)\ln(1 + x) and arctan⁡x\arctan x✓ Checked

Find power series about 0 for ln⁡(1+x)\ln(1 + x) and arctan⁡x,\arctan x\mathclose{\text{,}} and use four terms of the first to estimate ln⁡1.1.\ln 1.1\mathclose{\text{.}}

For ∣t∣<1,\abs{t} < 1\mathclose{\text{,}} 11+t=∑(−1)ntn.\dfrac{1}{1 + t} = \sum (-1)^n t^n\mathclose{\text{.}} Let ∣x∣<1.\abs{x} < 1\mathclose{\text{.}} The function ln⁡(1+t)\ln(1 + t) is an antiderivative of 11+t,\dfrac{1}{1 + t}\mathclose{\text{,}} and ln⁡1=0,\ln 1 = 0\mathclose{\text{,}} so by the Fundamental Theorem of Calculus and Theorem 15.2,

ln⁡(1+x)=∫0xdt1+t=∑n=0∞(−1)nxn+1n+1=x−x22+x33−x44+⋯\begin{aligned} \ln(1 + x) &= \int_0^x \frac{dt}{1 + t} \\ &= \sum_{n=0}^\infty (-1)^n\frac{x^{n+1}}{n + 1} \\ &= x - \frac{x^2}{2} + \frac{x^3}{3} - \frac{x^4}{4} + \cdots \end{aligned}

In the same way, arctan⁡x\arctan x is an antiderivative of 11+x2\dfrac{1}{1 + x^2} (Module 6), with arctan⁡0=0,\arctan 0 = 0\mathclose{\text{,}} so for ∣x∣<1\abs{x} < 1

arctan⁡x=∫0xdt1+t2=∑n=0∞(−1)nx2n+12n+1=x−x33+x55−⋯\begin{aligned} \arctan x &= \int_0^x \frac{dt}{1 + t^2} \\ &= \sum_{n=0}^\infty (-1)^n\frac{x^{2n+1}}{2n + 1} \\ &= x - \frac{x^3}{3} + \frac{x^5}{5} - \cdots \end{aligned}

Both series have radius 1, like the series that were integrated. At x=0.1,x = 0.1\mathclose{\text{,}} four terms of the logarithm series give the partial sum

S4=0.1−0.005+13000−0.000025=11437120000≈0.0953083.\begin{aligned} S_4 &= 0.1 - 0.005 \\ &\quad + \frac{1}{3000} - 0.000025 \\ &= \frac{11437}{120000} \approx 0.0953083. \end{aligned}

A calculator gives ln⁡1.1≈0.0953102:\ln 1.1 \approx 0.0953102\mathclose{\text{:}} both S4S_4 and ln⁡1.1\ln 1.1 round to 0.09531. The terms alternate in sign and decrease in size, so by the alternating series bound of Module 14 the error ln⁡1.1−S4\ln 1.1 - S_4 is positive and less than the first term left out, 0.15/5=0.000002.0.1^5/5 = 0.000002\mathclose{\text{.}} This bound applies to the exact partial sum, before rounding it. At x=12x = \tfrac12 the same series gives ln⁡32=12−18+124−⋯,\ln\tfrac32 = \tfrac12 - \tfrac18 + \tfrac{1}{24} - \cdots\mathclose{\text{,}} the sum of Exercise 14.9.

Differentiating a series is as useful as integrating it, for instance to find sums.

Example 15.6A sum found by differentiating✓ Checked

Find the sum of ∑n=1∞nxn\displaystyle\sum_{n=1}^{\infty} n x^n for ∣x∣<1,\abs{x} < 1\mathclose{\text{,}} and the value of ∑n=1∞n2n.\displaystyle\sum_{n=1}^{\infty} \frac{n}{2^n}\mathclose{\text{.}}

Differentiate the geometric series term by term (Theorem 15.2): for ∣x∣<1,\abs{x} < 1\mathclose{\text{,}}

1(1−x)2=ddx(11−x)=∑n=1∞nxn−1=1+2x+3x2+⋯ .\begin{aligned} \frac{1}{(1 - x)^2} &= \frac{d}{dx}\Big(\frac{1}{1 - x}\Big) \\ &= \sum_{n=1}^{\infty} n x^{n-1} \\ &= 1 + 2x + 3x^2 + \cdots. \end{aligned}

Multiplying by xx gives ∑n=1∞nxn=x(1−x)2.\displaystyle\sum_{n=1}^{\infty} n x^n = \frac{x}{(1 - x)^2}\mathclose{\text{.}} At x=12,x = \tfrac12\mathclose{\text{,}}

∑n=1∞n2n=1/2(1/2)2=2.\sum_{n=1}^{\infty} \frac{n}{2^n} = \frac{1/2}{(1/2)^2} = 2.

The sum has a meaning in probability. Toss a fair coin until it lands heads: the first head comes on toss nn with probability 1/2n,1/2^n\mathclose{\text{,}} so the expected number of tosses, the sum of each possible number nn times its probability, is ∑n/2n=2.\sum n/2^n = 2\mathclose{\text{.}}

The ends of the interval

At x=1x = 1 the series for ln⁡(1+x)\ln(1 + x) becomes the alternating harmonic series 1−12+13−⋯,1 - \tfrac12 + \tfrac13 - \cdots\mathclose{\text{,}} which converges by the alternating series test; Module 14 stated that its sum is ln⁡2.\ln 2\mathclose{\text{.}} Example 15.5 does not prove it, because Theorem 15.2 integrates term by term only for ∣x∣<1.\abs{x} < 1\mathclose{\text{.}} Integrating a finite sum instead, which is always allowed, proves it, with an error bound.

Theorem 15.3Two sums at the ends of the interval

For every whole number n≥1,n \ge 1\mathclose{\text{,}}

∣ln⁡2−(1−12+13−⋯+(−1)n−1n)∣≤1n+1\begin{aligned} &\abs{\ln 2 - \Big(1 - \frac12 + \frac13 - \cdots + \frac{(-1)^{n-1}}{n}\Big)} \\ &\qquad\le \frac{1}{n + 1} \end{aligned}

and

∣π4−(1−13+15−⋯+(−1)n−12n−1)∣≤12n+1.\begin{aligned} &\abs{\frac{\pi}{4} - \Big(1 - \frac13 + \frac15 - \cdots + \frac{(-1)^{n-1}}{2n - 1}\Big)} \\ &\qquad\le \frac{1}{2n + 1}. \end{aligned}

Consequently ln⁡2=1−12+13−14+⋯\ln 2 = 1 - \dfrac12 + \dfrac13 - \dfrac14 + \cdots and π4=1−13+15−17+⋯.\dfrac{\pi}{4} = 1 - \dfrac13 + \dfrac15 - \dfrac17 + \cdots\mathclose{\text{.}}

Proof

The finite geometric sum of Module 14 gives, for t≠−1,t \ne -1\mathclose{\text{,}} 1−t+t2−⋯+(−t)n−1=1−(−t)n1+t,1 - t + t^2 - \cdots + (-t)^{n-1} = \dfrac{1 - (-t)^n}{1 + t}\mathclose{\text{,}} that is,

11+t=∑k=0n−1(−1)ktk+(−1)ntn1+t.\frac{1}{1 + t} = \sum_{k=0}^{n-1} (-1)^k t^k + (-1)^n\frac{t^n}{1 + t}.

Integrate from 0 to 1. The integral of a finite sum is the sum of the integrals, ∫01tk dt=1k+1,\int_0^1 t^k\,dt = \dfrac{1}{k + 1}\mathclose{\text{,}} and ∫01dt1+t=ln⁡2,\int_0^1 \dfrac{dt}{1 + t} = \ln 2\mathclose{\text{,}} so

ln⁡2=∑k=0n−1(−1)kk+1+(−1)n∫01tn1+t dt.\ln 2 = \sum_{k=0}^{n-1} \frac{(-1)^k}{k + 1} + (-1)^n \int_0^1 \frac{t^n}{1 + t}\,dt.

The sum is 1−12+⋯+(−1)n−1n.1 - \tfrac12 + \cdots + \tfrac{(-1)^{n-1}}{n}\mathclose{\text{.}} For 0≤t≤1,0 \le t \le 1\mathclose{\text{,}} 0≤tn1+t≤tn,0 \le \dfrac{t^n}{1 + t} \le t^n\mathclose{\text{,}} so the last integral lies between 0 and ∫01tn dt=1n+1\int_0^1 t^n\,dt = \dfrac{1}{n + 1} (the comparison theorem of Module 9). This is the first inequality, and since 1n+1→0,\dfrac{1}{n + 1} \to 0\mathclose{\text{,}} the partial sums approach ln⁡2.\ln 2\mathclose{\text{.}} For π4,\dfrac{\pi}{4}\mathclose{\text{,}} put t2t^2 for tt in the identity:

11+t2=∑k=0n−1(−1)kt2k+(−1)nt2n1+t2.\frac{1}{1 + t^2} = \sum_{k=0}^{n-1} (-1)^k t^{2k} + (-1)^n\frac{t^{2n}}{1 + t^2}.

Integrating from 0 to 1 gives arctan⁡1=π4\arctan 1 = \dfrac{\pi}{4} on the left, and on the right the partial sum plus ±\pm an integral that lies between 0 and ∫01t2n dt=12n+1.\int_0^1 t^{2n}\,dt = \dfrac{1}{2n + 1}\mathclose{\text{.}}

∎

The bound also shows how slowly the alternating harmonic series converges. After 10, 100 and 1000 terms its partial sums are about 0.6456, 0.6882 and 0.6926, while ln⁡2≈0.693147:\ln 2 \approx 0.693147\mathclose{\text{:}} the error magnitudes are close to 1/(2n),1/(2n)\mathclose{\text{,}} so each extra correct decimal costs ten times as many terms. Section 15.6 finds much faster series for ln⁡2\ln 2 and π.\pi\mathclose{\text{.}}

The proof used special features of ln⁡(1+x)\ln(1 + x) and arctan⁡x.\arctan x\mathclose{\text{.}} A general theorem covers every power series at an endpoint where it converges.

Theorem 15.4Abel’s theorem

Suppose that ∑cn(x−a)n\sum c_n (x - a)^n has radius of convergence R,R\mathclose{\text{,}} with 0<R<∞,0 < R < \infty\mathclose{\text{,}} and that it converges at the endpoint x=a+R.x = a + R\mathclose{\text{.}} Then its sum there is the limit of its sums inside the interval:

∑n=0∞cnRn=lim⁡x→(a+R)− ∑n=0∞cn(x−a)n.\sum_{n=0}^\infty c_n R^n = \lim_{x\to (a + R)^-}\, \sum_{n=0}^\infty c_n (x - a)^n.

The same holds at x=a−R,x = a - R\mathclose{\text{,}} with the limit from the right.

This course does not prove Abel’s theorem; books on real analysis do. Its use is this. Suppose f(x)f(x) equals the sum of its series inside the interval, ff is continuous at an endpoint, and the series converges there. Then the series equals ff at that endpoint too, because both are the limit of f(x)f(x) as xx approaches the endpoint from inside. So, with no new work, ln⁡(1+x)=x−x22+⋯\ln(1 + x) = x - \tfrac{x^2}{2} + \cdots on (−1,1],(-1, 1]\mathclose{\text{,}} and arctan⁡x=x−x33+⋯\arctan x = x - \tfrac{x^3}{3} + \cdots on [−1,1];[-1, 1]\mathclose{\text{;}} at x=−1x = -1 the series of arctan⁡\arctan is −(1−13+15−⋯),-\big(1 - \tfrac13 + \tfrac15 - \cdots\big)\mathclose{\text{,}} which converges by the alternating series test.

Watch out

The interval of convergence of a series for ff is not the domain of f.f\mathclose{\text{.}} ln⁡(1+x)\ln(1 + x) is defined for every x>−1,x > -1\mathclose{\text{,}} but its series converges only on (−1,1]:(-1, 1]\mathclose{\text{:}} at x=2x = 2 its terms ±2n/n\pm 2^n/n grow without bound, although ln⁡3\ln 3 exists. Outside its interval of convergence a series tells you nothing about the function.

4

Taylor series

So far every series has come from the geometric series. Most functions have nothing to do with it: ex,e^x\mathclose{\text{,}} for instance. Does exe^x have a power series, and how would you find it? If a function has a power series, its derivatives fix the coefficients. Take f(x)=∑cn(x−a)n,f(x) = \sum c_n(x - a)^n\mathclose{\text{,}} with radius R>0,R > 0\mathclose{\text{,}} and differentiate term by term, again and again (Theorem 15.2):

f(x)=c0+c1(x−a)+c2(x−a)2+c3(x−a)3+⋯f′(x)=c1+2c2(x−a)+3c3(x−a)2+⋯f′′(x)=2c2+3⋅2 c3(x−a)+⋯f′′′(x)=3⋅2⋅1 c3+⋯\begin{aligned} f(x) &= c_0 + c_1(x - a) + c_2(x - a)^2 \\ &\qquad + c_3(x - a)^3 + \cdots \\ f'(x) &= c_1 + 2c_2(x - a) \\ &\qquad + 3c_3(x - a)^2 + \cdots \\ f''(x) &= 2c_2 + 3\cdot2\,c_3(x - a) + \cdots \\ f'''(x) &= 3\cdot2\cdot1\,c_3 + \cdots \end{aligned}

At x=ax = a every term that contains x−ax - a is 0, so f(a)=c0,f(a) = c_0\mathclose{\text{,}} f′(a)=c1,f'(a) = c_1\mathclose{\text{,}} f′′(a)=2c2f''(a) = 2c_2 and f′′′(a)=3! c3.f'''(a) = 3!\,c_3\mathclose{\text{.}}

Theorem 15.5The coefficients of a power series

If f(x)=∑cn(x−a)nf(x) = \sum c_n(x - a)^n for ∣x−a∣<R,\abs{x - a} < R\mathclose{\text{,}} with R>0,R > 0\mathclose{\text{,}} then for every n≥0n \ge 0

cn=f(n)(a)n!.c_n = \frac{f^{(n)}(a)}{n!}.

In particular, ff has only one power series centred at a.a\mathclose{\text{.}}

Proof

By Theorem 15.2, applied nn times, for ∣x−a∣<R\abs{x - a} < R

f(n)(x)=∑k=n∞k(k−1)⋯(k−n+1)×ck(x−a)k−n.\begin{aligned} f^{(n)}(x) &= \sum_{k=n}^\infty k(k - 1)\cdots(k - n + 1) \\ &\qquad\times c_k (x - a)^{k-n}. \end{aligned}

At x=ax = a every term with k>nk > n is 0, and the term with k=nk = n is n(n−1)⋯1⋅cn=n! cn.n(n - 1)\cdots1\cdot c_n = n!\,c_n\mathclose{\text{.}} Since the coefficients are fixed by f,f\mathclose{\text{,}} two power series for ff about aa have the same coefficients: they are the same series.

∎

Here f(0)f^{(0)} means ff itself and 0!=1,0! = 1\mathclose{\text{,}} so the formula gives c0=f(a)c_0 = f(a) too. Uniqueness is useful in practice: however you find a power series for ff about aa (by substitution, by integration, from derivatives), you get the same series.

Definition 15.3Taylor series and Taylor polynomials

Let ff have derivatives of every order at a.a\mathclose{\text{.}} The Taylor series of ff about aa (or centred at a)a\mathclose{\text{)}} is

∑n=0∞f(n)(a)n!(x−a)n=f(a)+f′(a)(x−a)+f′′(a)2!(x−a)2+⋯ .\begin{aligned} &\sum_{n=0}^\infty \frac{f^{(n)}(a)}{n!}(x - a)^n \\ &\quad= f(a) + f'(a)(x - a) \\ &\qquad + \frac{f''(a)}{2!}(x - a)^2 + \cdots. \end{aligned}

Its partial sum

Tn(x)=∑k=0nf(k)(a)k!(x−a)kT_n(x) = \sum_{k=0}^{n} \frac{f^{(k)}(a)}{k!}(x - a)^k

is the Taylor polynomial of degree nn of ff about a.a\mathclose{\text{.}} When a=0a = 0 they are called the Maclaurin series and the Maclaurin polynomials of f.f\mathclose{\text{.}}

Tn(x)T_n(x) reads “T n of x”. T1(x)=f(a)+f′(a)(x−a)T_1(x) = f(a) + f'(a)(x - a) is the linearisation of Section 7.2, and TnT_n is said to have degree nn even when its last coefficient happens to be 0. Theorem 15.5 says that if ff has a power series about a,a\mathclose{\text{,}} it is the Taylor series. It does not say that the Taylor series converges, or that its sum is f:f\mathclose{\text{:}} Section 15.5 settles both questions.

The standard series

Example 15.7The series of exe^x✓ Checked

Find the Maclaurin series of exe^x and its radius of convergence.

Every derivative of exe^x is exe^x (Module 6), so f(n)(0)=e0=1f^{(n)}(0) = e^0 = 1 for every n,n\mathclose{\text{,}} and the Maclaurin series is

∑n=0∞xnn!=1+x+x22!+x33!+⋯ .\sum_{n=0}^\infty \frac{x^n}{n!} = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots.

By Example 15.2 it converges for every x:x\mathclose{\text{:}} R=∞.R = \infty\mathclose{\text{.}} Its Taylor polynomials T1(x)=1+xT_1(x) = 1 + x and T2(x)=1+x+12x2T_2(x) = 1 + x + \tfrac12 x^2 are the approximations of Example 7.13 (Section 7.5), where L’Hôpital’s rule showed that ex−1−x≈12x2e^x - 1 - x \approx \tfrac12 x^2 near 0. Section 15.5 proves that the series equals exe^x for every x.x\mathclose{\text{.}} At x=1x = 1 it gives e=1+1+12!+13!+⋯,e = 1 + 1 + \tfrac{1}{2!} + \tfrac{1}{3!} + \cdots\mathclose{\text{,}} and at x=−1x = -1 it gives 1/e=1−1+12!−13!+⋯≈0.367879,1/e = 1 - 1 + \tfrac{1}{2!} - \tfrac{1}{3!} + \cdots \approx 0.367879\mathclose{\text{,}} the sum estimated in Example 14.14.

Example 15.8The series of sin⁡x\sin x and cos⁡x\cos x✓ Checked

Find the Maclaurin series of sin⁡x\sin x and of cos⁡x,\cos x\mathclose{\text{,}} and their radii of convergence.

The derivatives of sin⁡x\sin x are cos⁡x,\cos x\mathclose{\text{,}} −sin⁡x,-\sin x\mathclose{\text{,}} −cos⁡x,-\cos x\mathclose{\text{,}} sin⁡x,\sin x\mathclose{\text{,}} and then the cycle of four repeats. At 0 the values of sin⁡x\sin x and its derivatives are 0,1,0,−1,0,1,0,−1,….0, 1, 0, -1, 0, 1, 0, -1, \dots\mathclose{\text{.}} So only odd powers appear, with alternating signs:

sin⁡x=x−x33!+x55!−⋯=∑n=0∞(−1)nx2n+1(2n+1)!.\begin{aligned} \sin x &= x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots \\ &= \sum_{n=0}^\infty (-1)^n \frac{x^{2n+1}}{(2n + 1)!}. \end{aligned}

For cos⁡x\cos x the values at 0 are 1,0,−1,0,1,…,1, 0, -1, 0, 1, \dots\mathclose{\text{,}} and only even powers appear:

cos⁡x=1−x22!+x44!−⋯=∑n=0∞(−1)nx2n(2n)!.\begin{aligned} \cos x &= 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \cdots \\ &= \sum_{n=0}^\infty (-1)^n \frac{x^{2n}}{(2n)!}. \end{aligned}

(The equals signs anticipate Section 15.5, which proves them; so far these are the Maclaurin series.) For the sine series, the ratio of two consecutive nonzero terms is

∣x2n+3/(2n+3)!x2n+1/(2n+1)!∣=x2(2n+2)(2n+3)→0,\begin{aligned} &\abs{\frac{x^{2n+3}/(2n + 3)!}{x^{2n+1}/(2n + 1)!}} \\ &\quad= \frac{x^2}{(2n + 2)(2n + 3)} \to 0, \end{aligned}

so it converges for every x,x\mathclose{\text{,}} and the cosine series likewise: R=∞R = \infty for both. Each series is the term-by-term derivative of the other, up to a sign, as (sin⁡x)′=cos⁡x(\sin x)' = \cos x and (cos⁡x)′=−sin⁡x(\cos x)' = -\sin x require. And the odd function sin⁡\sin has only odd powers, the even function cos⁡\cos only even ones.

Example 15.9A Taylor polynomial about 4✓ Checked

Find the Taylor polynomial T3T_3 of x\sqrt x about 4, and use T1,T_1\mathclose{\text{,}} T2T_2 and T3T_3 to estimate 4.1.\sqrt{4.1}\mathclose{\text{.}}

The derivatives of f(x)=x1/2f(x) = x^{1/2} come from the power rule:

f′(x)=12x−1/2,f′′(x)=−14x−3/2,f′′′(x)=38x−5/2.\begin{aligned} f'(x) &= \tfrac12 x^{-1/2}, & f''(x) &= -\tfrac14 x^{-3/2}, \\ f'''(x) &= \tfrac38 x^{-5/2}. & & \end{aligned}

At 4, since 41/2=2,4^{1/2} = 2\mathclose{\text{,}} 43/2=84^{3/2} = 8 and 45/2=32,4^{5/2} = 32\mathclose{\text{,}} the values are f(4)=2,f(4) = 2\mathclose{\text{,}} f′(4)=14,f'(4) = \tfrac14\mathclose{\text{,}} f′′(4)=−132f''(4) = -\tfrac{1}{32} and f′′′(4)=3256.f'''(4) = \tfrac{3}{256}\mathclose{\text{.}} Divide by 0!,0!\mathclose{\text{,}} 1!,1!\mathclose{\text{,}} 2!2! and 3!:3!\mathclose{\text{:}}

T3(x)=2+x−44−(x−4)264+(x−4)3512,\begin{aligned} T_3(x) = 2 &+ \frac{x - 4}{4} - \frac{(x - 4)^2}{64} \\ &+ \frac{(x - 4)^3}{512}, \end{aligned}

and T1T_1 and T2T_2 are its first two and three terms. At x=4.1,x = 4.1\mathclose{\text{,}} where x−4=0.1,x - 4 = 0.1\mathclose{\text{,}}

T1(4.1)=2.025,T2(4.1)=2.025−0.00015625=2.02484375,T3(4.1)=T2(4.1)+0.000001953125≈2.0248457.\begin{aligned} T_1(4.1) &= 2.025, \\ T_2(4.1) &= 2.025 - 0.00015625 \\ &= 2.02484375, \\ T_3(4.1) &= T_2(4.1) + 0.000001953125 \\ &\approx 2.0248457. \end{aligned}

A calculator gives 4.1≈2.02484567:\sqrt{4.1} \approx 2.02484567\mathclose{\text{:}} the errors are about −1.5×10−4,-1.5 \times 10^{-4}\mathclose{\text{,}} 1.9×10−61.9 \times 10^{-6} and −3.0×10−8.-3.0 \times 10^{-8}\mathclose{\text{.}} Each new term gains about two correct digits here. T1T_1 is the linearisation of Example 7.5.

The binomial series. For any real number kk and x>−1,x > -1\mathclose{\text{,}} the derivatives of f(x)=(1+x)kf(x) = (1 + x)^k follow from the power rule of Module 6:

f′(x)=k(1+x)k−1,f′′(x)=k(k−1)(1+x)k−2,\begin{aligned} f'(x) &= k(1 + x)^{k-1}, \\ f''(x) &= k(k - 1)(1 + x)^{k-2}, \end{aligned}

and in general f(n)(x)=k(k−1)⋯(k−n+1)(1+x)k−n.f^{(n)}(x) = k(k - 1)\cdots(k - n + 1)(1 + x)^{k-n}\mathclose{\text{.}} At 0, f(n)(0)=k(k−1)⋯(k−n+1),f^{(n)}(0) = k(k - 1)\cdots(k - n + 1)\mathclose{\text{,}} so the Maclaurin coefficients are the binomial coefficients

(kn)=k(k−1)⋯(k−n+1)n!,(k0)=1,\begin{aligned} \binom{k}{n} &= \frac{k(k - 1)\cdots(k - n + 1)}{n!}, \\ \binom{k}{0} &= 1, \end{aligned}

read “k choose n”. The Maclaurin series of (1+x)k(1 + x)^k is the binomial series

∑n=0∞(kn)xn=1+kx+k(k−1)2!x2+k(k−1)(k−2)3!x3+⋯ .\begin{aligned} \sum_{n=0}^\infty \binom{k}{n}x^n &= 1 + kx + \frac{k(k - 1)}{2!}x^2 \\ &\quad + \frac{k(k - 1)(k - 2)}{3!}x^3 + \cdots. \end{aligned}

When kk is a whole number, k≥0,k \ge 0\mathclose{\text{,}} every coefficient with n>kn > k contains the factor k−k=0,k - k = 0\mathclose{\text{,}} so the series stops: it is the binomial theorem of algebra, as in (1+x)3=1+3x+3x2+x3.(1 + x)^3 = 1 + 3x + 3x^2 + x^3\mathclose{\text{.}} For every other kk no coefficient is 0, and the ratio test gives

∣(kn+1)xn+1(kn)xn∣=∣k−n∣n+1 ∣x∣→∣x∣,\abs{\frac{\binom{k}{n+1}x^{n+1}}{\binom{k}{n}x^n}} = \frac{\abs{k - n}}{n + 1}\,\abs{x} \to \abs{x},

so the radius of convergence is 1.

Theorem 15.6The binomial series

For every real number kk and every xx with ∣x∣<1,\abs{x} < 1\mathclose{\text{,}}

(1+x)k=∑n=0∞(kn)xn.(1 + x)^k = \sum_{n=0}^\infty \binom{k}{n}x^n.
Proof

Let g(x)g(x) be the sum of the series for ∣x∣<1.\abs{x} < 1\mathclose{\text{.}} By Theorem 15.2, renaming n−1n - 1 as n,n\mathclose{\text{,}}

g′(x)=∑n=1∞n(kn)xn−1=∑n=0∞(n+1)(kn+1)xn.\begin{aligned} g'(x) &= \sum_{n=1}^\infty n\binom{k}{n}x^{n-1} \\ &= \sum_{n=0}^\infty (n + 1)\binom{k}{n+1}x^n. \end{aligned}

From the definition, (kn+1)=(kn)k−nn+1,\binom{k}{n+1} = \binom{k}{n}\dfrac{k - n}{n + 1}\mathclose{\text{,}} so (n+1)(kn+1)=(k−n)(kn).(n + 1)\binom{k}{n+1} = (k - n)\binom{k}{n}\mathclose{\text{.}} Also x g′(x)=∑n(kn)xnx\,g'(x) = \sum n\binom{k}{n}x^n (the term with n=0n = 0 is 0). Adding,

(1+x) g′(x)=∑n=0∞[(k−n)+n](kn)xn=k g(x).\begin{aligned} &(1 + x)\,g'(x) \\ &\quad= \sum_{n=0}^\infty \big[(k - n) + n\big]\binom{k}{n}x^n \\ &\quad= k\,g(x). \end{aligned}

Now let h(x)=g(x)(1+x)−k.h(x) = g(x)(1 + x)^{-k}\mathclose{\text{.}} By the product rule,

h′(x)=g′(x)(1+x)k−k g(x)(1+x)k+1=(1+x)g′(x)−k g(x)(1+x)k+1=0\begin{aligned} h'(x) &= \frac{g'(x)}{(1 + x)^k} - \frac{k\,g(x)}{(1 + x)^{k+1}} \\ &= \frac{(1 + x)g'(x) - k\,g(x)}{(1 + x)^{k+1}} = 0 \end{aligned}

for ∣x∣<1.\abs{x} < 1\mathclose{\text{.}} A function whose derivative is 0 on an interval is constant (Module 8), so h(x)=h(0)=g(0)=1,h(x) = h(0) = g(0) = 1\mathclose{\text{,}} that is, g(x)=(1+x)k.g(x) = (1 + x)^k\mathclose{\text{.}}

∎

Whether the binomial series converges at x=±1x = \pm1 depends on k:k\mathclose{\text{:}} for k=12k = \tfrac12 it converges at both ends, and for k=−1,k = -1\mathclose{\text{,}} where it is the geometric series of 1/(1+x),1/(1 + x)\mathclose{\text{,}} at neither.

Example 15.10Two binomial series✓ Checked

Find the first four terms of the binomial series of (a) 1+x\sqrt{1 + x} and (b) 11−x.\dfrac{1}{\sqrt{1 - x}}\mathclose{\text{.}}

(a) Here k=12:k = \tfrac12\mathclose{\text{:}}

(1/21)=12,(1/22)=12⋅(−12)2=−18,(1/23)=12⋅(−12)⋅(−32)6=116,\begin{aligned} \binom{1/2}{1} &= \frac12, \\ \binom{1/2}{2} &= \frac{\tfrac12\cdot\big(-\tfrac12\big)}{2} = -\frac18, \\ \binom{1/2}{3} &= \frac{\tfrac12\cdot\big(-\tfrac12\big)\cdot\big(-\tfrac32\big)}{6} = \frac{1}{16}, \end{aligned}

so for ∣x∣<1\abs{x} < 1

1+x=1+x2−x28+x316−⋯ .\sqrt{1 + x} = 1 + \frac{x}{2} - \frac{x^2}{8} + \frac{x^3}{16} - \cdots.

(b) Now k=−12,k = -\tfrac12\mathclose{\text{,}} with −x-x in place of x.x\mathclose{\text{.}} The coefficients are (−1/21)=−12,\binom{-1/2}{1} = -\tfrac12\mathclose{\text{,}} (−1/22)=(−1/2)(−3/2)2=38\binom{-1/2}{2} = \tfrac{(-1/2)(-3/2)}{2} = \tfrac38 and (−1/23)=(−1/2)(−3/2)(−5/2)6=−516,\binom{-1/2}{3} = \tfrac{(-1/2)(-3/2)(-5/2)}{6} = -\tfrac{5}{16}\mathclose{\text{,}} and multiplying by (−x)n(-x)^n makes every sign positive:

11−x=1+x2+3x28+5x316+⋯ ,\frac{1}{\sqrt{1 - x}} = 1 + \frac{x}{2} + \frac{3x^2}{8} + \frac{5x^3}{16} + \cdots,

for ∣x∣<1.\abs{x} < 1\mathclose{\text{.}}

The first two terms of (a) are the linearisation 1+x≈1+12x;\sqrt{1 + x} \approx 1 + \tfrac12 x\mathclose{\text{;}} the third term shows that it is slightly too large, by about 18x2.\tfrac18 x^2\mathclose{\text{.}} Series (b) returns in Section 15.6, in Einstein’s formula for kinetic energy.

The series of this section and the last make a short list worth knowing by heart:

Function Maclaurin series Equals the function for
11−x\dfrac{1}{1 - x} ∑n=0∞xn=1+x+x2+⋯\displaystyle\sum_{n=0}^\infty x^n = 1 + x + x^2 + \cdots −1<x<1-1 < x < 1
ln⁡(1+x)\ln(1 + x) ∑n=1∞(−1)n−1xnn=x−x22+x33−⋯\displaystyle\sum_{n=1}^\infty (-1)^{n-1}\frac{x^n}{n} = x - \frac{x^2}{2} + \frac{x^3}{3} - \cdots −1<x≤1-1 < x \le 1
arctan⁡x\arctan x ∑n=0∞(−1)nx2n+12n+1=x−x33+x55−⋯\displaystyle\sum_{n=0}^\infty (-1)^n\frac{x^{2n+1}}{2n + 1} = x - \frac{x^3}{3} + \frac{x^5}{5} - \cdots −1≤x≤1-1 \le x \le 1
exe^x ∑n=0∞xnn!=1+x+x22!+⋯\displaystyle\sum_{n=0}^\infty \frac{x^n}{n!} = 1 + x + \frac{x^2}{2!} + \cdots every xx
sin⁡x\sin x ∑n=0∞(−1)nx2n+1(2n+1)!=x−x33!+⋯\displaystyle\sum_{n=0}^\infty (-1)^n\frac{x^{2n+1}}{(2n + 1)!} = x - \frac{x^3}{3!} + \cdots every xx
cos⁡x\cos x ∑n=0∞(−1)nx2n(2n)!=1−x22!+⋯\displaystyle\sum_{n=0}^\infty (-1)^n\frac{x^{2n}}{(2n)!} = 1 - \frac{x^2}{2!} + \cdots every xx
(1+x)k(1 + x)^k ∑n=0∞(kn)xn=1+kx+⋯\displaystyle\sum_{n=0}^\infty \binom{k}{n}x^n = 1 + kx + \cdots −1<x<1,-1 < x < 1\mathclose{\text{,}} and for some kk also at ±1\pm1

When kk is a nonnegative integer, the binomial series stops and equals (1+x)k(1 + x)^k for every real x,x\mathclose{\text{,}} not only inside (−1,1).(-1, 1)\mathclose{\text{.}} For every other k,k\mathclose{\text{,}} the radius is 1 and the endpoints need separate tests. The last column for ex,e^x\mathclose{\text{,}} sin⁡x\sin x and cos⁡x\cos x is proved in Section 15.5 (Theorem 15.9).

Key idea

A handful of series generate almost all the others: the geometric series, the series of ex,e^x\mathclose{\text{,}} sin⁡x\sin x and cos⁡x,\cos x\mathclose{\text{,}} and the binomial series. New series come from these by substituting, multiplying by a power of x,x\mathclose{\text{,}} differentiating and integrating, which is usually far quicker than computing derivatives, and by uniqueness (Theorem 15.5) the result is the Taylor series.

Watch out

A Taylor series needs every derivative at its centre. x\sqrt x has no Maclaurin series, because x\sqrt x has no derivative at 0, and ln⁡x\ln x has none either, because it is not defined at 0. Use another centre (x\sqrt x about 4, ln⁡x\ln x about 1), or shift the function (1+x,\sqrt{1 + x}\mathclose{\text{,}} ln⁡(1+x)).\ln(1 + x)\mathclose{\text{).}}

Series give numerical values for integrals whose antiderivatives are not elementary, such as those of e−x2e^{-x^2} from Module 11.

Example 15.11An integral with no elementary antiderivative✓ Checked

Find ∫01e−x2 dx\displaystyle\int_0^1 e^{-x^2}\,dx to three decimal places.

Substitute u=−x2u = -x^2 in the series of eu,e^u\mathclose{\text{,}} which converges for every u:u\mathclose{\text{:}}

e−x2=∑n=0∞(−x2)nn!=1−x2+x42!−x63!+⋯ .\begin{aligned} e^{-x^2} &= \sum_{n=0}^\infty \frac{(-x^2)^n}{n!} \\ &= 1 - x^2 + \frac{x^4}{2!} - \frac{x^6}{3!} + \cdots. \end{aligned}

Integrate term by term from 0 to 1 (Theorem 15.2, with R=∞):R = \infty\mathclose{\text{):}}

∫01e−x2 dx=∑n=0∞(−1)n(2n+1) n!=1−13+110−142+1216−11320+19360−⋯ .\begin{aligned} \int_0^1 e^{-x^2}\,dx &= \sum_{n=0}^\infty \frac{(-1)^n}{(2n + 1)\,n!} \\ &= 1 - \frac13 + \frac{1}{10} - \frac{1}{42} + \frac{1}{216} \\ &\qquad - \frac{1}{1320} + \frac{1}{9360} - \cdots. \end{aligned}

The terms alternate in sign and decrease in size to 0, so the alternating series bound applies: the sum of the first six terms, 0.7467290.746729 to six places, differs from the integral by less than the seventh term, 1/9360<0.00011.1/9360 < 0.00011\mathclose{\text{.}} So the integral lies between 0.74672 and 0.74684, and to three decimal places it is 0.747. Up to scaling, e−x2e^{-x^2} is the bell curve of the normal distribution (Module 12), so integrals like this one give the probabilities of that distribution, which have no formula in elementary functions.

Compute itTaylor series with SymPy

SymPy’s series computes Taylor series. Its arguments are the expression, the variable, the centre and the order of the first term left out:

Python
import sympy as sp
x = sp.symbols('x')
print(sp.series(sp.exp(x), x, 0, 6))
print(sp.series(sp.sin(x), x, 0, 8).removeO())
print(sp.series(sp.sqrt(x), x, 4, 3))
Output
1 + x + x**2/2 + x**3/6 + x**4/24 + x**5/120 + O(x**6)
-x**7/5040 + x**5/120 - x**3/6 + x
1 - (x - 4)**2/64 + x/4 + O((x - 4)**3, (x, 4))

O(x**6), read “big O of x to the 6”, stands for the terms of degree 6 and higher that were left out, as in the big-O notation of Module 4. .removeO() drops it and leaves a Taylor polynomial, here T7T_7 of sin⁡x,\sin x\mathclose{\text{,}} which SymPy prints with the highest power first. The third line is T2T_2 of x\sqrt x about 4, from Example 15.9, with the polynomial rearranged: 2+x−442 + \tfrac{x - 4}{4} is 1+x4.1 + \tfrac{x}{4}\mathclose{\text{.}} SymPy also handles a symbolic exponent, and functions whose coefficients you would not want to compute by hand:

Python
k = sp.symbols('k')
print(sp.series((1 + x)**k, x, 0, 4))
print(sp.series(sp.tan(x), x, 0, 10))
Output
1 + k*x + k*x**2*(k - 1)/2 + k*x**3*(k - 2)*(k - 1)/6 + O(x**4)
x + x**3/3 + 2*x**5/15 + 17*x**7/315 + 62*x**9/2835 + O(x**10)

The first line is the binomial series. The coefficients of tan⁡x\tan x follow no simple pattern, and its series converges only for ∣x∣<π/2.\abs{x} < \pi/2\mathclose{\text{.}} Mind the order of the arguments: the third is the centre, not the number of terms.

Python
print(sp.series(x**3, x, 4))
Output
48*x + (x - 4)**3 + 12*(x - 4)**2 - 128

With no fourth argument, SymPy expands about the centre 4 (with its default order 6). A polynomial is its own Taylor series, so the answer is x3x^3 rewritten in powers of x−4,x - 4\mathclose{\text{,}} 64+48(x−4)+12(x−4)2+(x−4)3,64 + 48(x - 4) + 12(x - 4)^2 + (x - 4)^3\mathclose{\text{,}} with 64+48(x−4)64 + 48(x - 4) merged into 48x−128;48x - 128\mathclose{\text{;}} there is no OO term, because nothing was left out.

Taylor polynomials

In practice nobody sums a whole series: you stop at some Tn.T_n\mathclose{\text{.}} Figure 15.2 shows how the Maclaurin polynomials of sin⁡x,\sin x\mathclose{\text{,}}

T1(x)=x,T3(x)=x−x36,T5(x)=x−x36+x5120,\begin{aligned} T_1(x) &= x, \\ T_3(x) &= x - \frac{x^3}{6}, \\ T_5(x) &= x - \frac{x^3}{6} + \frac{x^5}{120}, \end{aligned}

approximate it. (Since every even coefficient is 0, T2=T1T_2 = T_1 and T4=T3.)T_4 = T_3\mathclose{\text{.)}} Each hugs the curve around 0, and the higher the degree, the wider the stretch on which it does.

Left: sin x (blue) and its Maclaurin polynomials T1, T3 and T5. Each hugs the curve near 0, over a wider stretch as the degree grows, and then turns away. Right: the errors abs{sin x - Tn(x)} for 0.01 le x le 2, on logarithmic scales. They lie close to straight lines of slopes 3, 5 and 7: halving x divides the error of Tn by about 2^{n+2}.
Figure 15.2

Left: sin⁡x\sin x (blue) and its Maclaurin polynomials T1,T_1\mathclose{\text{,}} T3T_3 and T5.T_5\mathclose{\text{.}} Each hugs the curve near 0, over a wider stretch as the degree grows, and then turns away. Right: the errors ∣sin⁡x−Tn(x)∣\abs{\sin x - T_n(x)} for 0.01≤x≤2,0.01 \le x \le 2\mathclose{\text{,}} on logarithmic scales. They lie close to straight lines of slopes 3, 5 and 7: halving xx divides the error of TnT_n by about 2n+2.2^{n+2}\mathclose{\text{.}}

xxsin⁡x\sin xT1(x)T_1(x)T3(x)T_3(x)T5(x)T_5(x)
0.10.10.09983340.09983340.10.10.09983330.09983330.09983340.0998334
0.50.50.4794260.4794260.50.50.4791670.4791670.4794270.479427
110.8414710.841471110.8333330.8333330.8416670.841667
220.9092970.909297220.6666670.6666670.9333330.933333
330.1411200.14112033−1.5-1.50.5250.525

At x=0.1,x = 0.1\mathclose{\text{,}} T5T_5 agrees with sin⁡x\sin x in all six digits shown, and T3T_3 in five. Farther from 0 more terms are needed: at x=2,x = 2\mathclose{\text{,}} T5T_5 is off by 0.024, and at x=3x = 3 by 0.38, while T1T_1 is off by almost 3.

Why do Taylor polynomials fit so well? Because TnT_n has the same value and the same first nn derivatives at aa as f:f\mathclose{\text{:}} differentiating TnT_n kk times and putting x=ax = a leaves k!k! times its kkth coefficient, which is f(k)(a),f^{(k)}(a)\mathclose{\text{,}} for every k≤n.k \le n\mathclose{\text{.}} T1T_1 matches the value and the slope, so it is the tangent line; T2T_2 matches the second derivative too, which decides how the graph bends (Module 8); and so on. No other polynomial of degree at most nn does this, because the derivatives of a polynomial at aa fix its coefficients (Theorem 15.5 holds for polynomials, whose series stop).

Try it

Choose a function, then raise the degree nn from 0 and watch TnT_n (orange) approximate ff (blue) around the centre a.a\mathclose{\text{.}} The readout compares Tn(x0)T_n(x_0) with f(x0)f(x_0) at the probe point x0.x_0\mathclose{\text{.}} For ex,e^x\mathclose{\text{,}} sin⁡x\sin x and cos⁡x\cos x the error at any x0x_0 tends to 0 as nn grows; move the centre too. For the other four functions, the green band marks the radius of convergence: outside it, increasing the degree does not make the error tend to 0. Try ln⁡(1+x)\ln(1 + x) about 0 with x0=1.5:x_0 = 1.5\mathclose{\text{:}} the error magnitude first decreases, then grows. Move the centre of arctan⁡x\arctan x away from 0 and note the radius 1+a2;\sqrt{1 + a^2}\mathclose{\text{;}} Section 15.7 explains it.

5

Taylor’s theorem

A Taylor polynomial is useful only when you know how far it is from the function. The difference

Rn(x)=f(x)−Tn(x)R_n(x) = f(x) - T_n(x)

is the remainder of degree nn (Rn(x)R_n(x) reads “R n of x”). Since Tn(x)T_n(x) is a partial sum of the Taylor series, f(x)f(x) equals the sum of its Taylor series exactly when Rn(x)→0R_n(x) \to 0 as n→∞.n \to \infty\mathclose{\text{.}} Taylor’s theorem gives a formula for the remainder.

Theorem 15.7Taylor’s theorem

Let n≥0n \ge 0 be a whole number, and let ff have derivatives up to order n+1n + 1 on an open interval II that contains a.a\mathclose{\text{.}} Then for every xx in I,I\mathclose{\text{,}}

f(x)=Tn(x)+Rn(x),Rn(x)=f(n+1)(c)(n+1)!(x−a)n+1,\begin{aligned} f(x) &= T_n(x) + R_n(x), \\ R_n(x) &= \frac{f^{(n+1)}(c)}{(n + 1)!}(x - a)^{n+1}, \end{aligned}

for some number cc between aa and xx (with c=ac = a if x=a).x = a\mathclose{\text{).}}

This form of RnR_n is the Lagrange form of the remainder. For n=0n = 0 the theorem says f(x)=f(a)+f′(c)(x−a),f(x) = f(a) + f'(c)(x - a)\mathclose{\text{,}} the Mean Value Theorem: Taylor’s theorem is the Mean Value Theorem with more terms. The remainder looks like the next term of the Taylor series, f(n+1)(a)(n+1)!(x−a)n+1,\dfrac{f^{(n+1)}(a)}{(n + 1)!}(x - a)^{n+1}\mathclose{\text{,}} except that the derivative is taken at an unknown point cc instead of at a.a\mathclose{\text{.}}

Proof

If x=a,x = a\mathclose{\text{,}} both sides equal f(a).f(a)\mathclose{\text{.}} So let x≠a,x \ne a\mathclose{\text{,}} and let KK be the number for which

f(x)=Tn(x)+K(n+1)!(x−a)n+1;f(x) = T_n(x) + \frac{K}{(n + 1)!}(x - a)^{n+1};

it exists because (x−a)n+1≠0.(x - a)^{n+1} \ne 0\mathclose{\text{.}} The task is to show that K=f(n+1)(c)K = f^{(n+1)}(c) for some cc between aa and x.x\mathclose{\text{.}} Keep xx fixed, and define, for tt in the closed interval between aa and x,x\mathclose{\text{,}}

g(t)=f(x)−∑k=0nf(k)(t)k!(x−t)k−K(n+1)!(x−t)n+1.\begin{aligned} g(t) &= f(x) - \sum_{k=0}^{n} \frac{f^{(k)}(t)}{k!}(x - t)^k \\ &\qquad - \frac{K}{(n + 1)!}(x - t)^{n+1}. \end{aligned}

At t=xt = x every term of the sum with k≥1k \ge 1 is 0, and the term with k=0k = 0 is f(x),f(x)\mathclose{\text{,}} so g(x)=0;g(x) = 0\mathclose{\text{;}} and g(a)=0g(a) = 0 by the choice of K.K\mathclose{\text{.}} Now differentiate with respect to t.t\mathclose{\text{.}} The term with k=0,k = 0\mathclose{\text{,}} f(t),f(t)\mathclose{\text{,}} has derivative f′(t),f'(t)\mathclose{\text{,}} and by the product rule the term with k≥1k \ge 1 has derivative

f(k+1)(t)k!(x−t)k−f(k)(t)(k−1)!(x−t)k−1.\frac{f^{(k+1)}(t)}{k!}(x - t)^k - \frac{f^{(k)}(t)}{(k - 1)!}(x - t)^{k-1}.

Added up, the second part of each of these cancels the first part of the one before: the sum telescopes, and only f(n+1)(t)n!(x−t)n\dfrac{f^{(n+1)}(t)}{n!}(x - t)^n survives. So

g′(t)=−f(n+1)(t)n!(x−t)n+Kn!(x−t)n=(x−t)nn!(K−f(n+1)(t)).\begin{aligned} g'(t) &= -\frac{f^{(n+1)}(t)}{n!}(x - t)^n \\ &\qquad + \frac{K}{n!}(x - t)^n \\ &= \frac{(x - t)^n}{n!}\big(K - f^{(n+1)}(t)\big). \end{aligned}

The function gg is differentiable, and g(a)=g(x)=0,g(a) = g(x) = 0\mathclose{\text{,}} so by Rolle’s theorem (Module 8) g′(c)=0g'(c) = 0 for some cc strictly between aa and x.x\mathclose{\text{.}} There (x−c)n≠0,(x - c)^n \ne 0\mathclose{\text{,}} so K=f(n+1)(c).K = f^{(n+1)}(c)\mathclose{\text{.}}

∎

For example, for exe^x with a=0,a = 0\mathclose{\text{,}} n=3n = 3 and x=1,x = 1\mathclose{\text{,}} R3(1)=e−83≈0.0516,R_3(1) = e - \tfrac83 \approx 0.0516\mathclose{\text{,}} and the theorem promises a cc between 0 and 1 with ec/4!=R3(1):e^c/4! = R_3(1)\mathclose{\text{:}} it is c=ln⁡(24(e−83))≈0.214.c = \ln\big(24(e - \tfrac83)\big) \approx 0.214\mathclose{\text{.}} In practice cc is unknown, and a bound is all you need.

Key idea

Taylor’s inequality. If ∣f(n+1)(t)∣≤M\abs{f^{(n+1)}(t)} \le M for every tt between aa and x,x\mathclose{\text{,}} then

∣f(x)−Tn(x)∣≤M(n+1)! ∣x−a∣n+1.\abs{f(x) - T_n(x)} \le \frac{M}{(n + 1)!}\,\abs{x - a}^{n+1}.

Taylor’s theorem also says how good TnT_n is near a.a\mathclose{\text{.}} Suppose f(n+1)f^{(n+1)} is continuous on I.I\mathclose{\text{.}} On a closed interval around aa inside II it is bounded, say by MM (the Extreme Value Theorem of Module 3), and for x≠ax \ne a in that interval

∣f(x)−Tn(x)(x−a)n∣≤M(n+1)! ∣x−a∣,\abs{\frac{f(x) - T_n(x)}{(x - a)^n}} \le \frac{M}{(n + 1)!}\,\abs{x - a},

which tends to 0 as x→a.x \to a\mathclose{\text{.}} So the error of TnT_n is small even compared with (x−a)n;(x - a)^n\mathclose{\text{;}} for n=1n = 1 this is Theorem 7.1. In this sense TnT_n is the best polynomial approximation of degree nn near a.a\mathclose{\text{.}} No other polynomial pp of degree at most nn does as well: if (f(x)−p(x))/(x−a)n\big(f(x) - p(x)\big)/(x - a)^n also tended to 0, then so would q(x)/(x−a)n,q(x)/(x - a)^n\mathclose{\text{,}} where q=Tn−p.q = T_n - p\mathclose{\text{.}} Write q(x)=d0+d1(x−a)+⋯+dn(x−a)n.q(x) = d_0 + d_1(x - a) + \cdots + d_n(x - a)^n\mathclose{\text{.}} Then q(x),q(x)\mathclose{\text{,}} q(x)/(x−a),q(x)/(x - a)\mathclose{\text{,}} …, q(x)/(x−a)n−1q(x)/(x - a)^{n-1} tend to 0 as well, being q(x)/(x−a)nq(x)/(x - a)^n times a power of x−a.x - a\mathclose{\text{.}} The first limit is d0,d_0\mathclose{\text{,}} so d0=0;d_0 = 0\mathclose{\text{;}} then the second is d1,d_1\mathclose{\text{,}} so d1=0;d_1 = 0\mathclose{\text{;}} and so on up to dn=0.d_n = 0\mathclose{\text{.}} So p=Tn.p = T_n\mathclose{\text{.}}

Error bounds

Example 15.12Two error bounds✓ Checked

(a) Bound the error of T5(0.5)T_5(0.5) as an estimate of sin⁡0.5.\sin 0.5\mathclose{\text{.}} (b) Bound the error of T2(4.1)T_2(4.1) as an estimate of 4.1\sqrt{4.1} (Example 15.9), and decide whether T2(4.1)T_2(4.1) is too large or too small.

(a) Every derivative of sin⁡\sin is ±sin⁡\pm\sin or ±cos⁡,\pm\cos\mathclose{\text{,}} so M=1M = 1 will do for every n.n\mathclose{\text{.}} With n=5,n = 5\mathclose{\text{,}} Taylor’s inequality gives ∣R5(0.5)∣≤0.56/6!≈2.2×10−5.\abs{R_5(0.5)} \le 0.5^6/6! \approx 2.2 \times 10^{-5}\mathclose{\text{.}} You can do better. The coefficient of x6x^6 in the series of sin⁡x\sin x is 0, so T5=T6,T_5 = T_6\mathclose{\text{,}} and with n=6n = 6

∣sin⁡0.5−T5(0.5)∣=∣R6(0.5)∣≤0.577!=0.00781255040≈1.55×10−6.\begin{aligned} &\abs{\sin 0.5 - T_5(0.5)} = \abs{R_6(0.5)} \\ &\quad\le \frac{0.5^7}{7!} = \frac{0.0078125}{5040} \\ &\quad\approx 1.55 \times 10^{-6}. \end{aligned}

Indeed T5(0.5)=12−148+13840≈0.4794271,T_5(0.5) = \tfrac12 - \tfrac{1}{48} + \tfrac{1}{3840} \approx 0.4794271\mathclose{\text{,}} while sin⁡0.5≈0.4794255:\sin 0.5 \approx 0.4794255\mathclose{\text{:}} the error is about −1.54×10−6,-1.54 \times 10^{-6}\mathclose{\text{,}} whose size is very close to the bound.

(b) Here n=2n = 2 and f′′′(t)=38t−5/2,f'''(t) = \tfrac38 t^{-5/2}\mathclose{\text{,}} which decreases as tt grows, so on [4,4.1][4, 4.1] it is largest at t=4:t = 4\mathclose{\text{:}} M=38⋅4−5/2=3256.M = \tfrac38\cdot 4^{-5/2} = \tfrac{3}{256}\mathclose{\text{.}} So

∣4.1−T2(4.1)∣≤3/2563! (0.1)3=1512 000≈1.95×10−6.\begin{aligned} &\abs{\sqrt{4.1} - T_2(4.1)} \le \frac{3/256}{3!}\,(0.1)^3 \\ &\quad= \frac{1}{512\,000} \approx 1.95 \times 10^{-6}. \end{aligned}

The actual error is about 1.92×10−6.1.92 \times 10^{-6}\mathclose{\text{.}} The Lagrange form also gives the sign: R2(4.1)=f′′′(c)3!(0.1)3R_2(4.1) = \dfrac{f'''(c)}{3!}(0.1)^3 with f′′′(c)>0,f'''(c) > 0\mathclose{\text{,}} so the remainder is positive, and T2(4.1)=2.02484375T_2(4.1) = 2.02484375 is slightly too small.

Example 15.13A polynomial for exe^x on [−1,1][-1, 1]✓ Checked

Find a degree nn for which the Maclaurin polynomial TnT_n of exe^x satisfies ∣ex−Tn(x)∣<10−6\abs{e^x - T_n(x)} < 10^{-6} for every xx in [−1,1].[-1, 1]\mathclose{\text{.}}

Every derivative of exe^x is ex,e^x\mathclose{\text{,}} and for tt between 0 and x,x\mathclose{\text{,}} with ∣x∣≤1,\abs{x} \le 1\mathclose{\text{,}} et≤e1<3.e^t \le e^1 < 3\mathclose{\text{.}} So M=3M = 3 will do, and

∣ex−Tn(x)∣≤3(n+1)!∣x∣n+1≤3(n+1)!.\begin{aligned} \abs{e^x - T_n(x)} &\le \frac{3}{(n + 1)!}\abs{x}^{n+1} \\ &\le \frac{3}{(n + 1)!}. \end{aligned}

This is less than 10−610^{-6} when (n+1)!>3 000 000.(n + 1)! > 3\,000\,000\mathclose{\text{.}} Since 9!=362 8809! = 362\,880 and 10!=3 628 800,10! = 3\,628\,800\mathclose{\text{,}} n+1=10n + 1 = 10 is enough: T9T_9 is within 10−610^{-6} of exe^x on the whole interval. The bound is not wasteful here. At x=1x = 1 the error of T8T_8 is about 3.1×10−6,3.1 \times 10^{-6}\mathclose{\text{,}} too large, while that of T9T_9 is about 3.0×10−7.3.0 \times 10^{-7}\mathclose{\text{.}}

Watch out

Taylor’s inequality needs MM to bound ∣f(n+1)∣\abs{f^{(n+1)}} on the whole interval between aa and x,x\mathclose{\text{,}} not only at a.a\mathclose{\text{.}} For exe^x on [0,1],[0, 1]\mathclose{\text{,}} the bound M=f(n+1)(0)=1M = f^{(n+1)}(0) = 1 is too small: at x=1x = 1 it would promise ∣e−T9(1)∣≤1/10!≈2.8×10−7,\abs{e - T_9(1)} \le 1/10! \approx 2.8 \times 10^{-7}\mathclose{\text{,}} but the error is 3.0×10−7.3.0 \times 10^{-7}\mathclose{\text{.}} Take the largest value of ∣f(n+1)∣\abs{f^{(n+1)}} on the interval, or any number above it.

Errors of earlier approximations

Modules 4 and 7 stated how large the errors of three approximations are, and left the proofs to this module. Here, as there, the error is the exact value minus the approximation.

Theorem 15.8Errors of the linearisation and of difference quotients
  1. If f′′f'' exists on an open interval containing aa and x,x\mathclose{\text{,}} and LL is the linearisation of ff at a,a\mathclose{\text{,}} then f(x)−L(x)=f′′(c)2(x−a)2f(x) - L(x) = \dfrac{f''(c)}{2}(x - a)^2 for some cc between aa and xx (take c=ac = a when x=a).x = a\mathclose{\text{).}} If also ∣f′′∣≤M\abs{f''} \le M between aa and x,x\mathclose{\text{,}} then ∣f(x)−L(x)∣≤M2(x−a)2.\abs{f(x) - L(x)} \le \dfrac{M}{2}(x - a)^2\mathclose{\text{.}}
  2. Let h>0.h > 0\mathclose{\text{.}} If f′′f'' exists on an open interval containing aa and a+h,a + h\mathclose{\text{,}} the error of the forward difference is
    f′(a)−f(a+h)−f(a)h=−h2f′′(c)f'(a) - \frac{f(a + h) - f(a)}{h} = -\frac{h}{2}f''(c)
    for some cc between aa and a+h.a + h\mathclose{\text{.}}
  3. Let h>0.h > 0\mathclose{\text{.}} If f′′′f''' exists and is continuous on an open interval containing a−ha - h and a+h,a + h\mathclose{\text{,}} the error of the central difference is
    f′(a)−f(a+h)−f(a−h)2h=−h26f′′′(c)\begin{aligned} &f'(a) - \frac{f(a + h) - f(a - h)}{2h} \\ &\quad= -\frac{h^2}{6}f'''(c) \end{aligned}
    for some cc between a−ha - h and a+h.a + h\mathclose{\text{.}}
Proof

Part 1 is Taylor’s theorem with n=1,n = 1\mathclose{\text{,}} since T1=L.T_1 = L\mathclose{\text{.}} For part 2, apply part 1 with x=a+h:x = a + h\mathclose{\text{:}} f(a+h)=f(a)+f′(a)h+12f′′(c)h2.f(a + h) = f(a) + f'(a)h + \tfrac12 f''(c)h^2\mathclose{\text{.}} Subtract f(a)f(a) and divide by hh to get the forward difference, then subtract this quotient from f′(a).f'(a)\mathclose{\text{.}} For part 3, Taylor’s theorem with n=2n = 2 at x=a+hx = a + h and at x=a−hx = a - h gives

f(a±h)=f(a)±f′(a)h+f′′(a)2h2±f′′′(c±)6h3,\begin{aligned} f(a \pm h) &= f(a) \pm f'(a)h + \frac{f''(a)}{2}h^2 \\ &\qquad \pm \frac{f'''(c_\pm)}{6}h^3, \end{aligned}

with c+c_+ between aa and a+ha + h and c−c_- between a−ha - h and a.a\mathclose{\text{.}} Subtract: the terms f(a)f(a) and 12f′′(a)h2\tfrac12 f''(a)h^2 cancel, and

f(a+h)−f(a−h)=2f′(a)h+f′′′(c+)+f′′′(c−)6h3.\begin{aligned} &f(a + h) - f(a - h) \\ &\quad= 2f'(a)h + \frac{f'''(c_+) + f'''(c_-)}{6}h^3. \end{aligned}

Divide by 2h,2h\mathclose{\text{,}} then subtract the quotient from f′(a):f'(a)\mathclose{\text{:}} the error is −h26-\dfrac{h^2}{6} times 12(f′′′(c+)+f′′′(c−)),\tfrac12\big(f'''(c_+) + f'''(c_-)\big)\mathclose{\text{,}} the average of two values of f′′′.f'''\mathclose{\text{.}} The average lies between the two values, so, f′′′f''' being continuous, the Intermediate Value Theorem (Module 3) gives a cc between c−c_- and c+c_+ at which f′′′(c)f'''(c) equals it.

∎

As h→0h \to 0 in part 2, cc is squeezed towards a,a\mathclose{\text{,}} so if f′′f'' is continuous at aa the error is about −h2f′′(a);-\tfrac{h}{2}f''(a)\mathclose{\text{;}} and if ∣f′′∣≤M\abs{f''} \le M near a,a\mathclose{\text{,}} its absolute value is at most M2h,\tfrac{M}{2}h\mathclose{\text{,}} so it is O(h).O(h)\mathclose{\text{.}} In the same way the error in part 3 is about −h26f′′′(a),-\tfrac{h^2}{6}f'''(a)\mathclose{\text{,}} and it is O(h2).O(h^2)\mathclose{\text{.}} These are the claims of Section 4.7. Part 1 gives both claims of Section 7.2: the bound M2(x−a)2,\tfrac{M}{2}(x - a)^2\mathclose{\text{,}} and, when f′′f'' is continuous at a,a\mathclose{\text{,}} f(x)−L(x)≈f′′(a)2(x−a)2,f(x) - L(x) \approx \tfrac{f''(a)}{2}(x - a)^2\mathclose{\text{,}} because f(x)−L(x)(x−a)2=f′′(c)2→f′′(a)2\dfrac{f(x) - L(x)}{(x - a)^2} = \dfrac{f''(c)}{2} \to \dfrac{f''(a)}{2} as x→a.x \to a\mathclose{\text{.}}

Newton’s method of Module 7 is a third beneficiary. Let f(r)=0,f(r) = 0\mathclose{\text{,}} suppose f′′f'' exists on an open interval containing xnx_n and r,r\mathclose{\text{,}} and assume f′(xn)≠0.f'(x_n) \ne 0\mathclose{\text{.}} Keep Module 7’s convention en=xn−re_n = x_n - r for the signed error of an iterate: it is the reverse of the approximation-error convention above. If xn≠r,x_n \ne r\mathclose{\text{,}} Taylor’s theorem of degree 1 about xn,x_n\mathclose{\text{,}} evaluated at r,r\mathclose{\text{,}} gives

0=f(r)=f(xn)+f′(xn)(r−xn)+f′′(cn)2(r−xn)2\begin{aligned} 0 = f(r) &= f(x_n) + f'(x_n)(r - x_n) \\ &\qquad + \frac{f''(c_n)}{2}(r - x_n)^2 \end{aligned}

for some cnc_n between xnx_n and r.r\mathclose{\text{.}} Divide by f′(xn),f'(x_n)\mathclose{\text{,}} and use xn+1=xn−f(xn)/f′(xn),x_{n+1} = x_n - f(x_n)/f'(x_n)\mathclose{\text{,}} so that f(xn)/f′(xn)=xn−xn+1:f(x_n)/f'(x_n) = x_n - x_{n+1}\mathclose{\text{:}}

en+1=f′′(cn)2f′(xn) en2.e_{n+1} = \frac{f''(c_n)}{2f'(x_n)}\,e_n^2.

If xn=r,x_n = r\mathclose{\text{,}} Newton’s next step stays at r,r\mathclose{\text{,}} so both errors are 0 and the relation still holds with cn=r.c_n = r\mathclose{\text{.}} Module 7 found this relation approximately, with xnx_n in place of cn;c_n\mathclose{\text{;}} here it is exact. Exercise 15.12 completes the proof of Theorem 7.3 from it.

When the series equals the function

Theorem 15.9ex,e^x\mathclose{\text{,}} sin⁡x\sin x and cos⁡x\cos x equal their series

For every real number x,x\mathclose{\text{,}}

ex=∑n=0∞xnn!,sin⁡x=∑n=0∞(−1)nx2n+1(2n+1)!,cos⁡x=∑n=0∞(−1)nx2n(2n)!.\begin{aligned} e^x &= \sum_{n=0}^\infty \frac{x^n}{n!}, \\ \sin x &= \sum_{n=0}^\infty (-1)^n \frac{x^{2n+1}}{(2n + 1)!}, \\ \cos x &= \sum_{n=0}^\infty (-1)^n \frac{x^{2n}}{(2n)!}. \end{aligned}
Proof

Fix x;x\mathclose{\text{;}} it is enough to show that Rn(x)→0R_n(x) \to 0 as n→∞.n \to \infty\mathclose{\text{.}} For ex,e^x\mathclose{\text{,}} every derivative is et,e^t\mathclose{\text{,}} and for tt between 0 and x,x\mathclose{\text{,}} et≤e∣x∣.e^t \le e^{\abs{x}}\mathclose{\text{.}} So Taylor’s inequality gives

∣Rn(x)∣≤e∣x∣ ∣x∣n+1(n+1)!.\abs{R_n(x)} \le e^{\abs{x}}\,\frac{\abs{x}^{n+1}}{(n + 1)!}.

For sin⁡x\sin x and cos⁡x\cos x every derivative lies between −1-1 and 1, so ∣Rn(x)∣≤∣x∣n+1/(n+1)!.\abs{R_n(x)} \le \abs{x}^{n+1}/(n + 1)!\mathclose{\text{.}} Finally, ∣x∣m/m!→0\abs{x}^{m}/m! \to 0 as m→∞,m \to \infty\mathclose{\text{,}} for every x:x\mathclose{\text{:}} these are the terms of the series ∑∣x∣m/m!,\sum \abs{x}^m/m!\mathclose{\text{,}} which converges (Example 15.2), and the terms of a convergent series tend to 0. So Rn(x)→0R_n(x) \to 0 in all three cases.

∎

The same argument works about any centre a,a\mathclose{\text{,}} so ex,e^x\mathclose{\text{,}} sin⁡x\sin x and cos⁡x\cos x equal their Taylor series about every point, for every x.x\mathclose{\text{.}} A function that equals the sum of its Taylor series on an interval around each point of an open interval is called analytic there; ex,e^x\mathclose{\text{,}} sin⁡x\sin x and cos⁡x\cos x are analytic on the whole line.

Going deeperA Taylor series that converges to the wrong function

Is the condition Rn(x)→0R_n(x) \to 0 really needed? If a Taylor series converges, must its sum be f?f\mathclose{\text{?}} No. Let

f(x)={e−1/x2if x≠0,0if x=0.f(x) = \begin{cases} e^{-1/x^2} & \text{if } x \ne 0, \\ 0 & \text{if } x = 0. \end{cases}

Figure 15.3 shows how flat its graph is near 0. In fact every derivative of ff at 0 is 0, so its Maclaurin series is 0+0x+0x2+⋯,0 + 0x + 0x^2 + \cdots\mathclose{\text{,}} which converges for every x,x\mathclose{\text{,}} to 0. But f(x)>0f(x) > 0 for every x≠0:x \ne 0\mathclose{\text{:}} the series equals ff only at 0, and the remainder Rn(x)=f(x)R_n(x) = f(x) never tends to 0.

Why is every derivative at 0 equal to 0? First, for x≠0,x \ne 0\mathclose{\text{,}} f(n)(x)=pn(1/x) e−1/x2f^{(n)}(x) = p_n(1/x)\,e^{-1/x^2} for some polynomial pn.p_n\mathclose{\text{.}} This holds for n=0n = 0 with p0=1,p_0 = 1\mathclose{\text{,}} and if it holds for n,n\mathclose{\text{,}} the chain and product rules give

f(n+1)(x)=[2x3 pn(1x)−1x2 pn′(1x)]e−1/x2,\begin{aligned} &f^{(n+1)}(x) \\ &\quad= \Big[\frac{2}{x^3}\,p_n\Big(\frac1x\Big) - \frac{1}{x^2}\,p_n'\Big(\frac1x\Big)\Big]e^{-1/x^2}, \end{aligned}

which has the same form, with pn+1(u)=2u3pn(u)−u2pn′(u).p_{n+1}(u) = 2u^3p_n(u) - u^2p_n'(u)\mathclose{\text{.}} Second, for every whole number m≥0,m \ge 0\mathclose{\text{,}} ume−u2→0u^me^{-u^2} \to 0 as u→∞u \to \infty and as u→−∞,u \to -\infty\mathclose{\text{,}} because exponentials grow faster than powers (Section 7.7): for ∣u∣≥1,\abs{u} \ge 1\mathclose{\text{,}} u2≥∣u∣,u^2 \ge \abs{u}\mathclose{\text{,}} so ∣u∣me−u2≤∣u∣me−∣u∣.\abs{u}^me^{-u^2} \le \abs{u}^me^{-\abs{u}}\mathclose{\text{.}} Now suppose f(n)(0)=0,f^{(n)}(0) = 0\mathclose{\text{,}} as is true for n=0.n = 0\mathclose{\text{.}} By the definition of the derivative, with u=1/x,u = 1/x\mathclose{\text{,}}

f(n+1)(0)=lim⁡x→0f(n)(x)−0x=lim⁡x→01x pn(1x)e−1/x2=lim⁡u→±∞u pn(u) e−u2=0,\begin{aligned} f^{(n+1)}(0) &= \lim_{x\to0}\frac{f^{(n)}(x) - 0}{x} \\ &= \lim_{x\to0}\frac1x\,p_n\Big(\frac1x\Big)e^{-1/x^2} \\ &= \lim_{u\to\pm\infty} u\,p_n(u)\,e^{-u^2} = 0, \end{aligned}

because u pn(u)u\,p_n(u) is a sum of constant multiples of powers of u.u\mathclose{\text{.}} By induction, f(n)(0)=0f^{(n)}(0) = 0 for every n.n\mathclose{\text{.}} So this ff has derivatives of every order everywhere, yet it is not analytic at 0: no power series centred at 0 equals it on any interval around 0, since by Theorem 15.5 that series would have to be its Maclaurin series, 0.

Left: the graph of f(x) = e^{-1/x^2}, with f(0) = 0, rises from the origin towards the line y = 1 (dashed). Its Maclaurin series is 0 (orange): it converges everywhere, but equals f only at x = 0. Right: zoomed in on 0, five times horizontally and about fifteen times vertically, the graph is still flat: f(0.25) = e^{-16} approx 1.1 times 10^{-7}.
Figure 15.3

Left: the graph of f(x)=e−1/x2,f(x) = e^{-1/x^2}\mathclose{\text{,}} with f(0)=0,f(0) = 0\mathclose{\text{,}} rises from the origin towards the line y=1y = 1 (dashed). Its Maclaurin series is 0 (orange): it converges everywhere, but equals ff only at x=0.x = 0\mathclose{\text{.}} Right: zoomed in on 0, five times horizontally and about fifteen times vertically, the graph is still flat: f(0.25)=e−16≈1.1×10−7.f(0.25) = e^{-16} \approx 1.1 \times 10^{-7}\mathclose{\text{.}}

6

Computing with series

e, π and ln 2

By Theorem 15.9 at x=1,x = 1\mathclose{\text{,}}

e=∑n=0∞1n!=1+1+12!+13!+⋯ .e = \sum_{n=0}^\infty \frac{1}{n!} = 1 + 1 + \frac{1}{2!} + \frac{1}{3!} + \cdots.

Its partial sums sn=∑k=0n1/k!s_n = \sum_{k=0}^{n} 1/k! close in fast:

nnsns_ne−sne - s_n
00111.7182818281.718281828
11220.71828182850.7182818285
222.52.50.21828182850.2182818285
332.6666666672.6666666670.051615161790.05161516179
552.7166666672.7166666670.0016151617920.001615161792
882.7182787702.7182787703.058617775×10−63.058617775\times10^{-6}
10102.7182818012.7182818012.731266076×10−82.731266076\times10^{-8}
12122.7182818282.7182818281.728766714×10−101.728766714\times10^{-10}

Taylor’s theorem says how fast. With a=0a = 0 and x=1,x = 1\mathclose{\text{,}} e−sn=Rn(1)=ec/(n+1)!e - s_n = R_n(1) = e^c/(n + 1)! for some cc between 0 and 1, and 1<ec<e<3,1 < e^c < e < 3\mathclose{\text{,}} so

0<e−sn<3(n+1)!.0 < e - s_n < \frac{3}{(n + 1)!}.

For n=10n = 10 the bound is 3/11!≈7.5×10−8;3/11! \approx 7.5 \times 10^{-8}\mathclose{\text{;}} the table shows an error of 2.7×10−8.2.7 \times 10^{-8}\mathclose{\text{.}} Thirteen terms, up to 1/12!,1/12!\mathclose{\text{,}} give ee to ten significant digits. Compare the compound-interest limit of Section 6.1, (1+1/n)n,(1 + 1/n)^n\mathclose{\text{,}} which with n=525 600n = 525\,600 still gives only 2.718279.

The series of Theorem 15.3 for π,\pi\mathclose{\text{,}} π4=1−13+15−⋯,\tfrac{\pi}{4} = 1 - \tfrac13 + \tfrac15 - \cdots\mathclose{\text{,}} is hopeless for computing: its error bound 1/(2n+1)1/(2n + 1) drops below 10−610^{-6} only after half a million terms. The cure is to use arctan⁡\arctan at small numbers, where its series converges fast. Machin’s formula,

π4=4arctan⁡15−arctan⁡1239,\frac{\pi}{4} = 4\arctan\frac15 - \arctan\frac{1}{239},

which Exercise 15.11 proves, needs arctan⁡\arctan only at 15\tfrac15 and 1239.\tfrac{1}{239}\mathclose{\text{.}} Each term of the series of arctan⁡15\arctan\tfrac15 is about 25 times smaller in size than the one before. The series alternate, with terms that decrease in size, so the absolute error of each partial sum is less than the size of the first term left out. Five terms of the first series and two of the second give

arctan⁡15≈15−13⋅53+15⋅55−17⋅57+19⋅59,arctan⁡1239≈1239−13⋅2393,\begin{aligned} \arctan\frac15 &\approx \frac15 - \frac{1}{3\cdot5^3} + \frac{1}{5\cdot5^5} \\ &\qquad - \frac{1}{7\cdot5^7} + \frac{1}{9\cdot5^9}, \\ \arctan\frac{1}{239} &\approx \frac{1}{239} - \frac{1}{3\cdot239^3}, \end{aligned}

with absolute errors less than 111⋅511≈1.9×10−9\tfrac{1}{11\cdot5^{11}} \approx 1.9 \times 10^{-9} and 15⋅2395≈2.6×10−13.\tfrac{1}{5\cdot239^5} \approx 2.6 \times 10^{-13}\mathclose{\text{.}} The combined partial sums therefore have absolute error at most

1611⋅511+45⋅2395≈2.98×10−8<3×10−8.\frac{16}{11\cdot5^{11}} + \frac{4}{5\cdot239^5} \approx 2.98 \times 10^{-8} < 3 \times 10^{-8}.

They give π≈3.14159268.\pi \approx 3.14159268\mathclose{\text{.}} Keep the bounds exact until the last step: rounding them first can change whether their sum meets a target. Formulas of this kind computed π\pi to hundreds of digits by hand, and to millions by computer.

Compute itFifty digits of π

Python’s fractions module computes with exact fractions, so the partial sums of Machin’s formula can be compared with π\pi to any number of digits (SymPy supplies π\pi for the comparison):

Python
from fractions import Fraction
import sympy as sp

def arctan_sum(x, n):
    """The first n terms of x - x**3/3 + x**5/5 - ..., as an exact fraction."""
    return sum(Fraction((-1)**k, 2*k + 1)*x**(2*k + 1) for k in range(n))

def machin(n):
    """Pi from n terms of each series in Machin's formula."""
    p = 4*(4*arctan_sum(Fraction(1, 5), n) - arctan_sum(Fraction(1, 239), n))
    return sp.Rational(p.numerator, p.denominator)

for n in (2, 5, 10, 20, 36):
    print(f"{n:2d} terms: error {sp.N(sp.pi - machin(n), 2)}")
print(sp.N(machin(36), 52))
Output
 2 terms: error 0.0010
 5 terms: error -2.9E-8
10 terms: error 1.5E-15
20 terms: error 8.3E-30
36 terms: error 2.0E-52
3.141592653589793238462643383279502884197169399375106

The printed error is π\pi minus the approximation. Each extra term of each series gains about 1.4 digits, because log⁡1025≈1.4;\log_{10} 25 \approx 1.4\mathclose{\text{;}} 36 terms of each give an error of about 2×10−52,2 \times 10^{-52}\mathclose{\text{,}} and the result rounds to the same 52 significant digits as π.\pi\mathclose{\text{.}} SymPy writes the powers of ten with a capital E.

For ln⁡2\ln 2 the alternating harmonic series is equally slow. A faster series comes from subtracting two logarithms. Replacing xx by −x-x in the series of ln⁡(1+x)\ln(1 + x) gives ln⁡(1−x)=−x−x22−x33−⋯\ln(1 - x) = -x - \tfrac{x^2}{2} - \tfrac{x^3}{3} - \cdots for ∣x∣<1.\abs{x} < 1\mathclose{\text{.}}

Example 15.14A fast series for ln⁡2\ln 2✓ Checked

Show that for ∣x∣<1\abs{x} < 1

ln⁡1+x1−x=2(x+x33+x55+⋯),\ln\frac{1 + x}{1 - x} = 2\Big(x + \frac{x^3}{3} + \frac{x^5}{5} + \cdots\Big),

and use it to find ln⁡2\ln 2 to six decimal places.

Subtract the two series, term by term (both converge for ∣x∣<1).\abs{x} < 1\mathclose{\text{).}} The even powers have the same coefficient in both and cancel; the odd powers have opposite coefficients and double:

ln⁡(1+x)−ln⁡(1−x)=2x+2x33+2x55+⋯ ,\begin{aligned} &\ln(1 + x) - \ln(1 - x) \\ &\quad= 2x + \frac{2x^3}{3} + \frac{2x^5}{5} + \cdots, \end{aligned}

and the left side is ln⁡1+x1−x,\ln\dfrac{1 + x}{1 - x}\mathclose{\text{,}} by the laws of logarithms. Now 1+x1−x=2\dfrac{1 + x}{1 - x} = 2 when 1+x=2−2x,1 + x = 2 - 2x\mathclose{\text{,}} that is, x=13.x = \tfrac13\mathclose{\text{.}} So

ln⁡2=2(13+13⋅33+15⋅35+17⋅37+⋯).\begin{aligned} \ln 2 = 2\Big(&\frac13 + \frac{1}{3\cdot3^3} + \frac{1}{5\cdot3^5} \\ &+ \frac{1}{7\cdot3^7} + \cdots\Big). \end{aligned}

Each term is less than a ninth of the one before. If you stop after nn terms, the terms left out, 2x2k+12k+1\dfrac{2x^{2k+1}}{2k + 1} for k≥n,k \ge n\mathclose{\text{,}} are at most 2x2n+12n+1\dfrac{2x^{2n+1}}{2n + 1} times 1,x2,x4,…,1, x^2, x^4, \dots\mathclose{\text{,}} a geometric series, so the error is at most

2x2n+12n+1⋅11−x2=2(2n+1) 32n+1⋅98.\frac{2x^{2n+1}}{2n + 1}\cdot\frac{1}{1 - x^2} = \frac{2}{(2n + 1)\,3^{2n+1}}\cdot\frac98.

For n=5n = 5 this is about 1.2×10−6,1.2 \times 10^{-6}\mathclose{\text{,}} not quite enough; for n=6n = 6 it is about 1.1×10−7.1.1 \times 10^{-7}\mathclose{\text{.}} Six terms give approximately 0.69314707.0.69314707\mathclose{\text{.}} Adding the exact error bound to the exact partial sum gives less than 0.69314719,0.69314719\mathclose{\text{,}} while the partial sum itself is greater than 0.69314707.0.69314707\mathclose{\text{.}} Thus ln⁡2\ln 2 lies between 0.693147070.69314707 and 0.69314719:0.69314719\mathclose{\text{:}} both round to 0.6931470.693147 to six decimal places, so ln⁡2≈0.693147.\ln 2 \approx 0.693147\mathclose{\text{.}} The alternating harmonic series would need about a million terms for the same accuracy.

Limits by series

Series turn many limits into algebra. Write O(xm),O(x^m)\mathclose{\text{,}} as in Module 4, for a quantity whose size is at most a constant times ∣x∣m\abs{x}^m for xx near 0. Taylor’s inequality gives such statements for every function in this module: for instance sin⁡x=x−x36+O(x5),\sin x = x - \tfrac{x^3}{6} + O(x^5)\mathclose{\text{,}} since T3=T4T_3 = T_4 for sin⁡\sin and ∣R4(x)∣≤∣x∣5/5!.\abs{R_4(x)} \le \abs{x}^5/5!\mathclose{\text{.}} Three rules follow from the definition, for xx near 0: xk O(xm)=O(xk+m),x^k\,O(x^m) = O(x^{k+m})\mathclose{\text{,}} a sum of terms O(xm)O(x^m) is O(xm),O(x^m)\mathclose{\text{,}} and O(xm)O(x^m) is also O(xk)O(x^k) when k≤m.k \le m\mathclose{\text{.}}

Example 15.15Two limits✓ Checked

Find (a) lim⁡x→0sin⁡x−xx3\displaystyle\lim_{x\to0}\frac{\sin x - x}{x^3} and (b) lim⁡x→0exsin⁡x−x−x2x3.\displaystyle\lim_{x\to0}\frac{e^x\sin x - x - x^2}{x^3}\mathclose{\text{.}}

(a) Since sin⁡x−x=−x36+O(x5),\sin x - x = -\tfrac{x^3}{6} + O(x^5)\mathclose{\text{,}}

sin⁡x−xx3=−16+O(x2)→−16.\frac{\sin x - x}{x^3} = -\frac16 + O(x^2) \to -\frac16.

L’Hôpital’s rule reaches the same answer only after three applications.

(b) Multiply the series of exe^x and sin⁡x,\sin x\mathclose{\text{,}} keeping the terms up to x3;x^3\mathclose{\text{;}} every product of higher degree goes into O(x4):O(x^4)\mathclose{\text{:}}

exsin⁡x=(1+x+x22+O(x3))×(x−x36+O(x5))=x+x2+(12−16)x3+O(x4)=x+x2+x33+O(x4).\begin{aligned} &e^x\sin x \\ &\quad= \Big(1 + x + \frac{x^2}{2} + O(x^3)\Big) \\ &\qquad\times\Big(x - \frac{x^3}{6} + O(x^5)\Big) \\ &\quad= x + x^2 + \Big(\frac12 - \frac16\Big)x^3 + O(x^4) \\ &\quad= x + x^2 + \frac{x^3}{3} + O(x^4). \end{aligned}

So exsin⁡x−x−x2x3=13+O(x)→13.\dfrac{e^x\sin x - x - x^2}{x^3} = \dfrac13 + O(x) \to \dfrac13\mathclose{\text{.}}

Watch out

Keep enough terms. With sin⁡x≈x\sin x \approx x alone, the numerator of (a) becomes x−x=0x - x = 0 and the limit seems to be 0. The first term that survives the cancellation decides the limit, so expand each function until a nonzero term of the order of the denominator appears, and carry the O(⋅)O(\cdot) term to see what you have dropped.

Approximations in physics

Physicists replace functions by their first few Taylor terms all the time, and Taylor’s theorem tells them what they lose.

Example 15.16Kinetic energy at low speed✓ Checked

In special relativity, a body of rest mass m>0m > 0 moving at speed 0≤v<c0 \le v < c has kinetic energy

Ek=mc2(11−v2/c2−1),E_k = mc^2\Big(\frac{1}{\sqrt{1 - v^2/c^2}} - 1\Big),

where c=299 792 458c = 299\,792\,458 m/s is the speed of light. Show that for small v/cv/c this is close to Newton’s 12mv2,\tfrac12 mv^2\mathclose{\text{,}} and estimate the relative error of Newton’s formula.

Put x=v2/c2x = v^2/c^2 in Example 15.10(b), 11−x=1+x2+3x28+⋯:\dfrac{1}{\sqrt{1 - x}} = 1 + \dfrac{x}{2} + \dfrac{3x^2}{8} + \cdots\mathclose{\text{:}}

Ek=mc2(v22c2+3v48c4+⋯)=12mv2+3mv48c2+⋯ .\begin{aligned} E_k &= mc^2\Big(\frac{v^2}{2c^2} + \frac{3v^4}{8c^4} + \cdots\Big) \\ &= \frac12 mv^2 + \frac{3mv^4}{8c^2} + \cdots. \end{aligned}

Newton’s formula is the first term. The second, divided by the first, is 34 v2/c2:\tfrac34\,v^2/c^2\mathclose{\text{:}} that is roughly the relative error of 12mv2.\tfrac12mv^2\mathclose{\text{.}} At v=0.1cv = 0.1c it is 0.75%; the exact values are Ek≈0.0050378 mc2E_k \approx 0.0050378\,mc^2 against 12mv2=0.005 mc2,\tfrac12mv^2 = 0.005\,mc^2\mathclose{\text{,}} a relative error of 0.75% indeed. For any speed up to 300 m/s, v2/c2<1.1×10−12,v^2/c^2 < 1.1 \times 10^{-12}\mathclose{\text{,}} and Newton’s formula is right to about one part in a million million.

The small-angle approximation sin⁡θ≈θ\sin\theta \approx \theta of Example 7.6 is the Taylor polynomial T1T_1 of the sine. Module 7 measured its relative error with a table; series explain the table. Since θ−sin⁡θ=θ36+O(θ5)\theta - \sin\theta = \tfrac{\theta^3}{6} + O(\theta^5) and sin⁡θ=θ(1+O(θ2)),\sin\theta = \theta\big(1 + O(\theta^2)\big)\mathclose{\text{,}}

θ−sin⁡θsin⁡θ=θ26+O(θ4).\frac{\theta - \sin\theta}{\sin\theta} = \frac{\theta^2}{6} + O(\theta^4).

At θ=0.1\theta = 0.1 this gives 0.001667,0.001667\mathclose{\text{,}} against 0.0016690.001669 in Module 7’s table, and it explains why the error grew about a hundredfold for each tenfold increase in θ.\theta\mathclose{\text{.}} For a pendulum of length L,L\mathclose{\text{,}} the small-angle approximation gives the familiar period 2πL/g,2\pi\sqrt{L/g}\mathclose{\text{,}} the same for every small swing. Physics texts show, by a longer calculation in which the binomial series appears inside an integral, that a swing of amplitude θ0\theta_0 (in radians) takes

T=2πLg (1+θ0216+⋯).T = 2\pi\sqrt{\frac{L}{g}}\,\Big(1 + \frac{\theta_0^2}{16} + \cdots\Big).

So a swing of 0.1 radian (about 6∘)6^\circ\mathclose{\text{)}} takes about 0.06% longer than the small-angle formula says, and a swing of 0.5 radian about 1.6% longer.

How computers evaluate functions

Mathematics libraries often evaluate functions such as sin⁡x\sin x and exe^x using range reduction and polynomial approximations. Python’s math functions mostly call the platform’s C mathematics library, so the details depend on the system. Here is the idea in two steps.

Range reduction. The Maclaurin series of sin⁡\sin converges for every x,x\mathclose{\text{,}} but for large xx it is useless: at x=100x = 100 its terms grow to about 104210^{42} before they shrink, and in floating point their sum, a number between −1-1 and 1, is lost in the rounding. So the library first uses the symmetries of sin⁡\sin to make xx small. Write x=k⋅π2+r,x = k\cdot\tfrac{\pi}{2} + r\mathclose{\text{,}} with kk the whole number nearest to x/(π/2),x/(\pi/2)\mathclose{\text{,}} so that ∣r∣≤π/4.\abs{r} \le \pi/4\mathclose{\text{.}} By the addition formulas of Module 1, sin⁡x\sin x is sin⁡r,\sin r\mathclose{\text{,}} cos⁡r,\cos r\mathclose{\text{,}} −sin⁡r-\sin r or −cos⁡r,-\cos r\mathclose{\text{,}} according as kk leaves the remainder 0, 1, 2 or 3 when divided by 4.

A polynomial. For ∣r∣≤π/4\abs{r} \le \pi/4 Taylor polynomials converge fast. Since T15=T16T_{15} = T_{16} for sin⁡,\sin\mathclose{\text{,}} Taylor’s inequality gives

∣sin⁡r−T15(r)∣≤(π/4)1717!≈4.6×10−17,\abs{\sin r - T_{15}(r)} \le \frac{(\pi/4)^{17}}{17!} \approx 4.6 \times 10^{-17},

and T16T_{16} has an even smaller bound for cos⁡r.\cos r\mathclose{\text{.}} This bounds the polynomial’s approximation error; evaluating it in floating point adds rounding error. The even polynomial for cos⁡r,\cos r\mathclose{\text{,}} and the polynomial factor of rr in the approximation to sin⁡r,\sin r\mathclose{\text{,}} can be evaluated from the inside out as c0+u(c1+u(c2+⋯ ))c_0 + u\big(c_1 + u(c_2 + \cdots)\big) with u=r2.u = r^2\mathclose{\text{.}} This is Horner’s rule: starting from the highest coefficient, each remaining coefficient needs one multiplication and one addition.

Production libraries refine both steps. They often use coefficients tuned for the whole interval rather than Taylor coefficients. One approach uses minimax polynomials, which minimise the largest absolute error on the interval among polynomials of a chosen degree. Accurate range reduction also needs extra digits of π,\pi\mathclose{\text{,}} because for large xx the subtraction x−kπ/2x - k\pi/2 cancels leading digits, as in Module 2. The exponential can be handled similarly: write x=kln⁡2+rx = k\ln 2 + r with ∣r∣≤12ln⁡2;\abs{r} \le \tfrac12\ln 2\mathclose{\text{;}} then ex=2ker.e^x = 2^ke^r\mathclose{\text{.}} Approximate ere^r on this small interval and rescale by 2k.2^k\mathclose{\text{.}}

Compute itA sine function of your own

Range reduction and a Taylor polynomial of degree 15 already make a good sine:

Python
import math

S = [(-1)**j/math.factorial(2*j + 1) for j in range(8)]    # sin: r, r^3, ..., r^15
C = [(-1)**j/math.factorial(2*j) for j in range(9)]        # cos: 1, r^2, ..., r^16

def poly(coeffs, u):
    """c0 + c1*u + c2*u**2 + ..., by Horner's rule."""
    total = 0.0
    for c in reversed(coeffs):
        total = total*u + c
    return total

def my_sin(x):
    k = round(x/(math.pi/2))           # x = k*(pi/2) + r with |r| <= pi/4
    r = x - k*(math.pi/2)
    s, c = r*poly(S, r*r), poly(C, r*r)
    return [s, c, -s, -c][k % 4]

for x in [0.5, 2.0, 10.0, 1000.0, 1e6]:
    print(f"x = {x:>9}: my_sin = {my_sin(x):+.16f}, math.sin = {math.sin(x):+.16f}")
Output
x =       0.5: my_sin = +0.4794255386042030, math.sin = +0.4794255386042030
x =       2.0: my_sin = +0.9092974268256817, math.sin = +0.9092974268256817
x =      10.0: my_sin = -0.5440211108893701, math.sin = -0.5440211108893698
x =    1000.0: my_sin = +0.8268795405320475, math.sin = +0.8268795405320025
x = 1000000.0: my_sin = -0.3499935020939287, math.sin = -0.3499935021712929

For x=0.5x = 0.5 and 2 the two agree in every digit printed, and for x=10x = 10 in all but the last. In these examples the discrepancy grows with x:x\mathclose{\text{:}} at x=106x = 10^6 it is about 8×10−11.8 \times 10^{-11}\mathclose{\text{.}} The range reduction dominates the error. math.pi/2 is π/2\pi/2 rounded to about 16 digits, and r=x−k⋅π2r = x - k\cdot\tfrac{\pi}{2} inherits kk times that rounding error, with kk about x/1.57,x/1.57\mathclose{\text{,}} as well as the rounding of k⋅π2,k\cdot\tfrac{\pi}{2}\mathclose{\text{,}} a number almost as large as x.x\mathclose{\text{.}} A library can avoid this loss by reducing with more digits of π;\pi\mathclose{\text{;}} the exact algorithm and final printed digits depend on the platform.

7

Euler’s formula

Three of the standard series look alike. The series of exe^x has every power of x,x\mathclose{\text{,}} with plus signs; sin⁡x\sin x has the odd powers and cos⁡x\cos x the even powers, with alternating signs, and the same factorials. Complex numbers show that this is no coincidence: the three are one function.

Complex numbers

The equation x2+1=0x^2 + 1 = 0 has no real solution, because x2≥0x^2 \ge 0 for every real x.x\mathclose{\text{.}} Mathematicians add a new number ii with i2=−1i^2 = -1 and calculate with it as with a letter in algebra, replacing i2i^2 by −1-1 wherever it appears. Module 13 met such numbers as the complex roots of a characteristic equation; this section needs only the little about them that follows.

Definition 15.4Complex numbers

A complex number is a number z=p+qi,z = p + qi\mathclose{\text{,}} where pp and qq are real numbers and i,i\mathclose{\text{,}} the imaginary unit, satisfies i2=−1.i^2 = -1\mathclose{\text{.}} The real number pp is the real part of z,z\mathclose{\text{,}} and qq its imaginary part. Complex numbers are added and multiplied like expressions in a letter i,i\mathclose{\text{,}} with i2i^2 replaced by −1:-1\mathclose{\text{:}} for z=p+qiz = p + qi and w=r+si,w = r + si\mathclose{\text{,}}

z+w=(p+r)+(q+s)i,zw=(pr−qs)+(ps+qr)i.\begin{aligned} z + w &= (p + r) + (q + s)i, \\ zw &= (pr - qs) + (ps + qr)i. \end{aligned}

Two complex numbers are equal when their real parts are equal and their imaginary parts are equal. The modulus of z=p+qiz = p + qi is ∣z∣=p2+q2.\abs{z} = \sqrt{p^2 + q^2}\mathclose{\text{.}}

The real numbers are the complex numbers with imaginary part 0. Picture z=p+qiz = p + qi as the point (p,q)(p, q) of a plane, the complex plane, with real parts along the horizontal axis and imaginary parts up the vertical one; then ∣z∣\abs{z} is the distance from zz to 0, and multiplying out shows that ∣zw∣=∣z∣ ∣w∣.\abs{zw} = \abs{z}\,\abs{w}\mathclose{\text{.}} The powers of ii repeat in a cycle of four:

i0=1,i1=i,i2=−1,i3=−i,i4=1,i5=i, …\begin{aligned} &i^0 = 1, \quad i^1 = i, \quad i^2 = -1, \\ &i^3 = -i, \quad i^4 = 1, \quad i^5 = i, \ \dots \end{aligned}

Multiplying by ii turns the plane a quarter turn anticlockwise about 0: i(p+qi)=−q+pi,i(p + qi) = -q + pi\mathclose{\text{,}} so the point (p,q)(p, q) moves to (−q,p).(-q, p)\mathclose{\text{.}}

A series of complex numbers converges when the series of their real parts and the series of their imaginary parts both converge; its sum is then the sum of the real parts plus ii times the sum of the imaginary parts. If ∑∣zn∣\sum \abs{z_n} converges, so does ∑zn:\sum z_n\mathclose{\text{:}} the real and imaginary parts of znz_n are at most ∣zn∣\abs{z_n} in size, so both real series converge absolutely, by comparison.

Definition 15.5The exponential of a complex number

For every complex number z,z\mathclose{\text{,}}

ez=∑n=0∞znn!=1+z+z22!+z33!+⋯ .e^z = \sum_{n=0}^\infty \frac{z^n}{n!} = 1 + z + \frac{z^2}{2!} + \frac{z^3}{3!} + \cdots.

The series converges for every z,z\mathclose{\text{,}} because ∣zn/n!∣=∣z∣n/n!\abs{z^n/n!} = \abs{z}^n/n! and ∑∣z∣n/n!\sum \abs{z}^n/n! converges (Example 15.2). For a real zz it is the familiar ex,e^x\mathclose{\text{,}} by Theorem 15.9. The law of exponents ez+w=ezewe^{z+w} = e^z e^w holds for complex zz and ww too. Its proof multiplies the two series term by term and collects the terms with the binomial theorem; it rests on a theorem about multiplying absolutely convergent series, which this course does not prove.

e to an imaginary power

Theorem 15.10Euler’s formula

For every real number θ,\theta\mathclose{\text{,}}

eiθ=cos⁡θ+isin⁡θ.e^{i\theta} = \cos\theta + i\sin\theta.
Proof

Put z=iθz = i\theta in the series. Since (iθ)n=inθn(i\theta)^n = i^n\theta^n and the powers of ii cycle through 1,i,−1,−i,1, i, -1, -i\mathclose{\text{,}}

eiθ=1+iθ−θ22!−i θ33!+θ44!+i θ55!−⋯ .\begin{aligned} e^{i\theta} &= 1 + i\theta - \frac{\theta^2}{2!} - i\,\frac{\theta^3}{3!} \\ &\qquad + \frac{\theta^4}{4!} + i\,\frac{\theta^5}{5!} - \cdots. \end{aligned}

The real parts of the terms are 1,0,−θ22!,0,θ44!,…:1, 0, -\tfrac{\theta^2}{2!}, 0, \tfrac{\theta^4}{4!}, \dots\mathclose{\text{:}} the terms of the series of cos⁡θ,\cos\theta\mathclose{\text{,}} with zeros in between, which change neither whether it converges nor its sum. The imaginary parts are 0,θ,0,−θ33!,0,θ55!,…:0, \theta, 0, -\tfrac{\theta^3}{3!}, 0, \tfrac{\theta^5}{5!}, \dots\mathclose{\text{:}} the series of sin⁡θ,\sin\theta\mathclose{\text{,}} with zeros in between. By Theorem 15.9 these converge to cos⁡θ\cos\theta and sin⁡θ,\sin\theta\mathclose{\text{,}} so eiθ=cos⁡θ+isin⁡θ.e^{i\theta} = \cos\theta + i\sin\theta\mathclose{\text{.}}

∎

At θ=π,\theta = \pi\mathclose{\text{,}} cos⁡π=−1\cos\pi = -1 and sin⁡π=0,\sin\pi = 0\mathclose{\text{,}} so

eiπ=−1,that is,eiπ+1=0:e^{i\pi} = -1, \qquad\text{that is,}\qquad e^{i\pi} + 1 = 0:

one equation that links five of the most important numbers in mathematics, 0, 1, e,e\mathclose{\text{,}} ii and π.\pi\mathclose{\text{.}} Figure 15.4 shows what Euler’s formula means. The complex number eiθe^{i\theta} is the point (cos⁡θ,sin⁡θ),(\cos\theta, \sin\theta)\mathclose{\text{,}} the point at angle θ\theta on the unit circle of Section 1.4, and its modulus is 1. As θ\theta increases, eiθe^{i\theta} moves anticlockwise round the circle, once every 2π.2\pi\mathclose{\text{.}}

Left: by Euler's formula, e^{itheta} = costheta + isintheta is the point at angle theta on the unit circle of the complex plane, with real part costheta (green) and imaginary part sintheta (blue). Right: the partial sums SN of the series sum (ipi)^n/n! of e^{ipi}. Each term is the one before multiplied by ipi/n, so the path turns left by a right angle at every step, and it spirals in to -1.
Figure 15.4

Left: by Euler’s formula, eiθ=cos⁡θ+isin⁡θe^{i\theta} = \cos\theta + i\sin\theta is the point at angle θ\theta on the unit circle of the complex plane, with real part cos⁡θ\cos\theta (green) and imaginary part sin⁡θ\sin\theta (blue). Right: the partial sums SNS_N of the series ∑(iπ)n/n!\sum (i\pi)^n/n! of eiπ.e^{i\pi}\mathclose{\text{.}} Each term is the one before multiplied by iπ/n,i\pi/n\mathclose{\text{,}} so the path turns left by a right angle at every step, and it spirals in to −1.-1\mathclose{\text{.}}

Euler’s formula with −θ-\theta in place of θ\theta gives e−iθ=cos⁡θ−isin⁡θ,e^{-i\theta} = \cos\theta - i\sin\theta\mathclose{\text{,}} because cos⁡\cos is even and sin⁡\sin is odd. Adding and subtracting the two formulas,

cos⁡θ=eiθ+e−iθ2,sin⁡θ=eiθ−e−iθ2i,\cos\theta = \frac{e^{i\theta} + e^{-i\theta}}{2}, \qquad \sin\theta = \frac{e^{i\theta} - e^{-i\theta}}{2i},

close relatives of cosh⁡x=12(ex+e−x)\cosh x = \tfrac12(e^x + e^{-x}) and sinh⁡x=12(ex−e−x)\sinh x = \tfrac12(e^x - e^{-x}) of Module 6. The law of exponents turns into the addition formulas of Module 1. From ei(x+y)=eixeiy,e^{i(x + y)} = e^{ix}e^{iy}\mathclose{\text{,}}

cos⁡(x+y)+isin⁡(x+y)=(cos⁡x+isin⁡x)(cos⁡y+isin⁡y)=(cos⁡xcos⁡y−sin⁡xsin⁡y)+i(sin⁡xcos⁡y+cos⁡xsin⁡y),\begin{aligned} &\cos(x + y) + i\sin(x + y) \\ &\quad= (\cos x + i\sin x)(\cos y + i\sin y) \\ &\quad= (\cos x\cos y - \sin x\sin y) \\ &\qquad + i(\sin x\cos y + \cos x\sin y), \end{aligned}

and comparing the real parts, and then the imaginary parts, gives both formulas at once.

Complex numbers also answer the question of Section 15.2: why does the series of 1/(1+x2)1/(1 + x^2) stop converging at x=±1,x = \pm1\mathclose{\text{,}} where nothing happens to the function? Allow complex zz in 1/(1+z2):1/(1 + z^2)\mathclose{\text{:}} the denominator is 0 at z=±i,z = \pm i\mathclose{\text{,}} at distance 1 from 0 in the complex plane. A theorem of complex analysis, beyond this course, says that the Taylor series of a rational function in lowest terms, about a real a,a\mathclose{\text{,}} has as its radius of convergence the distance from aa to the nearest complex number at which the denominator is 0. The function blows up at ±i,\pm i\mathclose{\text{,}} out of sight of the real line, and the series cannot converge beyond that distance. About a=1a = 1 the radius is ∣1−i∣=2.\abs{1 - i} = \sqrt2\mathclose{\text{.}} And since arctan⁡x\arctan x is an integral of 1/(1+x2),1/(1 + x^2)\mathclose{\text{,}} and integration keeps the radius (Theorem 15.2), the series of arctan⁡x\arctan x about aa has radius ∣a−i∣=1+a2:\abs{a - i} = \sqrt{1 + a^2}\mathclose{\text{:}} the widget of Section 15.4 shows it.

Watch out

Not every rule of real exponentials survives. For real numbers, ex=eye^x = e^y forces x=y;x = y\mathclose{\text{;}} for complex numbers it does not, because e2πi=cos⁡2π+isin⁡2π=1=e0,e^{2\pi i} = \cos 2\pi + i\sin 2\pi = 1 = e^0\mathclose{\text{,}} although 2πi≠0.2\pi i \ne 0\mathclose{\text{.}} The complex exponential repeats itself with period 2πi,2\pi i\mathclose{\text{,}} so you cannot cancel it, or take logarithms, as you would for real numbers.

Oscillations

Module 13 solved constant-coefficient equations such as y′′+py′+qy=0,y'' + py' + qy = 0\mathclose{\text{,}} with real constants pp and q,q\mathclose{\text{,}} by trying y=ert,y = e^{rt}\mathclose{\text{,}} which leads to the characteristic equation r2+pr+q=0.r^2 + pr + q = 0\mathclose{\text{.}} When p2<4qp^2 < 4q this equation has no real roots. Its real solutions include eatcos⁡bte^{at}\cos bt and eatsin⁡bt,e^{at}\sin bt\mathclose{\text{,}} with a=−p2a = -\tfrac{p}{2} and b=124q−p2.b = \tfrac12\sqrt{4q - p^2}\mathclose{\text{.}} Here aa and bb are the root’s real and imaginary parts, called α\alpha and β\beta in Module 13; they are not that module’s coefficients of y′′y'' and y′.y'\mathclose{\text{.}} Module 13 checked these solutions by substitution. Euler’s formula shows where they come from.

By the quadratic formula the roots are r=−p2±12p2−4q.r = -\tfrac{p}{2} \pm \tfrac12\sqrt{p^2 - 4q}\mathclose{\text{.}} When p2<4q,p^2 < 4q\mathclose{\text{,}} the number p2−4qp^2 - 4q is negative, and (i4q−p2)2=−(4q−p2)=p2−4q;\big(i\sqrt{4q - p^2}\big)^2 = -(4q - p^2) = p^2 - 4q\mathclose{\text{;}} so the roots are the complex numbers r=a±bi.r = a \pm bi\mathclose{\text{.}}

Complex roots give complex solutions. A function of a real variable tt with complex values, u(t)+i v(t),u(t) + i\,v(t)\mathclose{\text{,}} is differentiated by differentiating its real and imaginary parts. For r=a+bi,r = a + bi\mathclose{\text{,}} Euler’s formula and the law of exponents give ert=eateibt=eatcos⁡bt+i eatsin⁡bt,e^{rt} = e^{at}e^{ibt} = e^{at}\cos bt + i\,e^{at}\sin bt\mathclose{\text{,}} and by the product rule

ddtert=eat(acos⁡bt−bsin⁡bt)+i eat(asin⁡bt+bcos⁡bt)=(a+bi) eat(cos⁡bt+isin⁡bt)=r ert,\begin{aligned} \frac{d}{dt}e^{rt} &= e^{at}(a\cos bt - b\sin bt) \\ &\qquad + i\,e^{at}(a\sin bt + b\cos bt) \\ &= (a + bi)\,e^{at}(\cos bt + i\sin bt) \\ &= r\,e^{rt}, \end{aligned}

as multiplying out (a+bi)(cos⁡bt+isin⁡bt)(a + bi)(\cos bt + i\sin bt) confirms. So (ert)′′=r2ert,(e^{rt})'' = r^2e^{rt}\mathclose{\text{,}} and y=erty = e^{rt} gives y′′+py′+qy=(r2+pr+q) ert=0,y'' + py' + qy = (r^2 + pr + q)\,e^{rt} = 0\mathclose{\text{,}} exactly as for a real root.

Their real and imaginary parts are real solutions. If y=u+ivy = u + iv solves the equation, with uu and vv real functions, then, since pp and qq are real,

0=y′′+py′+qy=(u′′+pu′+qu)+i (v′′+pv′+qv),\begin{aligned} 0 &= y'' + py' + qy \\ &= (u'' + pu' + qu) + i\,(v'' + pv' + qv), \end{aligned}

and a complex number is 0 only when its real and imaginary parts are both 0. So uu and vv are solutions. The real and imaginary parts of e(a+bi)te^{(a+bi)t} are eatcos⁡bte^{at}\cos bt and eatsin⁡bt:e^{at}\sin bt\mathclose{\text{:}} Module 13’s solutions. The imaginary part bb of the root makes them oscillate, because eibte^{ibt} goes round the unit circle; the real part aa decides whether the oscillation dies away (a<0),a < 0\mathclose{\text{),}} grows (a>0)a > 0\mathclose{\text{)}} or keeps its size (a=0).a = 0\mathclose{\text{).}}

Example 15.17A damped spring✓ Checked

A mass on a spring with damping moves according to y′′+2y′+10y=0,y'' + 2y' + 10y = 0\mathclose{\text{,}} where yy is its displacement and tt the time (in seconds, say). Find real solutions with Euler’s formula, and describe the motion.

The characteristic equation r2+2r+10=0r^2 + 2r + 10 = 0 has roots

r=−2±4−402=−2±6i2=−1±3i,\begin{aligned} r &= \frac{-2 \pm \sqrt{4 - 40}}{2} \\ &= \frac{-2 \pm 6i}{2} = -1 \pm 3i, \end{aligned}

since −36=6i\sqrt{-36} = 6i in the sense above: (6i)2=−36.(6i)^2 = -36\mathclose{\text{.}} So e(−1+3i)t=e−t(cos⁡3t+isin⁡3t)e^{(-1+3i)t} = e^{-t}(\cos 3t + i\sin 3t) is a complex solution, and its real and imaginary parts give the real solutions e−tcos⁡3te^{-t}\cos 3t and e−tsin⁡3t;e^{-t}\sin 3t\mathclose{\text{;}} Module 13’s general solution is y=e−t(C1cos⁡3t+C2sin⁡3t).y = e^{-t}(C_1\cos 3t + C_2\sin 3t)\mathclose{\text{.}} The trigonometric factor has period 2π/3≈2.092\pi/3 \approx 2.09 seconds. The displacement itself is not periodic: its amplitude envelope shrinks by the factor e−t,e^{-t}\mathclose{\text{,}} halving every ln⁡2≈0.69\ln 2 \approx 0.69 seconds.

Compute itEuler’s formula in Python

Python has complex numbers built in. It writes the imaginary unit as j, as engineers do, so ii is 1j, and the module cmath has the complex exponential:

Python
import cmath
import math
print(1j**2)
print(cmath.exp(1j*math.pi))
theta = 1.0
print(cmath.exp(1j*theta))
print(math.cos(theta), math.sin(theta))
Output
(-1+0j)
(-1+1.2246467991473532e-16j)
(0.5403023058681398+0.8414709848078965j)
0.5403023058681398 0.8414709848078965

eiπe^{i\pi} comes out as −1-1 plus a tiny imaginary part. That part is sin⁡\sin of math.pi, which is π\pi rounded to about 16 digits: sin⁡(π−δ)≈δ\sin(\pi - \delta) \approx \delta for a small δ,\delta\mathclose{\text{,}} and here δ,\delta\mathclose{\text{,}} the difference between π\pi and math.pi, is about 1.22×10−16.1.22 \times 10^{-16}\mathclose{\text{.}} SymPy, which keeps π\pi exact, gets −1-1 exactly; with a real symbol it expands eite^{it} by Euler’s formula, and its differential equation solver produces the oscillations of Example 15.17:

Python
import sympy as sp
t = sp.symbols('t', real=True)
y = sp.Function('y')
print(sp.exp(sp.I*sp.pi))
print(sp.expand(sp.exp(sp.I*t), complex=True))
print(sp.dsolve(y(t).diff(t, 2) + 2*y(t).diff(t) + 10*y(t)))
Output
-1
I*sin(t) + cos(t)
Eq(y(t), (C1*sin(3*t) + C2*cos(3*t))*exp(-t))
8

What you learned

  • A power series ∑cn(x−a)n\sum c_n(x - a)^n converges absolutely for ∣x−a∣<R\abs{x - a} < R and diverges for ∣x−a∣>R.\abs{x - a} > R\mathclose{\text{.}} The radius R,R\mathclose{\text{,}} possibly 0 or ∞,\infty\mathclose{\text{,}} usually comes from the ratio test; the endpoints a±Ra \pm R must be tested separately.
  • Substituting into the geometric series 1/(1−u)=∑un,1/(1 - u) = \sum u^n\mathclose{\text{,}} ∣u∣<1,\abs{u} < 1\mathclose{\text{,}} gives series for 1/(1+x),1/(1 + x)\mathclose{\text{,}} 1/(1+x2)1/(1 + x^2) and many more, once the condition ∣u∣<1\abs{u} < 1 is translated.
  • Inside the interval of convergence a power series can be differentiated and integrated term by term, with the same radius. This gives the series of ln⁡(1+x)\ln(1 + x) and arctan⁡x,\arctan x\mathclose{\text{,}} and at the endpoints 1−12+13−⋯=ln⁡21 - \tfrac12 + \tfrac13 - \cdots = \ln 2 and 1−13+15−⋯=π4.1 - \tfrac13 + \tfrac15 - \cdots = \tfrac{\pi}{4}\mathclose{\text{.}} Abel’s theorem covers every series that converges at an endpoint.
  • If ff has a power series about a,a\mathclose{\text{,}} its coefficients are f(n)(a)/n!:f^{(n)}(a)/n!\mathclose{\text{:}} it is the Taylor series of ff (the Maclaurin series when a=0).a = 0\mathclose{\text{).}} Know the series of 1/(1−x),1/(1 - x)\mathclose{\text{,}} ln⁡(1+x),\ln(1 + x)\mathclose{\text{,}} arctan⁡x,\arctan x\mathclose{\text{,}} ex,e^x\mathclose{\text{,}} sin⁡x,\sin x\mathclose{\text{,}} cos⁡x\cos x and (1+x)k,(1 + x)^k\mathclose{\text{,}} with their intervals.
  • The Taylor polynomial TnT_n matches ff and its first nn derivatives at a.a\mathclose{\text{.}} Taylor’s theorem: f(x)=Tn(x)+f(n+1)(c)(n+1)!(x−a)n+1f(x) = T_n(x) + \dfrac{f^{(n+1)}(c)}{(n + 1)!}(x - a)^{n+1} for some cc between aa and x,x\mathclose{\text{,}} so ∣f(x)−Tn(x)∣≤M(n+1)!∣x−a∣n+1\abs{f(x) - T_n(x)} \le \dfrac{M}{(n + 1)!}\abs{x - a}^{n+1} when ∣f(n+1)∣≤M.\abs{f^{(n+1)}} \le M\mathclose{\text{.}} It proves the error estimates of Modules 4 and 7.
  • A Taylor series equals ff exactly where the remainder tends to 0: for ex,e^x\mathclose{\text{,}} sin⁡x\sin x and cos⁡x,\cos x\mathclose{\text{,}} at every x.x\mathclose{\text{.}} A convergent Taylor series can have the wrong sum, as e−1/x2e^{-1/x^2} shows.
  • Series compute e,e\mathclose{\text{,}} π\pi and ln⁡2,\ln 2\mathclose{\text{,}} turn limits into algebra, give the approximations of physics and, after range reduction, the polynomials of mathematics libraries.
  • eiθ=cos⁡θ+isin⁡θ,e^{i\theta} = \cos\theta + i\sin\theta\mathclose{\text{,}} so eiπ+1=0.e^{i\pi} + 1 = 0\mathclose{\text{.}} Complex roots a±bia \pm bi of a characteristic equation give the oscillations eatcos⁡bte^{at}\cos bt and eatsin⁡bt,e^{at}\sin bt\mathclose{\text{,}} and the complex zeros ±i\pm i of 1+z21 + z^2 explain the radius 1 of the series of 1/(1+x2).1/(1 + x^2)\mathclose{\text{.}}
  • SymPy: sp.series(f, x, a, n) gives the terms up to (x−a)n−1;(x - a)^{n-1}\mathclose{\text{;}} .removeO() drops the OO term.
9

Exercises

Exercise 15.1★Intervals of convergence

Find the radius and the interval of convergence of each series.

  • (a) ∑n=1∞n xn4n\displaystyle\sum_{n=1}^\infty \frac{n\,x^n}{4^n}
  • (b) ∑n=1∞(x+1)nn\displaystyle\sum_{n=1}^\infty \frac{(x + 1)^n}{\sqrt n}
  • (c) ∑n=0∞(2x)nn!\displaystyle\sum_{n=0}^\infty \frac{(2x)^n}{n!}
Show solution✓ Checked

(a) Here cn=n/4n,c_n = n/4^n\mathclose{\text{,}} and ∣cn+1cn∣=n+14n→14,\abs{\dfrac{c_{n+1}}{c_n}} = \dfrac{n + 1}{4n} \to \dfrac14\mathclose{\text{,}} so R=4.R = 4\mathclose{\text{.}} At x=4x = 4 the terms are n,n\mathclose{\text{,}} and at x=−4x = -4 they are (−1)nn:(-1)^n n\mathclose{\text{:}} in both cases they do not tend to 0, so the series diverges. The interval is (−4,4).(-4, 4)\mathclose{\text{.}}

(b) The centre is −1.-1\mathclose{\text{.}} Here cn=1/nc_n = 1/\sqrt n and ∣cn+1/cn∣=n/(n+1)→1,\abs{c_{n+1}/c_n} = \sqrt{n/(n + 1)} \to 1\mathclose{\text{,}} so R=1:R = 1\mathclose{\text{:}} the series converges absolutely for ∣x+1∣<1,\abs{x + 1} < 1\mathclose{\text{,}} that is, −2<x<0.-2 < x < 0\mathclose{\text{.}} At x=0x = 0 it is ∑1/n,\sum 1/\sqrt n\mathclose{\text{,}} a pp-series with p=12≤1,p = \tfrac12 \le 1\mathclose{\text{,}} which diverges. At x=−2x = -2 it is ∑(−1)n/n,\sum (-1)^n/\sqrt n\mathclose{\text{,}} which converges by the alternating series test, since 1/n1/\sqrt n decreases to 0. The interval is [−2,0).[-2, 0)\mathclose{\text{.}}

(c) Here cn=2n/n!c_n = 2^n/n! and ∣cn+1/cn∣=2n+1→0,\abs{c_{n+1}/c_n} = \dfrac{2}{n + 1} \to 0\mathclose{\text{,}} so R=∞:R = \infty\mathclose{\text{:}} the series converges for every x.x\mathclose{\text{.}} It is the series of e2x.e^{2x}\mathclose{\text{.}}

Exercise 15.2★Series from the geometric series

Find a power series about 0 for each function, and its interval of convergence.

  • (a) 11−3x\dfrac{1}{1 - 3x}
  • (b) x21+x\dfrac{x^2}{1 + x}
  • (c) 14+x2\dfrac{1}{4 + x^2}
Show solution✓ Checked

(a) With u=3x:u = 3x\mathclose{\text{:}} 11−3x=∑3nxn=1+3x+9x2+⋯,\dfrac{1}{1 - 3x} = \sum 3^n x^n = 1 + 3x + 9x^2 + \cdots\mathclose{\text{,}} for ∣3x∣<1,\abs{3x} < 1\mathclose{\text{,}} that is, ∣x∣<13.\abs{x} < \tfrac13\mathclose{\text{.}} At x=±13x = \pm\tfrac13 the terms are (±1)n,(\pm1)^n\mathclose{\text{,}} which do not tend to 0. The interval is (−13,13).\big(-\tfrac13, \tfrac13\big)\mathclose{\text{.}}

(b) Multiply the series of 11+x\dfrac{1}{1 + x} by x2:x^2\mathclose{\text{:}} x21+x=∑(−1)nxn+2=x2−x3+x4−⋯,\dfrac{x^2}{1 + x} = \sum (-1)^n x^{n+2} = x^2 - x^3 + x^4 - \cdots\mathclose{\text{,}} for ∣x∣<1.\abs{x} < 1\mathclose{\text{.}} At x=±1x = \pm1 the terms have size 1, so the interval is (−1,1).(-1, 1)\mathclose{\text{.}}

(c) Take out the factor 4, to make the 1 appear:

14+x2=14⋅11+x2/4=14∑n=0∞(−1)n(x24)n=∑n=0∞(−1)nx2n4n+1,\begin{aligned} \frac{1}{4 + x^2} &= \frac14\cdot\frac{1}{1 + x^2/4} \\ &= \frac14\sum_{n=0}^\infty (-1)^n\Big(\frac{x^2}{4}\Big)^n \\ &= \sum_{n=0}^\infty \frac{(-1)^n x^{2n}}{4^{n+1}}, \end{aligned}

for x2/4<1,x^2/4 < 1\mathclose{\text{,}} that is, ∣x∣<2.\abs{x} < 2\mathclose{\text{.}} At x=±2x = \pm2 the terms are (−1)n/4,(-1)^n/4\mathclose{\text{,}} which do not tend to 0, so the interval is (−2,2).(-2, 2)\mathclose{\text{.}} A test at x=1:x = 1\mathclose{\text{:}} the series is 14−116+164−⋯=1/41+1/4=15,\tfrac14 - \tfrac{1}{16} + \tfrac{1}{64} - \cdots = \dfrac{1/4}{1 + 1/4} = \tfrac15\mathclose{\text{,}} and 14+1=15.\dfrac{1}{4 + 1} = \tfrac15\mathclose{\text{.}}

Exercise 15.3★Estimating cos 0.2
  • (a) Write down the Maclaurin polynomial T4T_4 of cos⁡x.\cos x\mathclose{\text{.}}
  • (b) Use it to estimate cos⁡0.2.\cos 0.2\mathclose{\text{.}}
  • (c) Bound the error with Taylor’s inequality, and compare the bound with the actual error.
Show solution✓ Checked

(a) T4(x)=1−x22+x424.T_4(x) = 1 - \dfrac{x^2}{2} + \dfrac{x^4}{24}\mathclose{\text{.}}

(b) T4(0.2)=1−0.02+0.001624=0.98+0.0000666…≈0.98006667.T_4(0.2) = 1 - 0.02 + \dfrac{0.0016}{24} = 0.98 + 0.0000666\ldots \approx 0.98006667\mathclose{\text{.}}

(c) Every derivative of cos⁡\cos is ±sin⁡\pm\sin or ±cos⁡,\pm\cos\mathclose{\text{,}} so M=1M = 1 will do. The coefficient of x5x^5 is 0, so T4=T5,T_4 = T_5\mathclose{\text{,}} and Taylor’s inequality with n=5n = 5 gives

∣cos⁡0.2−T4(0.2)∣≤0.266!=0.000064720≈8.9×10−8.\begin{aligned} &\abs{\cos 0.2 - T_4(0.2)} \le \frac{0.2^6}{6!} \\ &\quad= \frac{0.000064}{720} \approx 8.9 \times 10^{-8}. \end{aligned}

A calculator gives cos⁡0.2≈0.98006658,\cos 0.2 \approx 0.98006658\mathclose{\text{,}} so the error is about −8.9×10−8:-8.9 \times 10^{-8}\mathclose{\text{:}} the bound is almost exact, because the next term of the series, −x6/720,-x^6/720\mathclose{\text{,}} makes up nearly all of the error. With n=4n = 4 the inequality gives only 0.25/5!≈2.7×10−6,0.2^5/5! \approx 2.7 \times 10^{-6}\mathclose{\text{,}} true but thirty times larger.

Exercise 15.4★New series from old

Use the standard series to find the Maclaurin series of each function, with its first three nonzero terms, and say for which xx it equals the function.

  • (a) x2e−xx^2e^{-x}
  • (b) sin⁡(x2)\sin(x^2)
  • (c) cosh⁡x=12(ex+e−x)\cosh x = \tfrac12(e^x + e^{-x})
Show solution✓ Checked

(a) Put −x-x for xx in the series of ex,e^x\mathclose{\text{,}} then multiply by x2:x^2\mathclose{\text{:}}

x2e−x=x2∑n=0∞(−x)nn!=∑n=0∞(−1)nxn+2n!=x2−x3+x42−⋯ ,\begin{aligned} x^2e^{-x} &= x^2\sum_{n=0}^\infty \frac{(-x)^n}{n!} \\ &= \sum_{n=0}^\infty (-1)^n\frac{x^{n+2}}{n!} \\ &= x^2 - x^3 + \frac{x^4}{2} - \cdots, \end{aligned}

for every x,x\mathclose{\text{,}} since the series of exe^x equals exe^x for every x.x\mathclose{\text{.}}

(b) Put x2x^2 for xx in the series of sin⁡x:\sin x\mathclose{\text{:}}

sin⁡(x2)=∑n=0∞(−1)nx4n+2(2n+1)!=x2−x66+x10120−⋯ ,\begin{aligned} \sin(x^2) &= \sum_{n=0}^\infty (-1)^n\frac{x^{4n+2}}{(2n + 1)!} \\ &= x^2 - \frac{x^6}{6} + \frac{x^{10}}{120} - \cdots, \end{aligned}

for every x.x\mathclose{\text{.}}

(c) Add the series of exe^x and e−x:e^{-x}\mathclose{\text{:}} the term in xnx^n is (1+(−1)n)xnn!,\big(1 + (-1)^n\big)\dfrac{x^n}{n!}\mathclose{\text{,}} which is 0 for odd nn and 2xnn!\dfrac{2x^n}{n!} for even n.n\mathclose{\text{.}} Halving,

cosh⁡x=∑n=0∞x2n(2n)!=1+x22+x424+⋯ ,\begin{aligned} \cosh x &= \sum_{n=0}^\infty \frac{x^{2n}}{(2n)!} \\ &= 1 + \frac{x^2}{2} + \frac{x^4}{24} + \cdots, \end{aligned}

for every x:x\mathclose{\text{:}} the series of cos⁡x\cos x without its minus signs.

Exercise 15.5★★Sums by differentiating

Example 15.6 showed that ∑n=1∞nxn=x(1−x)2\displaystyle\sum_{n=1}^\infty n x^n = \frac{x}{(1 - x)^2} for ∣x∣<1.\abs{x} < 1\mathclose{\text{.}}

  • (a) Find ∑n=1∞n3n.\displaystyle\sum_{n=1}^\infty \frac{n}{3^n}\mathclose{\text{.}}
  • (b) Show that ∑n=1∞n2xn=x(1+x)(1−x)3\displaystyle\sum_{n=1}^\infty n^2x^n = \frac{x(1 + x)}{(1 - x)^3} for ∣x∣<1.\abs{x} < 1\mathclose{\text{.}}
  • (c) Find ∑n=1∞n22n.\displaystyle\sum_{n=1}^\infty \frac{n^2}{2^n}\mathclose{\text{.}}
Show solution✓ Checked

(a) Put x=13:x = \tfrac13\mathclose{\text{:}} 1/3(2/3)2=1/34/9=34.\dfrac{1/3}{(2/3)^2} = \dfrac{1/3}{4/9} = \dfrac34\mathclose{\text{.}}

(b) Differentiate ∑nxn=x(1−x)2\sum n x^n = \dfrac{x}{(1 - x)^2} term by term (Theorem 15.2, inside the radius 1). On the right, by the quotient rule, and then cancelling a factor 1−x:1 - x\mathclose{\text{:}}

ddx x(1−x)2=(1−x)2+2x(1−x)(1−x)4=(1−x)+2x(1−x)3=1+x(1−x)3.\begin{aligned} &\frac{d}{dx}\,\frac{x}{(1 - x)^2} \\ &\quad= \frac{(1 - x)^2 + 2x(1 - x)}{(1 - x)^4} \\ &\quad= \frac{(1 - x) + 2x}{(1 - x)^3} = \frac{1 + x}{(1 - x)^3}. \end{aligned}

On the left the derivative is ∑n2xn−1.\sum n^2 x^{n-1}\mathclose{\text{.}} Multiplying by xx gives ∑n2xn=x(1+x)(1−x)3.\sum n^2 x^n = \dfrac{x(1 + x)}{(1 - x)^3}\mathclose{\text{.}}

(c) At x=12:x = \tfrac12\mathclose{\text{:}} 12⋅32(1/2)3=34⋅8=6.\dfrac{\tfrac12\cdot\tfrac32}{(1/2)^3} = \dfrac34\cdot8 = 6\mathclose{\text{.}}

Exercise 15.6★★Square roots by the binomial series
  • (a) Use the first four terms of the series of 1+x\sqrt{1 + x} (Example 15.10) to estimate 1.1.\sqrt{1.1}\mathclose{\text{.}}
  • (b) Show that, for 0<x<1,0 < x < 1\mathclose{\text{,}} the terms of this series after the first alternate in sign and decrease in size, and use this to bound the error of (a).
  • (c) Estimate 110,\sqrt{110}\mathclose{\text{,}} with an error bound.
Show solution✓ Checked

(a) 1.1≈1+0.12−0.018+0.00116=1+0.05−0.00125+0.0000625=1.0488125.\sqrt{1.1} \approx 1 + \dfrac{0.1}{2} - \dfrac{0.01}{8} + \dfrac{0.001}{16} = 1 + 0.05 - 0.00125 + 0.0000625 = 1.0488125\mathclose{\text{.}}

(b) The ratio of consecutive coefficients is

(1/2n+1)/(1/2n)=12−nn+1,\binom{1/2}{n+1}\Big/\binom{1/2}{n} = \frac{\tfrac12 - n}{n + 1},

which for n≥1n \ge 1 is negative and has size n−12n+1<1.\dfrac{n - \tfrac12}{n + 1} < 1\mathclose{\text{.}} So for 0<x<1,0 < x < 1\mathclose{\text{,}} from the term in xx on, each term has the opposite sign to the one before and is smaller in size (its size is multiplied by n−1/2n+1 x<x<1).\tfrac{n - 1/2}{n + 1}\,x < x < 1\mathclose{\text{).}} Comparing with a geometric sequence of ratio xx shows that the terms tend to 0. By the alternating series bound of Module 14, applied to the series from its second term on, the error is smaller in size than the first term left out. At x=0.1x = 0.1 that size is

∣(1/24)(0.1)4∣=5128(0.1)4=0.00000390625.\begin{aligned} \abs{\binom{1/2}{4}(0.1)^4} &= \frac{5}{128}(0.1)^4 \\ &= 0.00000390625. \end{aligned}

Indeed 1.1≈1.0488088,\sqrt{1.1} \approx 1.0488088\mathclose{\text{,}} and the error of 1.0488125 is about −3.7×10−6.-3.7 \times 10^{-6}\mathclose{\text{.}}

(c) 110=100×1.1=101.1≈10.488125,\sqrt{110} = \sqrt{100 \times 1.1} = 10\sqrt{1.1} \approx 10.488125\mathclose{\text{,}} with an error of size less than 10×0.00000390625=0.0000390625<0.00004.10 \times 0.00000390625 = 0.0000390625 < 0.00004\mathclose{\text{.}} The first omitted term is negative, so the estimate is too large. Thus 110\sqrt{110} lies between 10.488085 and 10.488125, and to four decimal places it is 10.4881 (a calculator gives 10.488088).

Exercise 15.7★★Estimating ln 0.8
  • (a) Use the Maclaurin polynomial T3T_3 of ln⁡(1+x)\ln(1 + x) to estimate ln⁡0.8.\ln 0.8\mathclose{\text{.}}
  • (b) Bound the error with Taylor’s inequality.
  • (c) Why can you not use the alternating series bound here? Compare the bound of (b) with the actual error.
Show solution✓ Checked

(a) T3(x)=x−x22+x33T_3(x) = x - \dfrac{x^2}{2} + \dfrac{x^3}{3} and 0.8=1+x0.8 = 1 + x with x=−0.2,x = -0.2\mathclose{\text{,}} so

T3(−0.2)=−0.2−0.042−0.0083=−15−150−1375=−167750≈−0.2226667.\begin{aligned} &T_3(-0.2) = -0.2 - \frac{0.04}{2} - \frac{0.008}{3} \\ &\quad= -\frac15 - \frac1{50} - \frac1{375} \\ &\quad= -\frac{167}{750} \approx -0.2226667. \end{aligned}

So ln⁡0.8≈−0.2226667.\ln 0.8 \approx -0.2226667\mathclose{\text{.}} The bound below applies to the exact polynomial value −167/750-167/750 before rounding.

(b) The derivatives of f(x)=ln⁡(1+x)f(x) = \ln(1 + x) are 11+x,\dfrac{1}{1 + x}\mathclose{\text{,}} −1(1+x)2,-\dfrac{1}{(1 + x)^2}\mathclose{\text{,}} 2(1+x)3\dfrac{2}{(1 + x)^3} and f(4)(x)=−6(1+x)4.f^{(4)}(x) = -\dfrac{6}{(1 + x)^4}\mathclose{\text{.}} For tt between −0.2-0.2 and 0, 1+t≥0.8,1 + t \ge 0.8\mathclose{\text{,}} so ∣f(4)(t)∣≤60.84=14.6484375,\abs{f^{(4)}(t)} \le \dfrac{6}{0.8^4} = 14.6484375\mathclose{\text{,}} and

∣ln⁡0.8−T3(−0.2)∣≤14.64843754! (0.2)4≈0.00098.\begin{aligned} &\abs{\ln 0.8 - T_3(-0.2)} \\ &\quad\le \frac{14.6484375}{4!}\,(0.2)^4 \\ &\quad\approx 0.00098. \end{aligned}

(c) At x=−0.2x = -0.2 every term of the series, −15−150−1375−12500−⋯,-\tfrac15 - \tfrac1{50} - \tfrac1{375} - \tfrac1{2500} - \cdots\mathclose{\text{,}} is negative: the series does not alternate, so the alternating series bound does not apply. It would have claimed an error of size less than the next term’s size, 0.0004, which is false: ln⁡0.8≈−0.2231436,\ln 0.8 \approx -0.2231436\mathclose{\text{,}} and the error is about −0.00048.-0.00048\mathclose{\text{.}} Taylor’s inequality, which needs no alternating signs, gives the safe bound 0.00098. The Lagrange form even gives the sign: f(4)<0,f^{(4)} < 0\mathclose{\text{,}} so R3<0R_3 < 0 and T3T_3 overestimates.

Exercise 15.8★★Limits by series

Use series to find each limit.

  • (a) lim⁡x→0ex−1−x−x2/2x3\displaystyle\lim_{x\to0}\frac{e^x - 1 - x - x^2/2}{x^3}
  • (b) lim⁡x→0x−arctan⁡xx3\displaystyle\lim_{x\to0}\frac{x - \arctan x}{x^3}
  • (c) lim⁡x→0ex2−cos⁡xx2\displaystyle\lim_{x\to0}\frac{e^{x^2} - \cos x}{x^2}
Show solution✓ Checked

(a) ex=1+x+x22+x36+O(x4),e^x = 1 + x + \dfrac{x^2}{2} + \dfrac{x^3}{6} + O(x^4)\mathclose{\text{,}} so the numerator is x36+O(x4),\dfrac{x^3}{6} + O(x^4)\mathclose{\text{,}} and the quotient is 16+O(x)→16.\dfrac16 + O(x) \to \dfrac16\mathclose{\text{.}}

(b) arctan⁡x=x−x33+O(x5)\arctan x = x - \dfrac{x^3}{3} + O(x^5) (for ∣x∣≤12,\abs{x} \le \tfrac12\mathclose{\text{,}} say, the alternating series bound makes the error’s size at most ∣x∣5/5).\abs{x}^5/5\mathclose{\text{).}} So x−arctan⁡x=x33+O(x5),x - \arctan x = \dfrac{x^3}{3} + O(x^5)\mathclose{\text{,}} and the limit is 13.\dfrac13\mathclose{\text{.}}

(c) Substitute x2x^2 in eu=1+u+O(u2):e^u = 1 + u + O(u^2)\mathclose{\text{:}} ex2=1+x2+O(x4).e^{x^2} = 1 + x^2 + O(x^4)\mathclose{\text{.}} And cos⁡x=1−x22+O(x4).\cos x = 1 - \dfrac{x^2}{2} + O(x^4)\mathclose{\text{.}} So ex2−cos⁡x=32x2+O(x4),e^{x^2} - \cos x = \dfrac32x^2 + O(x^4)\mathclose{\text{,}} and the limit is 32.\dfrac32\mathclose{\text{.}} Stopping at the first terms, ex2≈1e^{x^2} \approx 1 and cos⁡x≈1,\cos x \approx 1\mathclose{\text{,}} would leave 0/x20/x^2 and the wrong answer 0: keep terms up to the order of the denominator.

Exercise 15.9★★Trigonometry from Euler’s formula
  • (a) Use (eiθ)2=e2iθ\big(e^{i\theta}\big)^2 = e^{2i\theta} to find formulas for cos⁡2θ\cos 2\theta and sin⁡2θ.\sin 2\theta\mathclose{\text{.}}
  • (b) Use (eiθ)3=e3iθ\big(e^{i\theta}\big)^3 = e^{3i\theta} to show that cos⁡3θ=4cos⁡3θ−3cos⁡θ\cos 3\theta = 4\cos^3\theta - 3\cos\theta and sin⁡3θ=3sin⁡θ−4sin⁡3θ.\sin 3\theta = 3\sin\theta - 4\sin^3\theta\mathclose{\text{.}}
  • (c) Use cos⁡θ=12(eiθ+e−iθ)\cos\theta = \tfrac12\big(e^{i\theta} + e^{-i\theta}\big) to show that cos⁡2θ=12(1+cos⁡2θ),\cos^2\theta = \tfrac12(1 + \cos 2\theta)\mathclose{\text{,}} the identity behind ∫cos⁡2θ dθ\int\cos^2\theta\,d\theta in Module 11.
Show solution✓ Checked

Write c=cos⁡θc = \cos\theta and s=sin⁡θ,s = \sin\theta\mathclose{\text{,}} so that eiθ=c+is.e^{i\theta} = c + is\mathclose{\text{.}}

(a) (c+is)2=c2+2ics+i2s2=(c2−s2)+i 2sc.(c + is)^2 = c^2 + 2ics + i^2s^2 = (c^2 - s^2) + i\,2sc\mathclose{\text{.}} And e2iθ=cos⁡2θ+isin⁡2θ.e^{2i\theta} = \cos 2\theta + i\sin 2\theta\mathclose{\text{.}} Equal complex numbers have equal real parts and equal imaginary parts, so cos⁡2θ=cos⁡2θ−sin⁡2θ\cos 2\theta = \cos^2\theta - \sin^2\theta and sin⁡2θ=2sin⁡θcos⁡θ.\sin 2\theta = 2\sin\theta\cos\theta\mathclose{\text{.}}

(b) Expand the cube, with i2=−1i^2 = -1 and i3=−i:i^3 = -i\mathclose{\text{:}}

(c+is)3=c3+3ic2s−3cs2−is3=(c3−3cs2)+i(3c2s−s3).\begin{aligned} (c + is)^3 &= c^3 + 3ic^2s \\ &\quad - 3cs^2 - is^3 \\ &= (c^3 - 3cs^2) \\ &\quad + i(3c^2s - s^3). \end{aligned}

With s2=1−c2,s^2 = 1 - c^2\mathclose{\text{,}} the real part is c3−3c(1−c2)=4c3−3c;c^3 - 3c(1 - c^2) = 4c^3 - 3c\mathclose{\text{;}} with c2=1−s2,c^2 = 1 - s^2\mathclose{\text{,}} the imaginary part is 3(1−s2)s−s3=3s−4s3.3(1 - s^2)s - s^3 = 3s - 4s^3\mathclose{\text{.}} Comparing with e3iθ=cos⁡3θ+isin⁡3θe^{3i\theta} = \cos 3\theta + i\sin 3\theta gives both formulas.

(c) Square, using eiθe−iθ=e0=1:e^{i\theta}e^{-i\theta} = e^0 = 1\mathclose{\text{:}}

cos⁡2θ=e2iθ+2+e−2iθ4=12+12⋅e2iθ+e−2iθ2=12(1+cos⁡2θ).\begin{aligned} \cos^2\theta &= \frac{e^{2i\theta} + 2 + e^{-2i\theta}}{4} \\ &= \frac12 + \frac12\cdot\frac{e^{2i\theta} + e^{-2i\theta}}{2} \\ &= \frac12(1 + \cos 2\theta). \end{aligned}
Exercise 15.10★★★The number e is irrational

Suppose, to the contrary, that e=p/qe = p/q for whole numbers pp and q≥1.q \ge 1\mathclose{\text{.}} Since also e=2p/(2q),e = 2p/(2q)\mathclose{\text{,}} you may assume that q≥2.q \ge 2\mathclose{\text{.}} Let sq=∑k=0q1/k!.s_q = \sum_{k=0}^{q} 1/k!\mathclose{\text{.}}

  • (a) Show that q! (e−sq)q!\,(e - s_q) is a whole number.
  • (b) Use the bound 0<e−sn<3(n+1)!0 < e - s_n < \dfrac{3}{(n + 1)!} of Section 15.6 to show that 0<q! (e−sq)<1.0 < q!\,(e - s_q) < 1\mathclose{\text{.}}
  • (c) Conclude that ee is irrational.
Show solution✓ Checked

(a) q! e=q! pq=p (q−1)!,q!\,e = q!\,\dfrac{p}{q} = p\,(q - 1)!\mathclose{\text{,}} a whole number. And q! sq=∑k=0qq!k!,q!\,s_q = \sum_{k=0}^{q} \dfrac{q!}{k!}\mathclose{\text{,}} where each q!k!=(k+1)(k+2)⋯q\dfrac{q!}{k!} = (k + 1)(k + 2)\cdots q (or 1, when k=q)k = q\mathclose{\text{)}} is a whole number. So q! (e−sq)q!\,(e - s_q) is the difference of two whole numbers: a whole number.

(b) Multiply 0<e−sq<3(q+1)!0 < e - s_q < \dfrac{3}{(q + 1)!} by q!:q!\mathclose{\text{:}}

0<q! (e−sq)<3 q!(q+1)!=3q+1≤1,\begin{aligned} 0 < q!\,(e - s_q) &< \frac{3\,q!}{(q + 1)!} \\ &= \frac{3}{q + 1} \le 1, \end{aligned}

since q≥2.q \ge 2\mathclose{\text{.}}

(c) By (a) and (b), q! (e−sq)q!\,(e - s_q) is a whole number strictly between 0 and 1. There is no such number, so the assumption e=p/qe = p/q is false: ee is irrational. The proof works because the series of ee converges so fast that the error after the term 1/q!1/q! is too small to be a multiple of 1/q!.1/q!\mathclose{\text{.}}

Exercise 15.11★★★Machin’s formula

Let α=arctan⁡15.\alpha = \arctan\tfrac15\mathclose{\text{.}} Use the formula tan⁡(u+v)=tan⁡u+tan⁡v1−tan⁡utan⁡v,\tan(u + v) = \dfrac{\tan u + \tan v}{1 - \tan u\tan v}\mathclose{\text{,}} which follows from the addition formulas of Module 1.

  • (a) Show that tan⁡2α=512\tan 2\alpha = \tfrac{5}{12} and tan⁡4α=120119.\tan 4\alpha = \tfrac{120}{119}\mathclose{\text{.}}
  • (b) Show that tan⁡(4α−π4)=1239,\tan\big(4\alpha - \tfrac{\pi}{4}\big) = \tfrac{1}{239}\mathclose{\text{,}} and conclude that π4=4arctan⁡15−arctan⁡1239.\dfrac{\pi}{4} = 4\arctan\dfrac15 - \arctan\dfrac{1}{239}\mathclose{\text{.}}
  • (c) In Section 15.6, a bound of 111⋅511\tfrac{1}{11\cdot5^{11}} on the error’s size in arctan⁡15\arctan\tfrac15 became a bound 16 times as large for its contribution to the error in π.\pi\mathclose{\text{.}} How many terms of the series of arctan⁡15\arctan\tfrac15 make that contribution smaller than 10−1210^{-12} in size?
Show solution✓ Checked

(a) With u=v,u = v\mathclose{\text{,}} the formula gives tan⁡2u=2tan⁡u1−tan⁡2u.\tan 2u = \dfrac{2\tan u}{1 - \tan^2u}\mathclose{\text{.}} So

tan⁡2α=2/51−1/25=512,tan⁡4α=10/121−25/144=120119.\begin{aligned} \tan 2\alpha &= \frac{2/5}{1 - 1/25} = \frac{5}{12}, \\ \tan 4\alpha &= \frac{10/12}{1 - 25/144} = \frac{120}{119}. \end{aligned}

(b) With −v-v in place of v,v\mathclose{\text{,}} and tan⁡(−v)=−tan⁡v,\tan(-v) = -\tan v\mathclose{\text{,}} the formula gives tan⁡(u−v)=tan⁡u−tan⁡v1+tan⁡utan⁡v.\tan(u - v) = \dfrac{\tan u - \tan v}{1 + \tan u\tan v}\mathclose{\text{.}} With u=4αu = 4\alpha and v=π4,v = \tfrac{\pi}{4}\mathclose{\text{,}} where tan⁡π4=1:\tan\tfrac{\pi}{4} = 1\mathclose{\text{:}}

tan⁡(4α−π4)=120/119−11+120/119=1/119239/119=1239.\begin{aligned} &\tan\Big(4\alpha - \frac{\pi}{4}\Big) \\ &\quad= \frac{120/119 - 1}{1 + 120/119} \\ &\quad= \frac{1/119}{239/119} = \frac{1}{239}. \end{aligned}

To conclude that 4α−π4=arctan⁡1239,4\alpha - \tfrac{\pi}{4} = \arctan\tfrac{1}{239}\mathclose{\text{,}} the angle must lie in (−π2,π2),\big(-\tfrac{\pi}{2}, \tfrac{\pi}{2}\big)\mathclose{\text{,}} the range of arctan⁡\arctan (Module 6). For x>0,x > 0\mathclose{\text{,}} arctan⁡x=∫0xdt1+t2<∫0xdt=x,\arctan x = \int_0^x \dfrac{dt}{1 + t^2} < \int_0^x dt = x\mathclose{\text{,}} so 0<α<15,0 < \alpha < \tfrac15\mathclose{\text{,}} and −π4<4α−π4<45−π4<π2.-\tfrac{\pi}{4} < 4\alpha - \tfrac{\pi}{4} < \tfrac45 - \tfrac{\pi}{4} < \tfrac{\pi}{2}\mathclose{\text{.}} So 4α−π4=arctan⁡1239,4\alpha - \tfrac{\pi}{4} = \arctan\tfrac{1}{239}\mathclose{\text{,}} which rearranges to Machin’s formula.

(c) With nn terms the error in arctan⁡15\arctan\tfrac15 is smaller in size than the first omitted term’s size, (1/5)2n+12n+1.\dfrac{(1/5)^{2n+1}}{2n + 1}\mathclose{\text{.}} Its contribution to the error in π\pi is smaller in size than 16 times that; the arctan⁡(1/239)\arctan(1/239) approximation has its own error. For n=8,n = 8\mathclose{\text{,}} 16⋅5−1717≈1.2×10−12,16\cdot\dfrac{5^{-17}}{17} \approx 1.2 \times 10^{-12}\mathclose{\text{,}} so this bound does not suffice; for n=9,n = 9\mathclose{\text{,}} 16⋅5−1919≈4.4×10−14.16\cdot\dfrac{5^{-19}}{19} \approx 4.4 \times 10^{-14}\mathclose{\text{.}} So 9 terms suffice.

Exercise 15.12★★★Newton’s method converges quadratically

Prove Theorem 7.3. Let f(r)=0,f(r) = 0\mathclose{\text{,}} let f′f' and f′′f'' be continuous on an open interval containing r,r\mathclose{\text{,}} and let f′(r)≠0.f'(r) \ne 0\mathclose{\text{.}}

  • (a) Show that there are numbers δ>0\delta > 0 and K≥0K \ge 0 with Kδ≤12K\delta \le \tfrac12 such that f′(x)≠0f'(x) \ne 0 and ∣f′′(c)2f′(x)∣≤K\abs{\dfrac{f''(c)}{2f'(x)}} \le K for all xx and cc in [r−δ,r+δ].[r - \delta, r + \delta]\mathclose{\text{.}}
  • (b) Using the identity en+1=f′′(cn)2f′(xn) en2e_{n+1} = \dfrac{f''(c_n)}{2f'(x_n)}\,e_n^2 of Section 15.5, show that if ∣x0−r∣≤δ,\abs{x_0 - r} \le \delta\mathclose{\text{,}} then ∣en+1∣≤12∣en∣\abs{e_{n+1}} \le \tfrac12\abs{e_n} for every n,n\mathclose{\text{,}} so that xn→r.x_n \to r\mathclose{\text{.}}
  • (c) Deduce that en+1/en2→f′′(r)/(2f′(r)),e_{n+1}/e_n^2 \to f''(r)/\big(2f'(r)\big)\mathclose{\text{,}} if no xnx_n equals r.r\mathclose{\text{.}}
Show solution✓ Checked

(a) Since f′f' is continuous at rr and f′(r)≠0,f'(r) \ne 0\mathclose{\text{,}} there is a δ1>0\delta_1 > 0 such that ∣f′(x)−f′(r)∣<12∣f′(r)∣,\abs{f'(x) - f'(r)} < \tfrac12\abs{f'(r)}\mathclose{\text{,}} and so ∣f′(x)∣>12∣f′(r)∣>0,\abs{f'(x)} > \tfrac12\abs{f'(r)} > 0\mathclose{\text{,}} for ∣x−r∣≤δ1\abs{x - r} \le \delta_1 (taking δ1\delta_1 so small that this closed interval lies in the open interval of the hypothesis). On the closed interval [r−δ1,r+δ1][r - \delta_1, r + \delta_1] the continuous function ∣f′′∣\abs{f''} has a largest value B,B\mathclose{\text{,}} by the Extreme Value Theorem (Module 3). So for xx and cc in that interval

∣f′′(c)2f′(x)∣≤B2⋅12∣f′(r)∣=B∣f′(r)∣=K.\begin{aligned} \abs{\frac{f''(c)}{2f'(x)}} &\le \frac{B}{2\cdot\tfrac12\abs{f'(r)}} \\ &= \frac{B}{\abs{f'(r)}} = K. \end{aligned}

If K=0,K = 0\mathclose{\text{,}} take δ=δ1;\delta = \delta_1\mathclose{\text{;}} otherwise take δ\delta the smaller of δ1\delta_1 and 12K.\dfrac{1}{2K}\mathclose{\text{.}} A smaller interval keeps both properties, and Kδ≤12.K\delta \le \tfrac12\mathclose{\text{.}}

(b) Use Module 7’s convention en=xn−r,e_n = x_n - r\mathclose{\text{,}} the reverse of exact value minus approximation. By induction on n,n\mathclose{\text{,}} show that ∣en∣≤δ\abs{e_n} \le \delta and that xn+1x_{n+1} is defined, with ∣en+1∣≤12∣en∣.\abs{e_{n+1}} \le \tfrac12\abs{e_n}\mathclose{\text{.}} Suppose ∣en∣≤δ,\abs{e_n} \le \delta\mathclose{\text{,}} as is true for n=0.n = 0\mathclose{\text{.}} Then xnx_n lies in [r−δ,r+δ],[r - \delta, r + \delta]\mathclose{\text{,}} so f′(xn)≠0f'(x_n) \ne 0 and Newton’s step gives xn+1.x_{n+1}\mathclose{\text{.}} If xn=r,x_n = r\mathclose{\text{,}} every later iterate is r,r\mathclose{\text{,}} and the bound holds with both sides 0. Otherwise the identity holds with cnc_n between xnx_n and r,r\mathclose{\text{,}} hence also in the interval, so

∣en+1∣≤Ken2=(K∣en∣) ∣en∣≤Kδ ∣en∣≤12∣en∣≤δ.\begin{aligned} \abs{e_{n+1}} &\le K e_n^2 = (K\abs{e_n})\,\abs{e_n} \\ &\le K\delta\,\abs{e_n} \le \tfrac12\abs{e_n} \le \delta. \end{aligned}

So ∣en∣≤δ/2n\abs{e_n} \le \delta/2^n for every n,n\mathclose{\text{,}} which tends to 0: xn→r.x_n \to r\mathclose{\text{.}}

(c) en+1en2=f′′(cn)2f′(xn).\dfrac{e_{n+1}}{e_n^2} = \dfrac{f''(c_n)}{2f'(x_n)}\mathclose{\text{.}} As n→∞,n \to \infty\mathclose{\text{,}} xn→r,x_n \to r\mathclose{\text{,}} and cn,c_n\mathclose{\text{,}} which lies between xnx_n and r,r\mathclose{\text{,}} tends to rr too, by the squeeze theorem. Since f′′f'' and f′f' are continuous at rr and f′(r)≠0,f'(r) \ne 0\mathclose{\text{,}} the quotient tends to f′′(r)2f′(r).\dfrac{f''(r)}{2f'(r)}\mathclose{\text{.}} For f(x)=x2−2f(x) = x^2 - 2 this is 242=122≈0.354,\dfrac{2}{4\sqrt2} = \dfrac{1}{2\sqrt2} \approx 0.354\mathclose{\text{,}} the constant of Example 7.9.

10

Check yourself

1
The radius of convergence of ∑n=1∞xnn 3n\displaystyle\sum_{n=1}^\infty \frac{x^n}{n\,3^n} is
2
The interval of convergence of ∑n=1∞(x−2)nn\displaystyle\sum_{n=1}^\infty \frac{(x - 2)^n}{n} is
3
The coefficient of x4x^4 in the Maclaurin series of e2xe^{2x} is
4
The Maclaurin series of 11+x2,\dfrac{1}{1 + x^2}\mathclose{\text{,}} and where it converges, are
5
If f(1)=2,f(1) = 2\mathclose{\text{,}} f′(1)=3f'(1) = 3 and f′′(1)=4,f''(1) = 4\mathclose{\text{,}} the Taylor polynomial T2T_2 of ff about 1 is
6
Using T3=T4T_3 = T_4 for sin⁡x,\sin x\mathclose{\text{,}} which bound does Taylor’s inequality with n=4n = 4 and M=1M = 1 give for ∣sin⁡0.1−(0.1−0.136)∣?\abs{\sin 0.1 - \big(0.1 - \dfrac{0.1^3}{6}\big)}\mathclose{\text{?}}
7
lim⁡x→0x−sin⁡xx3\displaystyle\lim_{x\to0}\frac{x - \sin x}{x^3} equals
8
By Euler’s formula, eiπ/2e^{i\pi/2} equals
Finished this module?