MAT1052 · Week 6 · Taylor Series, Vectors, Dot Product

Applications of Taylor series: approximation, error, limits, sums

You learn to approximate numerical values with a Taylor polynomial, to bound the error with Taylor's inequality and the alternating series estimate, to compute limits and integrals with series, and the binomial series.

Taylor's theoremremainderLagrange error boundTaylor's inequalityalternating series estimationbinomial seriesapproximationMaclaurin series

Last week you learned to write the Taylor series. This week we put it to work: computing a number approximately by hand, bounding the error of that approximation provably, solving in one line limits for which L’Hôpital would take long, matching a series with an unknown sum to a familiar function, and computing numerically integrals that have no antiderivative. The exam most often has “approximate with error less than …” and “use series to evaluate the limit” questions.

Golden rules:

  1. Approximation == Taylor polynomial. Error == the part that was dropped.
  2. If the series is alternating and decreasing, the error is smaller than the first dropped term. This is the easiest bound, try it first.
  3. If it is not alternating, Taylor’s inequality (the Lagrange error bound) is used; for MM, estimate the largest value of the derivative on the interval.
  4. In a limit, expand the numerator and denominator into series and cancel the lowest-degree term.

Taylor’s theorem and the remainder term

If ff is n+1n+1 times differentiable near aa, there is a cc between aa and xx such that

f(x)=Pn(x)+Rn(x),Rn(x)=f(n+1)(c)(n+1)!(x−a)n+1.f(x) = P_n(x)+R_n(x),\qquad R_n(x) = \frac{f^{(n+1)}(c)}{(n+1)!}(x-a)^{n+1}.

RnR_n is called the remainder. We do not know cc, but we can bound the derivative.

Taylor’s inequality. If ∣f(n+1)(t)∣≤M\lvert f^{(n+1)}(t)\rvert\le M between aa and xx, then

∣Rn(x)∣≤M(n+1)!∣x−a∣n+1.\lvert R_n(x)\rvert\le\frac{M}{(n+1)!}\lvert x-a\rvert^{n+1}.

Intuition. The remainder is very much like the next term to be added to the polynomial; only the derivative is evaluated at an unknown point cc instead of aa. So you can think of it as “the worst case of the next term”.

Example 1. Compute e0.1e^{0.1} with P3P_3 and bound the error.

P3(0.1)=1+0.1+0.012+0.0016=1.1051667.P_3(0.1) = 1+0.1+\frac{0.01}{2}+\frac{0.001}{6} = 1.1051667.

f(4)(t)=etf^{(4)}(t) = e^t, whose largest value on [0,0.1][0,0.1] is e0.1<3e^{0.1}<3 (crude but safe). M=3M=3:

∣R3∣≤34!(0.1)4=0.000324=1.25×10−5.\lvert R_3\rvert\le\frac{3}{4!}(0.1)^4 = \frac{0.0003}{24} = 1.25\times10^{-5}.

The true value is 1.10517091.1051709, the actual error is 4.3×10−64.3\times10^{-6}, below the bound.

PITFALL · choosing M. MM must be the largest absolute value of the derivative between aa and xx. Choosing M=e0=1M=e^0=1 for ete^t is wrong; the function is increasing, and the largest value is at the right end. Putting in place of an unknown value (e0.1e^{0.1}) a simple number that exceeds it (3) is allowed.

Alternating series estimate

If the value of xx makes the series alternating and decreasing, the job is much easier: ∣Rn∣<∣first dropped term∣\lvert R_n\rvert<\lvert\text{first dropped term}\rvert.

Example 2. Compute ln⁡(1.2)\ln(1.2) with three terms of ln⁡(1+x)=x−x22+x33−…\ln(1+x) = x-\frac{x^2}{2}+\frac{x^3}{3}-\dots

0.2−0.042+0.0083=0.1826667.0.2-\frac{0.04}{2}+\frac{0.008}{3} = 0.1826667.

The error is <(0.2)44=0.0004<\dfrac{(0.2)^4}{4} = 0.0004. The true value is ln⁡1.2=0.1823216\ln1.2 = 0.1823216, the error is 0.0003450.000345.

“How many terms are needed?” questions

