Skip to content

FP2 Chapter 7: Maclaurin and Taylor Series

FP2 Lecture Notes: Maclaurin and Taylor Series

Section titled “FP2 Lecture Notes: Maclaurin and Taylor Series”

Taylor series and Maclaurin series provide powerful methods for approximating functions using polynomials. These approximations are fundamental in calculus, engineering, and physics, allowing us to represent complex functions in terms of simpler polynomial expressions.

Notation and Calculation of Higher Derivatives

Section titled “Notation and Calculation of Higher Derivatives”

Notation:

  • f(x)f'(x) or f(1)(x)f^{(1)}(x): First derivative
  • f(x)f''(x) or f(2)(x)f^{(2)}(x): Second derivative
  • f(x)f'''(x) or f(3)(x)f^{(3)}(x): Third derivative
  • f(n)(x)f^{(n)}(x): nn-th derivative (Leibniz notation: dnfdxn\frac{d^n f}{dx^n})

Examples of Higher Derivative Calculations:

For f(x)=exf(x) = e^x:

f(x)=exf(x)=exf(x)=ex\begin{aligned} f'(x) &= e^x \\ f''(x) &= e^x \\ f'''(x) &= e^x \end{aligned}

All derivatives of exe^x are equal to exe^x itself!

For f(x)=sinxf(x) = \sin x:

f(x)=cosxf(x)=sinxf(x)=cosxf(4)(x)=sinx\begin{aligned} f'(x) &= \cos x \\ f''(x) &= -\sin x \\ f'''(x) &= -\cos x \\ f^{(4)}(x) &= \sin x \end{aligned}

The derivatives of sinx\sin x follow a cycle of four functions.

For f(x)=xnf(x) = x^n (where nn is a positive integer):

f(x)=nxn1f(x)=n(n1)xn2f(x)=n(n1)(n2)xn3\begin{aligned} f'(x) &= nx^{n-1} \\ f''(x) &= n(n-1)x^{n-2} \\ f'''(x) &= n(n-1)(n-2)x^{n-3} \end{aligned}

The pattern continues until we reach the nn-th derivative, which equals n!n! (constant), and all higher derivatives are zero.

Let’s begin by considering a polynomial P(x)P(x) that approximates a function f(x)f(x) near x=0x = 0:

P(x)=a0+a1x+a2x2+a3x3++anxnP(x) = a_0 + a_1x + a_2x^2 + a_3x^3 + \cdots + a_nx^n

If we want this polynomial to match f(x)f(x) and its derivatives at x=0x = 0, we need:

P(0)=f(0)a0=f(0)P(0)=f(0)a1=f(0)P(0)=f(0)2!a2=f(0)a2=f(0)2!P(0)=f(0)3!a3=f(0)a3=f(0)3!\begin{aligned} P(0) &= f(0) &\Rightarrow \quad a_0 &= f(0) \\ P'(0) &= f'(0) &\Rightarrow \quad a_1 &= f'(0) \\ P''(0) &= f''(0) &\Rightarrow \quad 2!\,a_2 &= f''(0) &\Rightarrow \quad a_2 &= \frac{f''(0)}{2!} \\ P'''(0) &= f'''(0) &\Rightarrow \quad 3!\,a_3 &= f'''(0) &\Rightarrow \quad a_3 &= \frac{f'''(0)}{3!} \end{aligned}

Continuing this pattern, we find that an=f(n)(0)n!a_n = \frac{f^{(n)}(0)}{n!}.

Substituting these values into our polynomial:

P(x)=f(0)+f(0)x+f(0)2!x2+f(0)3!x3++f(n)(0)n!xnP(x) = f(0) + f'(0)x + \frac{f''(0)}{2!}x^2 + \frac{f'''(0)}{3!}x^3 + \cdots + \frac{f^{(n)}(0)}{n!}x^n

This is the Maclaurin polynomial of degree nn. As nn approaches infinity, we get the Maclaurin series:

f(x)=n=0f(n)(0)n!xn=f(0)+f(0)x+f(0)2!x2+f(0)3!x3+f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(0)}{n!}x^n = f(0) + f'(0)x + \frac{f''(0)}{2!}x^2 + \frac{f'''(0)}{3!}x^3 + \cdots

