Maclaurin and Taylor Series: Expansions and Approximations
Turning Functions into Polynomials
How does a calculator find sin 0.2 or e^0.1? It cannot draw a triangle or wait for compound interest to grow. It uses the fact that functions such as sin x, cos x, eˣ and ln(1 + x) can be written as infinite polynomials (power series), which need nothing more than adding and multiplying. These are Maclaurin and Taylor series. They are used for approximations in physics and engineering, for evaluating limits, and in numerical computing. This tutorial, for MTH 102/201 and Further Mathematics, covers where the formulas come from, the standard Maclaurin series, the binomial series, combining and adapting series, Taylor series about any point, approximations and their accuracy, evaluating limits, and Euler's formula.
The Idea
Suppose a function f(x) can be written as a power series:
f(x) = a₀ + a₁x + a₂x² + a₃x³ + …
Putting x = 0 gives a₀ = f(0). Differentiating once and then putting x = 0 gives a₁ = f′(0). Differentiating twice gives 2a₂ = f″(0), and three times gives 3! a₃ = f‴(0). In general, aₙ = f⁽ⁿ⁾(0) ÷ n!. This gives the Maclaurin series:
f(x) = f(0) + f′(0)x + f″(0)x²/2! + f‴(0)x³/3! + …
The first few terms give a polynomial that matches the function's value, slope, curvature and so on at x = 0. The more terms you include, the better the approximation near x = 0.
Standard Maclaurin Series
The exponential function
Every derivative of eˣ is eˣ, which equals 1 at x = 0, so:
eˣ = 1 + x + x²/2! + x³/3! + x⁴/4! + … (valid for all x)
Putting x = 1 gives e = 1 + 1 + ½ + 1/6 + 1/24 + 1/120 + … The first six terms already give 2.71667, close to e ≈ 2.71828.
Sine and cosine
The derivatives of sin x cycle through cos x, −sin x, −cos x and sin x, so at x = 0 they cycle through 1, 0, −1, 0:
sin x = x − x³/3! + x⁵/5! − x⁷/7! + …
cos x = 1 − x²/2! + x⁴/4! − x⁶/6! + …
Both are valid for all x, which must be in radians. Notice that sin x contains only odd powers, because it is an odd function, and cos x only even powers, because it is an even function.
The natural logarithm
ln x itself has no Maclaurin series, because ln 0 is undefined, so we expand ln(1 + x) instead:
ln(1 + x) = x − x²/2 + x³/3 − x⁴/4 + … (valid for −1 < x ≤ 1)
The binomial series
For any power n, including fractions and negative numbers:
(1 + x)ⁿ = 1 + nx + n(n − 1)x²/2! + n(n − 1)(n − 2)x³/3! + … (valid for |x| < 1)
When n is a positive whole number, the series stops, giving the binomial theorem. Otherwise it continues forever. Two important cases are:
- 1/(1 − x) = 1 + x + x² + x³ + … (the geometric series)
- √(1 + x) = 1 + x/2 − x²/8 + x³/16 − …
Worked Example 1: Deriving a Series
Find the first three non-zero terms of the Maclaurin series for e^(2x).
Replace x with 2x in the series for eˣ: e^(2x) = 1 + 2x + (2x)²/2 + (2x)³/6 + … = 1 + 2x + 2x² + …
Substituting into a known series is much faster than differentiating from scratch.
Approximations
Worked example 2
Use series to approximate (a) e^0.1 (b) sin 0.2 (c) √1.02, and compare with the true values.
(a) e^0.1 ≈ 1 + 0.1 + 0.005 + 0.000167 = 1.105167. True value: 1.105171.
(b) sin 0.2 ≈ 0.2 − 0.008/6 = 0.198667. True value: 0.198669.
(c) √1.02 = (1 + 0.02)^(1/2) ≈ 1 + 0.01 − 0.00005 = 1.00995. True value: 1.0099505.
Just two or three terms give excellent accuracy when x is small, because each further term contains a higher power of a small number.
Small-angle approximations
Keeping only the first terms gives approximations used throughout physics, valid for small angles in radians:
- sin x ≈ x
- tan x ≈ x
- cos x ≈ 1 − x²/2
For example, the formula for the period of a simple pendulum depends on sin θ ≈ θ, which is why its swings must be small.
Worked example 3
Estimate cos 0.3 using the first three terms of its series.
cos 0.3 ≈ 1 − 0.09/2 + 0.0081/24 = 1 − 0.045 + 0.0003375 = 0.9553375. True value: 0.9553365.
Taylor Series About Any Point
A Maclaurin series is centred at x = 0. To approximate a function near another point x = a, use the Taylor series:
f(x) = f(a) + f′(a)(x − a) + f″(a)(x − a)²/2! + f‴(a)(x − a)³/3! + …
A Maclaurin series is simply a Taylor series with a = 0.
Worked example 4
Use a Taylor series about x = 4 to estimate √4.1.
f(x) = √x, so f(4) = 2. f′(x) = ½x^(−1/2), so f′(4) = ¼. f″(x) = −¼x^(−3/2), so f″(4) = −1/32.
√4.1 ≈ 2 + ¼(0.1) − (1/32)(0.1)²/2 = 2 + 0.025 − 0.00015625 = 2.0248438. True value: 2.0248457.
The first two terms alone, f(a) + f′(a)(x − a), give the linear approximation, which is the tangent line at x = a.
Worked example 5
Find the Taylor series of ln x about x = 1, up to the term in (x − 1)³.
f(1) = 0. f′(x) = 1/x, so f′(1) = 1. f″(x) = −1/x², so f″(1) = −1. f‴(x) = 2/x³, so f‴(1) = 2.
ln x ≈ (x − 1) − (x − 1)²/2 + 2(x − 1)³/6 = (x − 1) − (x − 1)²/2 + (x − 1)³/3.
Putting x − 1 = h, this is the ln(1 + h) series, as expected.
Accuracy and Convergence
Stopping after the term in xⁿ leaves an error, the remainder. A useful estimate of its size is the first term left out. In the Lagrange form, the remainder after the xⁿ term is f⁽ⁿ⁺¹⁾(c) xⁿ⁺¹ ÷ (n + 1)! for some value c between 0 and x.
A series may also be valid only for some values of x, its interval of convergence. The series for eˣ, sin x and cos x converge for every x, but the series for ln(1 + x) and the binomial series (for non-integer n) work only for |x| < 1 (with ln(1 + x) also working at x = 1). For example, putting x = 2 into the ln(1 + x) series gives terms that grow larger and larger, so the series is useless there.
Evaluating Limits with Series
Series give a quick alternative to L'Hôpital's rule for limits of the form 0/0.
Worked example 6
Find the limit of (sin x − x) ÷ x³ as x tends to 0.
sin x − x = −x³/6 + x⁵/120 − …, so (sin x − x) ÷ x³ = −1/6 + x²/120 − … As x tends to 0, this tends to −1/6.
Worked example 7
Find the limit of (1 − cos x) ÷ x² as x tends to 0.
1 − cos x = x²/2 − x⁴/24 + …, so the expression is ½ − x²/24 + …, which tends to ½.
Euler's Formula
Substituting x = iθ, where i² = −1, into the series for eˣ and grouping the real and imaginary terms gives the series for cos θ and sin θ:
e^(iθ) = cos θ + i sin θ
Putting θ = π gives e^(iπ) + 1 = 0, often called the most beautiful equation in mathematics, because it links e, i, π, 1 and 0. Euler's formula is the basis of the polar form of complex numbers and of De Moivre's theorem, covered in the tutorial on complex numbers.
Common Mistakes with Taylor Series
- Using degrees in the series for sin x or cos x. They need radians.
- Forgetting the factorials in the denominators.
- Using a series outside its interval of convergence, such as ln(1 + x) with x = 3.
- Writing a Maclaurin series for ln x. Expand ln(1 + x) instead, or use a Taylor series about x = 1.
- Losing the signs in alternating series such as sin x and ln(1 + x).
Taylor Series: Practice Questions
- Write the first four terms of the Maclaurin series for e^(−x).
- Use your answer to question 1 to estimate e^(−0.2).
- Find the first three non-zero terms of the Maclaurin series for x sin x.
- Use the series for ln(1 + x) to estimate ln 1.1, using three terms.
- Find the Maclaurin series for tan⁻¹x, given that its derivative 1/(1 + x²) = 1 − x² + x⁴ − …
- Find the limit of (eˣ − 1 − x) ÷ x² as x tends to 0.
Answers: 1. 1 − x + x²/2 − x³/6. 2. 1 − 0.2 + 0.02 − 0.001333 ≈ 0.818667 (true value 0.818731). 3. x² − x⁴/6 + x⁶/120. 4. 0.1 − 0.005 + 0.000333 ≈ 0.095333 (true value 0.095310). 5. Integrating term by term: tan⁻¹x = x − x³/3 + x⁵/5 − x⁷/7 + … 6. eˣ − 1 − x = x²/2 + x³/6 + …, so the limit is ½.
Conclusion
Taylor series write a function as a power series built from its derivatives at one point: f(x) = Σ f⁽ⁿ⁾(a)(x − a)ⁿ/n!, which is called the Maclaurin series when a = 0. The standard series for eˣ, sin x, cos x, ln(1 + x) and (1 + x)ⁿ give excellent approximations from just a few terms when x is small, including the small-angle approximations of physics. New series come from substituting, multiplying, differentiating or integrating known ones. Remember that each series is valid only within its interval of convergence. Series also evaluate limits quickly, and they lead to Euler's formula e^(iθ) = cos θ + i sin θ.