Find the smallest nn that brings the error bound below the desired tolerance. In the alternating case you compute the dropped terms in order; in Taylor’s inequality you solve the inequality M∣x−a∣n+1(n+1)!<ε\dfrac{M\lvert x-a\rvert^{n+1}}{(n+1)!}<\varepsilon by trying n=1,2,3,…n=1,2,3,\dots

Example 2b. How many terms are needed to compute sin⁡(0.5)\sin(0.5) with an error smaller than 10−610^{-6}? sin⁡x=x−x33!+x55!−x77!+…\sin x = x-\frac{x^3}{3!}+\frac{x^5}{5!}-\frac{x^7}{7!}+\dots is alternating and decreasing for x=0.5x=0.5. Compute the terms in order:

x^3/3! = 0.125/6        = 0.0208333
x^5/5! = 0.03125/120    = 0.0002604
x^7/7! = 0.0078125/5040 = 0.0000015500   > 1e-6
x^9/9! = 0.00195/362880 = 0.0000000054   < 1e-6

The term x9/9!x^9/9! is the first to drop below 10−610^{-6}. So you have to take the four terms before it (xx, x3x^3, x5x^5, x7x^7): 0.5−0.0208333+0.0002604−0.0000016=0.47942550.5-0.0208333+0.0002604-0.0000016 = 0.4794255. The true value is sin⁡0.5=0.4794255\sin0.5 = 0.4794255.

Example 2c (with Taylor’s inequality). If you use cos⁡x\cos x with P2=1−x22P_2 = 1-\frac{x^2}{2} on the interval ∣x∣≤0.1\lvert x\rvert\le0.1, what is the largest the error can be? The derivatives of cos⁡\cos are ±sin⁡\pm\sin, ±cos⁡\pm\cos, all bounded by 11, M=1M=1. But note: there is no x3x^3 term in the series of cos⁡\cos, so P2=P3P_2 = P_3. The bound is better with n=3n=3: ∣R3∣≤14!(0.1)4≈4.2×10−6\lvert R_3\rvert\le\dfrac{1}{4!}(0.1)^4\approx4.2\times10^{-6}. Even if the exam says “use P2P_2”, if you notice that it equals P3P_3 you can write a sharper bound; but the bound given with n=2n=2 ((0.1)36≈1.7×10−4\frac{(0.1)^3}{6}\approx1.7\times10^{-4}) is also correct, just cruder.

Intuition: how does the polynomial hug the curve?

Imagine drawing P1=1+xP_1 = 1+x (the tangent line), P2P_2, P3P_3 next to the graph of exe^x. Near x=0x=0 they all sit almost on the curve. As xx grows, first P1P_1 separates, then P2P_2, then P3P_3. The factor ∣x−a∣n+1\lvert x-a\rvert^{n+1} in the error formula says exactly this: as the distance from the center grows, the error grows quickly, while the (n+1)!(n+1)! in the denominator crushes the error as the number of terms increases. The practical conclusion: always make the approximation at a point close to the center. For ln⁡(1.2)\ln(1.2) the series of ln⁡(1+x)\ln(1+x) is suitable; for ln⁡5\ln5 the same series does not work at all, because x=4x=4 is outside the interval.

Limits with series

In 0/00/0 limits that would need L’Hôpital several times, expanding with series is faster and less error-prone.

Example 3. lim⁡x→0x−sin⁡xx3=lim⁡x−(x−x36+… )x3=lim⁡(16−x2120+… )=16.\displaystyle\lim_{x\to0}\frac{x-\sin x}{x^3} = \lim\frac{x-\left(x-\frac{x^3}{6}+\dots\right)}{x^3} = \lim\left(\frac16-\frac{x^2}{120}+\dots\right) = \frac16.

Example 4. lim⁡x→0sin⁡(x2)1−cos⁡x\displaystyle\lim_{x\to0}\frac{\sin(x^2)}{1-\cos x}. Numerator: x2−x66+…x^2-\frac{x^6}{6}+\dots Denominator: x22−x424+…\frac{x^2}{2}-\frac{x^4}{24}+\dots Divide both by x2x^2: 1−…12−…→2\dfrac{1-\dots}{\frac12-\dots}\to2.

Rule: in the numerator and denominator, expand up to the lowest-degree nonzero term, that is enough.