Understanding Maclaurin series becomes much clearer when we visualize how the polynomial approximations converge to the original function.

For example, consider the function f(x)=exf(x) = e^x and its Maclaurin polynomials:

P0(x)=1P1(x)=1+xP2(x)=1+x+x22\begin{aligned} P_0(x) &= 1 \\ P_1(x) &= 1 + x \\ P_2(x) &= 1 + x + \frac{x^2}{2} \end{aligned}

Maclaurin approximation of e^x

Observations:

  • Each polynomial Pn(x)P_n(x) matches the function f(x)f(x) and its first nn derivatives at x=0x = 0
  • As nn increases, the approximation becomes more accurate over a wider range of xx values
  • Near x=0x = 0, even lower-degree approximations are quite accurate
  • As we move further from x=0x = 0, we need higher-degree terms for good approximation

Similar visual patterns emerge for other common functions like sinx\sin x, cosx\cos x, and ln(1+x)\ln(1+x), though each has its own convergence characteristics.

Module 4: Common Maclaurin Series Examples

Section titled “Module 4: Common Maclaurin Series Examples”

Here are the Maclaurin series expansions for some fundamental functions:

Exponential function:

ex=1+x+x22!+x33!+x44!+=n=0xnn!e^x = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \cdots = \sum_{n=0}^{\infty} \frac{x^n}{n!}

Sine function:

sinx=xx33!+x55!x77!+=n=0(1)nx2n+1(2n+1)!\sin x = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \cdots = \sum_{n=0}^{\infty} \frac{(-1)^n x^{2n+1}}{(2n+1)!}

Cosine function:

cosx=1x22!+x44!x66!+=n=0(1)nx2n(2n)!\cos x = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \cdots = \sum_{n=0}^{\infty} \frac{(-1)^n x^{2n}}{(2n)!}

Natural logarithm:

ln(1+x)=xx22+x33x44+=n=1(1)n1xnn\ln(1+x) = x - \frac{x^2}{2} + \frac{x^3}{3} - \frac{x^4}{4} + \cdots = \sum_{n=1}^{\infty} \frac{(-1)^{n-1}x^n}{n}

Binomial expansion:

(1+x)k=1+kx+k(k1)2!x2+k(k1)(k2)3!x3+(1+x)^k = 1 + kx + \frac{k(k-1)}{2!}x^2 + \frac{k(k-1)(k-2)}{3!}x^3 + \cdots

Example: Computing ee Using the Maclaurin Series

Section titled “Example: Computing eee Using the Maclaurin Series”

We can calculate the value of ee by using the Maclaurin series for exe^x and setting x=1x = 1:

e=e1=1+1+12!+13!+14!+e = e^1 = 1 + 1 + \frac{1}{2!} + \frac{1}{3!} + \frac{1}{4!} + \cdots

Let’s compute increasingly accurate approximations:

1=1.00001+1=2.00001+1+12=2.50001+1+12+16=2.66671+1+12+16+124=2.70831+1+12+16+124+1120=2.7167\begin{aligned} 1 &= 1.0000 \\ 1 + 1 &= 2.0000 \\ 1 + 1 + \frac{1}{2} &= 2.5000 \\ 1 + 1 + \frac{1}{2} + \frac{1}{6} &= 2.6667 \\ 1 + 1 + \frac{1}{2} + \frac{1}{6} + \frac{1}{24} &= 2.7083 \\ 1 + 1 + \frac{1}{2} + \frac{1}{6} + \frac{1}{24} + \frac{1}{120} &= 2.7167 \end{aligned}

The actual value of ee to 5 decimal places is 2.71828. Even with just a few terms, we get a reasonably accurate approximation.

Example: Computing sin(0.1)\sin(0.1) Using the Maclaurin Series

Section titled “Example: Computing sin⁡(0.1)\sin(0.1)sin(0.1) Using the Maclaurin Series”

We can calculate sin(0.1)\sin(0.1) using the Maclaurin series:

sin(0.1)=0.1(0.1)33!+(0.1)55!(0.1)77!+\sin(0.1) = 0.1 - \frac{(0.1)^3}{3!} + \frac{(0.1)^5}{5!} - \frac{(0.1)^7}{7!} + \cdots

