Taylor and Maclaurin Series If a function f has derivatives of all orders at x = a (i.e. if f (k) (a) exists for all k = 0, 1, 2, 3, . . .) then we can construct the following power series in (x − a): f (a) + 1 ′ 1 ′′ 1 f (a)(x − a) + f (a)(x − a)2 + . . . + f (n) (a)(x − a)n + . . . 1! 2! n! ∞ ∑ 1 (r) = f (a)(x − a)r . r! r=0 This series is called the Taylor series of f about x = a. If a = 0 then we usually call this the Maclaurin series of f . We write ∞ ∑ 1 (r) f (x) = f (a)(x − a)r r! r=0 for |x − a| < R to mean that for all x = c, such that |c − a| < R, the sum ∞ ∑ 1 (r) f (a)(c − a)r r! r=0 is finite and equals f (c). We call R the radius of convergence. If R = ∞ then the Taylor series equals f (x) for all x ∈ R. 1. Standard Maclaurin Series • For α ∈ R, (1 + x)α = 1 + αx + • • • • • • α(α − 1) 2 α(α − 1)(α − 2) 3 x + x + ... 2! 3! x2 x3 x4 ln(1 + x) = x − + − + . . . for −1 < x ≤ 1 2 3 4 x2 x 3 x4 ex = 1 + x + + + + . . . for x ∈ R 2! 3! 4! x3 x5 x 7 + − + . . . for x ∈ R sin(x) = x − 3! 5! 7! x 2 x4 x 6 + − + . . . for x ∈ R cos(x) = 1 − 2! 4! 6! x3 x5 x7 + + + . . . for x ∈ R sinh(x) = x + 3! 5! 7! x 2 x4 x6 + + + . . . for x ∈ R cosh(x) = 1 + 2! 4! 6! 1 for |x| < 1 Example 1 Using the standard series, find the Maclaurin series for: (i) f (x) = sin(3x), (ii) f (x) = cos(x) + cosh(x), (iii) f (x) = e2x ln(1 − x). Include all terms up to the fifth power. (i) Use the series for sin(x) with x replaced by 3x: (3x)3 (3x)5 + − ... 3! 5! 9x3 81x5 = 3x − + − ... 2 40 sin(3x) = 3x − The above series is valid for 3x ∈ R, i.e. for x ∈ R. (ii) The series for cos(x) and cosh(x) can be added term by term to obtain the series for their sum: ( ) ( ) x2 x4 x6 x2 x4 x6 cos(x) + cosh(x) = 1− + − + ... + 1 + + + + ... 2! 4! 6! 2! 4! 6! 2x4 = 2+ + ... 4! x4 = 2+ + ... 12 The above series is valid for x ∈ R. (iii) The series for this product is obtained by multiplying the series for e2x and ln(1 − x), respectively: = = = = e2x ln(1 − x) ( )( ) (2x)2 (2x)3 (3x)4 (−x)2 (−x)3 (−x)4 (−x)5 1 + (2x) + + + + ... (−x) − + − + − ... 2! 3! 4! 2 3 4 5 ( )( ) 4x3 27x4 x 2 x3 x4 x5 2 1 + 2x + 2x + + + ... −x − − − − − ... 3 8 2 3 4 5 x2 x 3 x4 x5 2x4 x5 2x5 4x4 2x5 27x5 −x − − − − − 2x2 − x3 − − − 2x3 − x4 − − − − − ... 2 3 4 5 3 2 3 3 3 8 5x2 10x3 13x4 649x5 − − − − ... −x − 2 3 4 120 The above series is valid for −1 < (−x) ≤ 1, i.e. for −1 ≤ x < 1. Note that at each stage of the above calculations we kept only enough terms to ensure that we could get all terms with powers up to and including x5 . 2 Example 2 Find the first three nonzero terms in the Taylor Series of f about x = a if π 8 (ii) f (x) = (x + 1)3 , a = 2 (i) f (x) = cos(2x), a = (iii) f (x) = x ln(x), a = 1 (i) f ′ (x) = −2 sin(2x), f ′′ (x) = −4 cos(2x) (π ) (π ) ( π ) 1 ′′ ( π ) ( π )2 + f′ x− + f x− f + ... 8 8 8 2 8 8 (π ) ( ( π )) ( ( π )) ( π) 1 ( π )2 = cos + −2 sin x− + −4 cos x− + ... 4 4 8 2 4 8 √ ( 1 π) √ ( π )2 = √ − 2 x− − 2 x− + ... 8 8 2 (ii) f ′ (x) = 3(x + 1)2 , f ′′ (x) = 6(x + 1) 1 f (2) + f ′ (2)(x − 2) + f ′′ (2)(x − 2)2 + . . . 2 1 = 33 + 3 × 32 (x − 2) + × 6 × 3(x − 2)2 2 = 27 + 27(x − 2) + 9(x − 2)2 + . . . 1 ′′′ 1 , f (x) = − 2 x x 1 1 f (1) + f ′ (1)(x − 1) + f ′′ (1)(x − 1)2 + f ′′′ (1)(x − 1)3 + . . . 2 6 1 1 1 −1 = 1 ln(1) + (ln(1) + 1)(x − 1) + × (x − 1)2 + × (x − 1)3 + . . . 2 1 6 1 1 1 = (x − 1) + (x − 1)2 − (x − 1)3 + . . . 2 6 (iii) f ′ (x) = ln(x) + 1, f ′′ (x) = 2. Error Estimation The Taylor series of f about the point x = a can be truncated in order to provide an approximating polynomial for the function. We also obtain an expression describing the error between this polynomial and f . f (x) = f (a) + f ′ (a)(x − a) + f (n) (a) f ′′ (a) (x − a)2 + . . . + (x − a)n + Rn 2! n! = Pn (x) + Rn • Pn (x) is the approximating (or Taylor) polynomial of degree n • Rn is the truncating error • The truncating error can be written in various ways; we shall use Lagrange’s form Rn = f (n+1) (c) (x − a)n+1 , (n + 1)! where c is some value that lies between a and x. We don’t know the value of c, but we can obtain upper and/or lower bounds for the error. 3 π Example 3 Find the Taylor polynomial of degree 3 for sin(x) about x = . Hence estimate 3 sin 64◦ and find the maximum error in this approximation. ( ◦ First note that 64 = ) π π + radians. 3 45 ( π ) √3 f (x) = sin(x) ⇒ f = 3 2 (π ) 1 f ′ (x) = cos(x) ⇒ f ′ = 3 2 √ (π ) 3 (2) (2) f (x) = − sin(x) ⇒ f =− 3 2 (π ) 1 f (3) (x) = − cos(x) ⇒ f (3) =− 3 2 60 + 4 180 π radians = f (4) (x) = sin(x) ⇒ f (4) (c) = sin(c) Therefore and so √ ( 3 1( π) 3 π )2 π )3 1 ( x− − x− x− sin(x) ≃ + − 2 2 3 4 3 12 3 √ (π π) sin 64◦ = sin + √ 3 45 √ ( ) 3 1π 3 π 2 1 ( π )3 = − + − 2 45 √ 4 45 12 45 √2 3 π 3π 2 π3 = + + + 2 90 8100 1093500 The truncating error is R3 = f (4) (c) ( π )4 sin(c) ( π )4 x− = , 4! 3 4! 45 . In order to estimate the maximum error we are required to find the where π3 < c < 64π 180 maximum value of sin(c) (as all other terms are known). The best we can say is that sin(c) ≤ 1 and so 1 ( π )4 π4 R3 ≤ = . 4! 45 24 × 454 4