Finding sums with series

See a number series as a particular value of xx in a familiar Maclaurin series.

The series you seeFamiliar patternSum
∑1n!\sum\frac{1}{n!}exe^x, x=1x=1ee
∑(−1)n2n+1\sum\frac{(-1)^n}{2n+1}arctan⁡x\arctan x, x=1x=1π4\frac\pi4
∑n≥11n2n\sum_{n\ge1}\frac{1}{n2^n}−ln⁡(1−x)-\ln(1-x), x=12x=\frac12ln⁡2\ln2
∑(−1)nx2n+1(2n+1)!\sum\frac{(-1)^nx^{2n+1}}{(2n+1)!}sin⁡x\sin xsin⁡x\sin x

Tip: if there is n!n! in the denominator think of exe^x, if (2n)!(2n)! think of cos⁡\cos, if (2n+1)!(2n+1)! think of sin⁡\sin, if only nn think of ln⁡\ln, if 2n+12n+1 think of arctan⁡\arctan.

Integrals with series

∫01sin⁡(x2)dx\int_0^1\sin(x^2)dx cannot be computed with elementary functions. Expand into a series:

sin⁡(x2)=x2−x63!+x105!−…⇒∫01sin⁡(x2)dx=13−142+11320−175600+…\sin(x^2) = x^2-\frac{x^6}{3!}+\frac{x^{10}}{5!}-\dots\quad\Rightarrow\quad\int_0^1\sin(x^2)dx = \frac13-\frac{1}{42}+\frac{1}{1320}-\frac{1}{75600}+\dots

Alternating and decreasing. The first three terms give 0.31028140.3102814, with error <175600≈1.3×10−5<\frac{1}{75600}\approx1.3\times10^{-5}. Four terms give 0.31026820.3102682.

The binomial series

For every real kk and ∣x∣<1\lvert x\rvert<1

(1+x)k=∑n=0∞(kn)xn=1+kx+k(k−1)2!x2+k(k−1)(k−2)3!x3+…(1+x)^k = \sum_{n=0}^\infty\binom kn x^n = 1+kx+\frac{k(k-1)}{2!}x^2+\frac{k(k-1)(k-2)}{3!}x^3+\dots

If kk is a positive integer the series terminates (the binomial expansion you know). Otherwise it is infinite.

Example 5. 11.1\dfrac{1}{\sqrt{1.1}}: k=−12k = -\frac12, x=0.1x = 0.1. 1−12(0.1)+(−12)(−32)2(0.01)=1−0.05+0.00375=0.953751-\frac12(0.1)+\frac{(-\frac12)(-\frac32)}{2}(0.01) = 1-0.05+0.00375 = 0.95375. The true value is 0.953460.95346.

Common mistakes

WrongCorrect
Writing (x−a)n(x-a)^n in the error boundThe power is n+1n+1, the denominator is (n+1)!(n+1)!
Taking MM as the derivative at the point aaThe largest ∣f(n+1)∣\lvert f^{(n+1)}\rvert on the interval
Alternating estimate on a positive-term seriesOnly if the sign alternates and it decreases
Expanding too few terms in a limitExpand up to the lowest-degree nonzero term
Saying 2e2e for ∑2nn!\sum\frac{2^n}{n!}Plug in x=2x=2: e2e^2
Calculating in degree modeSeries work with radians
Forgetting n!n! in the binomial coefficientk(k−1)2!\frac{k(k-1)}{2!}, k(k−1)(k−2)3!\frac{k(k-1)(k-2)}{3!}
Using the series outside its intervalx=2x=2 is invalid for ln⁡(1+x)\ln(1+x)

Test yourself

Exam-style questions. Solve them on paper first, then reveal the answer.

Question 1easy

Use Maclaurin series to evaluate lim⁡x→0sin⁡x−xx3\displaystyle\lim_{x\to0}\frac{\sin x - x}{x^3}.

Show answer
−1/6-1/6

sin⁡x=x−x36+x5120−…\sin x = x-\dfrac{x^3}{6}+\dfrac{x^5}{120}-\dots, so sin⁡x−x=−x36+x5120−…\sin x - x = -\dfrac{x^3}{6}+\dfrac{x^5}{120}-\dotsDivide by x3x^3: −16+x2120−⋯→−16-\dfrac16+\dfrac{x^2}{120}-\dots\to-\dfrac16.

