Mistake Master
Every term is built on the centre BC only
A Taylor polynomial matches a function's value and its first $n$ derivatives at a single point. That point is the centre, and it appears in every term twice: once in the derivative being evaluated there, and once in the $(x-a)$ being raised to a power. Change it and you have a different polynomial approximating the same function somewhere else.
§1
The formula, and what each piece is for.
▸
The $n$th-degree Taylor polynomial for $f$ centred at $a$ is
$$P_n(x) = \sum_{k=0}^{n} \frac{f^{(k)}(a)}{k!}(x-a)^{k}.$$
Three ingredients, each doing a specific job:
- $f^{(k)}(a)$: the $k$th derivative, evaluated at the centre. A number, not a function.
- $k!$: the correction that makes the matching work. Differentiating $(x-a)^{k}$ down to a constant produces $k!$, so dividing by it is what leaves $f^{(k)}(a)$ behind.
- $(x-a)^{k}$: the distance from the centre, raised to the matching power.
The factorial is worth seeing rather than memorising. Differentiate $P_n$ $k$ times and set $x = a$: every term of lower degree has vanished, every term of higher degree still has a factor of $(x-a)$ and dies, and the $k$th term contributes $\frac{f^{(k)}(a)}{k!} \cdot k! = f^{(k)}(a)$. The factorial exists precisely to cancel the one differentiation produces, so omitting it makes the $k$th derivative of your polynomial $k!$ times too large.
§2
Two ways the coefficient goes wrong.
▸
The code covers two failures that look alike on the page and are not the same mistake.
The factorial is missing. Writing $f^{(3)}(a)(x-a)^{3}$ instead of $\frac{f^{(3)}(a)}{3!}(x-a)^{3}$. This is the more common of the two and it grows worse with degree: by $k = 5$ the term is $120$ times too big.
The order and the power disagree. Writing $\frac{f''(a)}{3!}(x-a)^{3}$, where a second derivative has been paired with a cubic term. The rule is that the derivative order, the factorial and the exponent are all the same number, in every term, with no exceptions. When they are written in a column it is easy to check.
A worked case. For $f(x) = e^{x}$ at $a = 0$ every derivative is $e^{x}$, so $f^{(k)}(0) = 1$ for all $k$ and
$$P_3(x) = 1 + x + \frac{x^{2}}{2} + \frac{x^{3}}{6}.$$
The coefficients are $1, 1, \frac{1}{2}, \frac{1}{6}$, which are $\frac{1}{k!}$. Getting $1 + x + x^{2} + x^{3}$ instead is the factorial omission in its purest form, and the resulting polynomial does not even have the right second derivative at $0$.
§3
The centre is part of the object.
▸
A Taylor polynomial is only claimed to be good near its centre. Ask for one centred at $a = 1$ and produce one centred at $0$, and you have not made a small error: you have approximated the same function in a different neighbourhood.
Two specific slips the code records:
- Evaluating derivatives at the wrong point. Using $f^{(k)}(0)$ while writing $(x-1)^{k}$. The two halves of each term now refer to different centres.
- Writing $x^{k}$ instead of $(x-a)^{k}$. Correct only when $a = 0$, which is why so much practice with Maclaurin series makes this one easy to slip into.
A Maclaurin polynomial is just the case $a = 0$, and it deserves no separate machinery. The reason it is singled out is that $(x-0)^{k} = x^{k}$ makes the algebra tidy, and that tidiness is exactly what disguises the general form.
One consequence worth stating: two Taylor polynomials of the same function at different centres are genuinely different polynomials, with different coefficients, that agree with $f$ at different places. Neither is more correct.
§4
What the picture shows.
▸
The figure draws $\cos x$ with $P_2(x) = 1 - \frac{x^{2}}{2}$ and $P_4(x) = 1 - \frac{x^{2}}{2} + \frac{x^{4}}{24}$ on one set of axes. Three things are visible in it, and each is a fact worth having:
- All three meet at the centre. That is the defining property, and it is why the approximation is local.
- Higher degree buys a wider match, not a better one everywhere. $P_4$ tracks the curve noticeably further out than $P_2$, and both eventually leave it.
- They leave in a definite direction. $P_2$ falls away below, $P_4$ stays nearer, and at $x = 2.5$ the values are $\cos 2.5 \approx -0.8011$, $P_4 \approx -0.4974$ and $P_2 = -2.1250$.
Two notes on efficiency. For $\cos x$ the odd derivatives vanish at $0$, so $P_2$ and $P_3$ are the same polynomial: the degree-$3$ term has coefficient zero. And the amount by which these polynomials miss is not a matter of eyeballing the picture, it is the subject of 10.12.
§5
Skill Check.
▸
Ten scenarios. Pick the chips that match your answer, then check. A scenario marks complete the first time every part is right. Progress saves on this device.