30.1 Maclaurin Series of Standard Functions
AHL 5.19
- how to write a function as an infinite power series \(a_0 + a_1x + a_2x^2 + \cdots\)
- the Maclaurin series formula, and the Maclaurin polynomial \(M_n(x)\)
- when a function has a Maclaurin series, and when it does not
- the series for \(\mathrm{e}^x\), \(\sin x\), \(\cos x\), \(\ln(1 + x)\), \(\arctan x\) and \((1 + x)^p\)
- how to find a series by repeated differentiation of a relation between \(y\) and its derivatives
The Maclaurin series
Suppose a function \(f(x)\) can be written as a series in ascending powers of \(x\), and that we may differentiate this series term by term:
\[ f(x) = a_0 + a_1x + a_2x^2 + a_3x^3 + \cdots + a_rx^r + \cdots \]
The numbers \(a_0, a_1, a_2, \ldots\) are constants. We can find them by differentiating again and again and then putting \(x = 0\):
| value at \(x = 0\) | |
|---|---|
| \(f(x) = a_0 + a_1x + a_2x^2 + a_3x^3 + \cdots\) | \(f(0) = a_0\) |
| \(f'(x) = a_1 + 2a_2x + 3a_3x^2 + \cdots\) | \(f'(0) = a_1\) |
| \(f''(x) = 2a_2 + 3 \times 2\,a_3x + \cdots\) | \(f''(0) = 2!\,a_2\) |
| \(f'''(x) = 3 \times 2 \times 1\,a_3 + \cdots\) | \(f'''(0) = 3!\,a_3\) |
In general \(f^{(r)}(0) = r!\,a_r\), so \(a_r = \dfrac{f^{(r)}(0)}{r!}\).
Maclaurin series In the HL formula booklet
\[ f(x) = f(0) + x f'(0) + \frac{x^2}{2!}f''(0) + \cdots \]
In sigma notation: \[ f(x) = \sum_{k=0}^{\infty} \frac{f^{(k)}(0)}{k!}x^k = f(0) + x f'(0) + \frac{x^2}{2!}f''(0) + \frac{x^3}{3!}f'''(0) + \cdots \]
- \(f(0),\ f'(0),\ f''(0), \ldots\): the value of \(f\) and of its derivatives at \(x = 0\)
- \(k\): the index of the term (\(k = 0, 1, 2, \ldots\))
- \(f^{(k)}(0)\): the \(k\)th derivative of \(f\) at \(x = 0\) (\(f^{(0)}(0) = f(0)\))
- \(k!\): \(k\) factorial, \(k! = 1 \times 2 \times \cdots \times k\) (and \(0! = 1\))
For the values of \(x\) where the series converges (see 30.2), the infinite series is exactly equal to \(f(x)\). If we stop after the term in \(x^n\), we get a polynomial that approximates \(f(x)\).
The Maclaurin polynomial of degree \(n\) Not in the formula booklet
\[ M_n(x) = \sum_{k=0}^{n} \frac{f^{(k)}(0)}{k!}x^k = f(0) + x f'(0) + \cdots + \frac{x^n}{n!}f^{(n)}(0) \]
- \(M_n(x)\): the Maclaurin polynomial of degree \(n\)
- \(n\): the degree (the highest power of \(x\))
- \(k\): the index of the term (\(k = 0, 1, \ldots, n\))
- \(f^{(k)}(0)\): the \(k\)th derivative of \(f\) at \(x = 0\)
When does a Maclaurin series exist?
We can only build the series if
- \(f(0)\) is defined,
- \(f'(x), f''(x), f'''(x), \ldots\) exist — we can differentiate as many times as we like, and
- \(f^{(n)}(0)\) is defined for every \(n = 1, 2, 3, \ldots\)
For example, \(\ln x\) has no Maclaurin series, because \(\ln 0\) is not defined. This is why we use \(\ln(1 + x)\) instead.
Some series equal \(f(x)\) for every real \(x\); others only for an interval of \(x\) values. For example,
\[ \begin{gathered} \mathrm{e}^x = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots \ \text{ for all } x, \\ \ln(1 + x) = x - \frac{x^2}{2} + \frac{x^3}{3} - \cdots \ \text{ for } -1 < x \leqslant 1 . \end{gathered} \]
Example 1 Let \(f(x) = \mathrm{e}^x\).
(a) Write down \(f^{(n)}(x)\) for \(n \in \mathbb{Z}^+\). Hence show that \(\mathrm{e}^x = \displaystyle\sum_{k=0}^{\infty}\frac{x^k}{k!}\).
(b) \(M_1(x) = 1 + x\) and \(M_2(x) = 1 + x + \dfrac{x^2}{2}\). Write down \(M_3(x)\), \(M_4(x)\), \(M_5(x)\) and \(M_6(x)\).
(c) Describe how the graphs of \(M_1, M_2, M_3, M_4\) compare with the graph of \(y = \mathrm{e}^x\).
(d) Find \(M_n(0.5)\) for \(n = 1, 2, \ldots, 6\), and compare with \(\mathrm{e}^{0.5}\).
(a) Every derivative of \(\mathrm{e}^x\) is \(\mathrm{e}^x\), so \(f^{(n)}(x) = \mathrm{e}^x\) and \(f^{(n)}(0) = \mathrm{e}^0 = 1\) for every \(n\). Each coefficient is \(\dfrac{1}{k!}\), so
\[ \mathrm{e}^x = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots = \sum_{k=0}^{\infty}\frac{x^k}{k!} . \]
(b) Add one term each time:
\[ \begin{aligned} M_3(x) &= 1 + x + \frac{x^2}{2} + \frac{x^3}{6} \\ M_4(x) &= 1 + x + \frac{x^2}{2} + \frac{x^3}{6} + \frac{x^4}{24} \\ M_5(x) &= M_4(x) + \frac{x^5}{120} \\ M_6(x) &= M_5(x) + \frac{x^6}{720} \end{aligned} \]
(c) See Figure 1. All the polynomials pass through \((0, 1)\) and are very close to \(\mathrm{e}^x\) near \(x = 0\). Each extra term makes the polynomial stay close to the curve over a wider interval of \(x\). Far from \(0\) (for example \(x = -3\)) the low-degree polynomials are poor approximations.
(d)
| \(n\) | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| \(M_n(0.5)\) | \(1.5\) | \(1.625\) | \(1.645833\) | \(1.648438\) | \(1.648698\) | \(1.648720\) |
\(\mathrm{e}^{0.5} = 1.648721\ldots\) The values get closer and closer to \(\mathrm{e}^{0.5}\); \(M_6(0.5)\) is correct to 5 decimal places.
The standard series
The method of Example 1 works for the other standard functions. Here is \(\sin x\).
Example 2 Use the Maclaurin series formula to show that
\[ \sin x = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \cdots \]
Hence, by differentiating, write down the series for \(\cos x\).
The derivatives repeat in a cycle of four:
| \(k\) | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| \(f^{(k)}(x)\) | \(\sin x\) | \(\cos x\) | \(-\sin x\) | \(-\cos x\) | \(\sin x\) | \(\cos x\) |
| \(f^{(k)}(0)\) | \(0\) | \(1\) | \(0\) | \(-1\) | \(0\) | \(1\) |
So only the odd powers appear, with signs \(+, -, +, -, \ldots\):
\[ \sin x = 0 + x + 0 - \frac{x^3}{3!} + 0 + \frac{x^5}{5!} - \cdots = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \cdots \]
Differentiate term by term (\(\frac{\mathrm{d}}{\mathrm{d}x}\frac{x^3}{3!} = \frac{3x^2}{3!} = \frac{x^2}{2!}\), and so on):
\[ \cos x = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \cdots \]
For \(\ln(1 + x)\): \(f'(x) = (1 + x)^{-1}\), \(f''(x) = -(1 + x)^{-2}\), \(f'''(x) = 2(1 + x)^{-3}\), \(f^{(4)}(x) = -3!\,(1 + x)^{-4}\), … so \(f^{(k)}(0) = (-1)^{k-1}(k - 1)!\) for \(k \geqslant 1\) and \(f(0) = 0\). The coefficient of \(x^k\) is \(\dfrac{(-1)^{k-1}(k - 1)!}{k!} = \dfrac{(-1)^{k-1}}{k}\).
Maclaurin series of the standard functions Partly in the HL formula booklet
\[ \begin{aligned} \mathrm{e}^x &= 1 + x + \frac{x^2}{2!} + \cdots \\ \ln(1 + x) &= x - \frac{x^2}{2} + \frac{x^3}{3} - \cdots \\ \sin x &= x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots \\ \cos x &= 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \cdots \\ \arctan x &= x - \frac{x^3}{3} + \frac{x^5}{5} - \cdots \end{aligned} \]
In the HL booklet
\[ (1 + x)^p = 1 + px + \frac{p(p - 1)}{2!}x^2 + \frac{p(p - 1)(p - 2)}{3!}x^3 + \cdots, \quad p \in \mathbb{Q} \]
- \(p\): the power, a rational number (\(p \in \mathbb{Q}\))
For \((1 + x)^p\) the booklet (AHL 1.10) gives \((a + b)^n = a^n\left(1 + n\left(\dfrac{b}{a}\right) + \dfrac{n(n - 1)}{2!}\left(\dfrac{b}{a}\right)^2 + \cdots\right)\), \(n \in \mathbb{Q}\); put \(a = 1\), \(b = x\), \(n = p\).
The binomial series was met in 4.3; in 30.2 we show that it is a Maclaurin series. The intervals where these series are valid are also in 30.2.
Series from a differential relation
Sometimes the derivatives of \(f\) get very complicated. A better method is to find a simple relation between \(y\) and its derivatives, then differentiate the relation again and again. Put \(x = 0\) at each step.
Method
- Find \(y(0)\) and \(y'(0)\) and a relation such as \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = y \cos x\).
- Differentiate the relation (product rule, chain rule) to get \(y''\), then \(y'''\), …
- Put \(x = 0\) to get \(y''(0)\), \(y'''(0)\), …, using the values already found.
- Substitute into \(y = y(0) + x\,y'(0) + \dfrac{x^2}{2!}y''(0) + \dfrac{x^3}{3!}y'''(0) + \cdots\)
The same idea is used to solve differential equations with series — see Unit 31.
Example 3 Given that \(y = \mathrm{e}^{\sin x}\), show that \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = y\cos x\). By repeated differentiation of this result, find the Maclaurin series for \(y\) up to and including the term in \(x^3\).
Chain rule: \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = \cos x \,\mathrm{e}^{\sin x} = y\cos x\).
Differentiate \(y' = y\cos x\) with the product rule:
\[ \begin{aligned} y'' &= y'\cos x - y\sin x \\ y''' &= y''\cos x - y'\sin x - y'\sin x - y\cos x = y''\cos x - 2y'\sin x - y\cos x \end{aligned} \]
At \(x = 0\): \(\;y(0) = \mathrm{e}^0 = 1\), \(\;y'(0) = 1 \times 1 = 1\), \(\;y''(0) = 1 - 0 = 1\), \(\;y'''(0) = 1 - 0 - 1 = 0\).
\[ y = 1 + x + \frac{x^2}{2!}(1) + \frac{x^3}{3!}(0) + \cdots = 1 + x + \frac{x^2}{2} + 0x^3 + \cdots \]
The coefficient of \(x^3\) is zero.
Example 4 Given that \(y = \ln(1 + \mathrm{e}^x)\), show that \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 1 - \mathrm{e}^{-y}\). By repeated differentiation of this result, find the Maclaurin series for \(y\) up to and including the term in \(x^3\).
Hence find the Maclaurin series for \(\dfrac{\mathrm{e}^x}{1 + \mathrm{e}^x}\) up to and including the term in \(x^2\).
\(\mathrm{e}^y = 1 + \mathrm{e}^x\). Then
\[ \frac{\mathrm{d}y}{\mathrm{d}x} = \frac{\mathrm{e}^x}{1 + \mathrm{e}^x} = \frac{\mathrm{e}^y - 1}{\mathrm{e}^y} = 1 - \mathrm{e}^{-y} . \]
Differentiate (chain rule on \(\mathrm{e}^{-y}\)):
\[ y'' = \mathrm{e}^{-y}\,y', \qquad y''' = -\mathrm{e}^{-y}(y')^2 + \mathrm{e}^{-y}y'' = \mathrm{e}^{-y}\big(y'' - (y')^2\big) . \]
At \(x = 0\): \(\;y(0) = \ln 2\), so \(\mathrm{e}^{-y(0)} = \frac{1}{2}\).
\[ y'(0) = 1 - \tfrac{1}{2} = \tfrac{1}{2}, \qquad y''(0) = \tfrac{1}{2} \times \tfrac{1}{2} = \tfrac{1}{4}, \qquad y'''(0) = \tfrac{1}{2}\left(\tfrac{1}{4} - \tfrac{1}{4}\right) = 0 . \]
\[ \ln(1 + \mathrm{e}^x) = \ln 2 + \frac{x}{2} + \frac{x^2}{8} + 0x^3 + \cdots \]
Hence: \(\dfrac{\mathrm{e}^x}{1 + \mathrm{e}^x}\) is \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\). Differentiate the series term by term:
\[ \frac{\mathrm{e}^x}{1 + \mathrm{e}^x} = \frac{1}{2} + \frac{x}{4} + 0x^2 + \cdots \]
Common errors
| ✗ Wrong | ✓ Right | Why |
|---|---|---|
| Coefficient of \(x^3\) is \(f'''(0)\) | \(\dfrac{f'''(0)}{3!}\) | Divide by \(k!\). |
| Using \(f'''(x)\) instead of \(f'''(0)\) | Put \(x = 0\) | The coefficients are numbers, not functions. |
| A Maclaurin series for \(\ln x\) | Use \(\ln(1 + x)\) | \(\ln 0\) is not defined. |
| \(\sin x = x - \frac{x^3}{3} + \frac{x^5}{5} - \cdots\) | \(x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots\) | That series (without factorials) is \(\arctan x\). |
| Leaving out a zero term without saying so | write “\(+\,0x^3\)” or “the \(x^3\) term is zero” | “Up to the term in \(x^3\)” asks for the \(x^3\) coefficient, even if it is \(0\). |
| Forgetting the chain rule when differentiating \(\mathrm{e}^{-y}\) | \(\frac{\mathrm{d}}{\mathrm{d}x}\mathrm{e}^{-y} = -\mathrm{e}^{-y}y'\) | \(y\) is a function of \(x\). |
Exercises
1 Let \(f(x) = \mathrm{e}^{3x}\). Write down \(f^{(n)}(x)\), and hence find the Maclaurin series of \(f(x)\) up to the term in \(x^3\).
\(f^{(n)}(x) = 3^n\mathrm{e}^{3x}\), so \(f^{(n)}(0) = 3^n\).
\(\mathrm{e}^{3x} = 1 + 3x + \dfrac{9}{2!}x^2 + \dfrac{27}{3!}x^3 + \cdots = 1 + 3x + \dfrac{9}{2}x^2 + \dfrac{9}{2}x^3 + \cdots\)
2 Use the Maclaurin series formula to find the series for \(\sqrt{1 + x}\) up to the term in \(x^3\).
\(f = (1 + x)^{\frac{1}{2}}\), \(f' = \frac{1}{2}(1 + x)^{-\frac{1}{2}}\), \(f'' = -\frac{1}{4}(1 + x)^{-\frac{3}{2}}\), \(f''' = \frac{3}{8}(1 + x)^{-\frac{5}{2}}\).
At \(0\): \(1, \frac{1}{2}, -\frac{1}{4}, \frac{3}{8}\). \(\;\sqrt{1 + x} = 1 + \dfrac{x}{2} - \dfrac{x^2}{8} + \dfrac{x^3}{16} + \cdots\) (the same as the binomial series with \(p = \frac{1}{2}\)).
3 Use the Maclaurin series formula (not differentiation of the \(\sin x\) series) to find the first four non-zero terms of the series for \(\cos x\).
Derivatives: \(\cos x, -\sin x, -\cos x, \sin x, \cos x, \ldots\); at \(0\): \(1, 0, -1, 0, 1, 0, -1, \ldots\)
\(\cos x = 1 - \dfrac{x^2}{2!} + \dfrac{x^4}{4!} - \dfrac{x^6}{6!} + \cdots = 1 - \dfrac{x^2}{2} + \dfrac{x^4}{24} - \dfrac{x^6}{720} + \cdots\)
4 A function satisfies \(f(0) = 2\), \(f'(0) = -1\), \(f''(0) = 6\) and \(f'''(0) = 12\). Write down \(M_3(x)\), and use it to estimate \(f(0.1)\).
\(M_3(x) = 2 - x + \dfrac{6}{2!}x^2 + \dfrac{12}{3!}x^3 = 2 - x + 3x^2 + 2x^3\).
\(f(0.1) \approx 2 - 0.1 + 0.03 + 0.002 = 1.932\).
5 Find the Maclaurin series for \(\tan x\) up to and including the term in \(x^3\).
\(f' = \sec^2 x\), \(\;f'' = 2\sec^2 x\tan x\), \(\;f''' = 4\sec^2 x\tan^2 x + 2\sec^4 x\).
At \(0\): \(f = 0\), \(f' = 1\), \(f'' = 0\), \(f''' = 0 + 2 = 2\). \(\;\tan x = x + \dfrac{2}{3!}x^3 + \cdots = x + \dfrac{x^3}{3} + \cdots\)
6 Explain why neither \(f(x) = \ln x\) nor \(g(x) = \sqrt{x}\) has a Maclaurin series.
\(\ln 0\) is not defined, so \(f(0)\) does not exist.
\(g(0) = 0\) exists, but \(g'(x) = \dfrac{1}{2\sqrt{x}}\) is not defined at \(x = 0\), so \(g'(0)\) does not exist.
7 Given that \(y = \mathrm{e}^{2\sin x}\), show that \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 2y\cos x\). By repeated differentiation, find the Maclaurin series for \(y\) up to and including the term in \(x^3\).
Chain rule: \(y' = 2\cos x\,\mathrm{e}^{2\sin x} = 2y\cos x\).
\(y'' = 2y'\cos x - 2y\sin x\), \(\quad y''' = 2y''\cos x - 4y'\sin x - 2y\cos x\).
At \(0\): \(y = 1\), \(y' = 2\), \(y'' = 4\), \(y''' = 8 - 0 - 2 = 6\).
\(y = 1 + 2x + \dfrac{4}{2}x^2 + \dfrac{6}{6}x^3 + \cdots = 1 + 2x + 2x^2 + x^3 + \cdots\)
8 Given that \(y = \mathrm{e}^{\arctan x}\), show that \((1 + x^2)\dfrac{\mathrm{d}y}{\mathrm{d}x} = y\). By differentiating this result twice, find the Maclaurin series for \(y\) up to and including the term in \(x^3\).
\(y' = \dfrac{1}{1 + x^2}\mathrm{e}^{\arctan x}\), so \((1 + x^2)y' = y\).
Differentiate: \((1 + x^2)y'' + 2xy' = y'\). Again: \((1 + x^2)y''' + 2xy'' + 2y' + 2xy'' = y''\), i.e. \((1 + x^2)y''' + 4xy'' + 2y' = y''\).
At \(0\): \(y = 1\), \(y' = 1\), \(y'' = 1\), \(y''' = y'' - 2y' = -1\).
\(y = 1 + x + \dfrac{x^2}{2} - \dfrac{x^3}{6} + \cdots\)
9 Using the series for \(\ln(1 + x)\), find the first three non-zero terms of the Maclaurin series for \(\ln\left(\dfrac{3 + x}{3 - x}\right)\).
\(\ln\left(\dfrac{3 + x}{3 - x}\right) = \ln\left(1 + \frac{x}{3}\right) - \ln\left(1 - \frac{x}{3}\right) = 2\left(\frac{x}{3} + \frac{1}{3}\left(\frac{x}{3}\right)^3 + \frac{1}{5}\left(\frac{x}{3}\right)^5 + \cdots\right)\)
\(= \dfrac{2x}{3} + \dfrac{2x^3}{81} + \dfrac{2x^5}{1215} + \cdots\)
10 For \(f(x) = \mathrm{e}^x\), find the smallest \(n\) for which \(M_n(1)\) is equal to \(\mathrm{e}\) when both are rounded to 3 decimal places.
\(M_n(1) = 1 + 1 + \frac{1}{2} + \frac{1}{6} + \cdots + \frac{1}{n!}\):
| \(n\) | 4 | 5 | 6 | 7 |
|---|---|---|---|---|
| \(M_n(1)\) | \(2.708333\) | \(2.716667\) | \(2.718056\) | \(2.718254\) |
\(\mathrm{e} = 2.718282\ldots \approx 2.718\). \(\;M_5(1) \approx 2.717\), \(M_6(1) \approx 2.718\). So \(n = 6\).