Question 2easy

Evaluate lim⁡x→0ex−1−x−x22x3\displaystyle\lim_{x\to0}\frac{e^x-1-x-\frac{x^2}{2}}{x^3}.

Show answer
1/61/6

In the series of exe^x the first three terms cancel in the numerator, and what remains is x36+x424+…\dfrac{x^3}{6}+\dfrac{x^4}{24}+\dotsDivide by x3x^3: 16+x24+⋯→16\dfrac16+\dfrac{x}{24}+\dots\to\dfrac16.

Question 3medium

Evaluate lim⁡x→0cos⁡x−1+x22x4\displaystyle\lim_{x\to0}\frac{\cos x - 1 + \frac{x^2}{2}}{x^4}.

Show answer
1/241/24

cos⁡x=1−x22+x424−x6720+…\cos x = 1-\dfrac{x^2}{2}+\dfrac{x^4}{24}-\dfrac{x^6}{720}+\dots The numerator =x424−x6720+…=\dfrac{x^4}{24}-\dfrac{x^6}{720}+\dotsDivided by x4x^4 it gives 124\dfrac{1}{24}. (With L'Hôpital, four derivatives would have been needed.)

Question 4medium

Evaluate lim⁡x→0ln⁡(1+x)−xx2\displaystyle\lim_{x\to0}\frac{\ln(1+x)-x}{x^2}.

Show answer
−1/2-1/2

ln⁡(1+x)=x−x22+x33−…\ln(1+x) = x-\dfrac{x^2}{2}+\dfrac{x^3}{3}-\dots The numerator =−x22+x33−…= -\dfrac{x^2}{2}+\dfrac{x^3}{3}-\dots, divide by x2x^2: −12-\dfrac12.

Question 5easy

Find the sum ∑n=0∞2nn!\displaystyle\sum_{n=0}^{\infty}\frac{2^n}{n!}.

Show answer
e2e^2

In the series ex=∑xnn!e^x = \sum\dfrac{x^n}{n!} put x=2x=2. The sum is e2≈7.389e^2\approx7.389.

Question 6medium

Find the sum ∑n=1∞(−1)n+1n 2n\displaystyle\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n\,2^n}.

Show answer
ln⁡(3/2)\ln(3/2)

ln⁡(1+x)=∑n≥1(−1)n+1xnn\ln(1+x) = \sum_{n\ge1}\dfrac{(-1)^{n+1}x^n}{n}. The term is (−1)n+1(1/2)nn\dfrac{(-1)^{n+1}(1/2)^n}{n}, that is, x=12x = \frac12 (inside the interval).
The sum is ln⁡32≈0.4055\ln\frac32\approx0.4055.

Question 7medium

Find the sum ∑n=0∞(−1)nπ2n4n (2n)!\displaystyle\sum_{n=0}^{\infty}\frac{(-1)^n\pi^{2n}}{4^n\,(2n)!}.

Show answer
00

π2n4n=(π2)2n\dfrac{\pi^{2n}}{4^n} = \left(\dfrac\pi2\right)^{2n}. The series is ∑(−1)n(π/2)2n(2n)!=cos⁡π2=0\sum\dfrac{(-1)^n(\pi/2)^{2n}}{(2n)!} = \cos\dfrac\pi2 = 0.

Question 8hard

Approximate ∫01e−x2 dx\displaystyle\int_0^1 e^{-x^2}\,dx with an error less than 0.0010.001 using a series.

Show answer
≈0.7475\approx 0.7475

e−x2=∑(−1)nx2nn!e^{-x^2} = \sum\dfrac{(-1)^nx^{2n}}{n!}. Term-by-term integral: ∫01=∑(−1)nn!(2n+1)=1−13+110−142+1216−11320+…\displaystyle\int_0^1 = \sum\frac{(-1)^n}{n!(2n+1)} = 1-\frac13+\frac1{10}-\frac1{42}+\frac1{216}-\frac1{1320}+\dotsAlternating series: the error is smaller than the first dropped term. 1216≈0.0046>0.001\frac1{216}\approx0.0046>0.001, 11320≈0.00076<0.001\frac1{1320}\approx0.00076<0.001.
Add the first five terms: 0.747490.74749. (The true value is 0.746820.74682, the error is 0.000660.00066.)