Computing:

0.1=0.10000000.1(0.1)36=0.10.0001667=0.09983330.0998333+(0.1)5120=0.0998333+0.0000000833=0.0998334\begin{aligned} 0.1 &= 0.1000000 \\ 0.1 - \frac{(0.1)^3}{6} &= 0.1 - 0.0001667 = 0.0998333 \\ 0.0998333 + \frac{(0.1)^5}{120} &= 0.0998333 + 0.0000000833 = 0.0998334 \end{aligned}

The actual value of sin(0.1)\sin(0.1) to 7 decimal places is 0.0998334. Our approximation is extremely accurate with just three terms, demonstrating how quickly the Maclaurin series can converge for small values of xx.

Module 5: The Taylor Series — Generalising Maclaurin Series

Section titled “Module 5: The Taylor Series — Generalising Maclaurin Series”

The Taylor series of a function f(x)f(x) that is infinitely differentiable at x=ax = a is given by:

f(x)=n=0f(n)(a)n!(xa)nf(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x-a)^n

provided that this infinite series converges to f(x)f(x) for values of xx in some neighbourhood of aa.

Relationship Between Taylor and Maclaurin Series

Section titled “Relationship Between Taylor and Maclaurin Series”

The Maclaurin series is simply a special case of the Taylor series where the expansion is centred at a=0a = 0.

When to use Taylor vs. Maclaurin:

  • Use a Maclaurin series when you’re interested in the behaviour of the function near x=0x = 0
  • Use a Taylor series expanded at x=ax = a when you’re interested in the behaviour near x=ax = a
  • A Taylor series often converges more rapidly for values close to its centre point aa

Example: If we want to approximate ln(x)\ln(x) near x=2x = 2, a Taylor series centred at a=2a = 2 will provide better results than a Maclaurin series centred at a=0a = 0.

Module 6: Solving Differential Equations with Series Methods

Section titled “Module 6: Solving Differential Equations with Series Methods”

Example: Solving y+2y=xyy'' + 2y' = xy with Initial Conditions

Section titled “Example: Solving y′′+2y′=xyy'' + 2y' = xyy′′+2y′=xy with Initial Conditions”

Let’s solve the differential equation y+2y=xyy'' + 2y' = xy with initial conditions y(1)=1y(1) = 1 and y(1)=2y'(1) = 2.

Since our initial conditions are given at x=1x = 1, we use a Taylor series centred at x=1x = 1:

y(x)=n=0y(n)(1)n!(x1)ny(x) = \sum_{n=0}^{\infty} \frac{y^{(n)}(1)}{n!} (x-1)^n

Step 1: Initial conditions give us:

y(1)=y(0)(1)=1y(1)=y(1)(1)=2\begin{aligned} y(1) &= y^{(0)}(1) = 1 \\ y'(1) &= y^{(1)}(1) = 2 \end{aligned}

Step 2: By the original equation y+2y=xyy'' + 2y' = xy when x=1x = 1:

y(1)+2y(1)=1y(1)y''(1) + 2y'(1) = 1 \cdot y(1)

Hence y(1)=1y(1)2y(1)=1122=3y''(1) = 1 \cdot y(1) - 2 \cdot y'(1) = 1 \cdot 1 - 2 \cdot 2 = -3.

Step 3: Differentiating the original equation, we get:

y+2y=y+xyy''' + 2y'' = y + xy'

Hence y(1)=y(1)+1y(1)2y(1)=1+122(3)=9y'''(1) = y(1) + 1 \cdot y'(1) - 2 \cdot y''(1) = 1 + 1 \cdot 2 - 2 \cdot (-3) = 9.

Step 4: Our series solution up to the third order is:

y(x)=1+2(x1)32(x1)2+96(x1)3=1+2(x1)32(x1)2+32(x1)3y(x) = 1 + 2(x-1) - \frac{3}{2}(x-1)^2 + \frac{9}{6}(x-1)^3 = 1 + 2(x-1) - \frac{3}{2}(x-1)^2 + \frac{3}{2}(x-1)^3