Question 9easy

Find the coefficient of x6x^6 in the Maclaurin series of e−x2e^{-x^2}.

Show answer
−1/6-1/6

eu=∑unn!e^u = \sum\dfrac{u^n}{n!}, u=−x2u = -x^2: the x6x^6 term comes from n=3n=3: (−x2)33!=−x66\dfrac{(-x^2)^3}{3!} = -\dfrac{x^6}{6}.

Question 10medium

If sin⁡(0.1)\sin(0.1) is approximated by 0.1−(0.1)360.1-\dfrac{(0.1)^3}{6}, give an upper bound for the error.

Show answer
≈8.3×10−8\approx 8.3\times10^{-8}

For x=0.1x = 0.1 the series of sin⁡x\sin x is alternating with decreasing terms. The error is smaller than the first dropped term:(0.1)55!=10−5120≈8.33×10−8\dfrac{(0.1)^5}{5!} = \dfrac{10^{-5}}{120}\approx8.33\times10^{-8}.

Question 11hard

Use P2(x)=1+x+x22P_2(x) = 1+x+\frac{x^2}{2} to approximate e0.2e^{0.2} and bound the error with Taylor's inequality (use e0.2<2e^{0.2}<2).

Show answer
1.221.22, error ≤0.00267\le 0.00267

P2(0.2)=1+0.2+0.02=1.22P_2(0.2) = 1+0.2+0.02 = 1.22.
Taylor's inequality: ∣R2∣≤M3!∣x∣3\lvert R_2\rvert\le\dfrac{M}{3!}\lvert x\rvert^3, M=max⁡∣f′′′∣=e0.2<2M = \max\lvert f'''\rvert = e^{0.2}<2 (on [0,0.2][0,0.2]).∣R2∣≤26(0.2)3=0.0166≈0.00267\lvert R_2\rvert\le\dfrac{2}{6}(0.2)^3 = \dfrac{0.016}{6}\approx0.00267. (The actual error is 0.00140.0014.)
The series has positive terms, it is not alternating; the alternating estimate cannot be used here.

Question 12medium

Use the binomial series to approximate 1.02\sqrt{1.02} with the first three terms.

Show answer
≈1.00995\approx 1.00995

(1+x)1/2=1+12x+12(−12)2x2+⋯=1+x2−x28+…(1+x)^{1/2} = 1+\dfrac12x+\dfrac{\frac12(-\frac12)}{2}x^2+\dots = 1+\dfrac{x}{2}-\dfrac{x^2}{8}+\dotsx=0.02x = 0.02: 1+0.01−0.00048=1.009951+0.01-\dfrac{0.0004}{8} = 1.00995. (The true value is 1.00995051.0099505.)

Verification: Approximations were compared with Math.exp/log/sin/sqrt values, error bounds with the actual error, limits at small x values, series sums with partial sums, and integrals computed with series with Simpson integration in node (verify/MAT1052/06.mjs).

Review card

f(x) = P_n(x) + R_n(x). R_n = f^(n+1)(c)/(n+1)! · (x-a)^(n+1), c between a and x Taylor's inequality: if |f^(n+1)| ≤ M then |R_n| ≤ M|x-a|^(n+1)/(n+1)! If the series is ALTERNATING and the terms decrease: error < first dropped term (easier) Limit: expand the numerator with series, divide by the smallest power. (sin x - x)/x^3 = -1/6 Sum: find the familiar series: Σx^n/n! → e^x, Σ(-1)^n x^(2n)/(2n)! → cos x Integral: expand the integrand into a series, integrate term by term; error from the alternating estimate Binomial: (1+x)^k = 1 + kx + k(k-1)/2! x^2 + k(k-1)(k-2)/3! x^3 + ... |x|<1 √(1+x) ≈ 1 + x/2 - x^2/8 1/√(1+x) ≈ 1 - x/2 + 3x^2/8 e^(-x^2), sin(x^2): substitute u, do not differentiate Use the calculator in RADIAN mode