Taylor’s theorem
Let be an interval, , and an times differentiable function.
i) The polynomial function is called the n-th Taylor polynomial of in the expansion point .
ii) The function is the remainder term corresponding to .
Let be an interval, , and an times differentiable function in , where .
Then the following statements hold:
i) (Taylor’s formula) For all , where
ii) (Lagrange remainder) If is even times differentiable, then for every there exists a
between and such that
Example 1:
How to use
- Visualize Taylor’s formula for by comparing the function with its Taylor polynomial around a movable expansion point .
- See the remainder term at a chosen point :
- Drag the blue point on the curve to choose the expansion point.
- Move the slider to select the degree of the Taylor polynomial .
- Drag the orange point on the curve to choose where you evaluate the approximation.
- The blue curve is .
- The pink curve is the Taylor polynomial centered at .
- The green vertical dashed segment at the current is the remainder : its length is .
- The endpoints of the green segment are and .
- Fix and drag close to : the green segment becomes small, illustrating that approximates well near the expansion point.
- Keep fixed and increase : the pink curve typically matches the blue curve better near , and the remainder at the chosen usually decreases.
- For a fixed degree , move farther away from : the remainder generally grows, showing that Taylor polynomials are local approximations.
- Hold Shift + scroll to zoom
- Hold Shift + drag to move
- Points shaped like <> act as sliders
Example 2:
How to use
- See that Taylor’s theorem needs enough differentiability at the expansion point.
- For the function is -times differentiable at , but not -times differentiable at . The applet shows what goes wrong when you try to use degree near .
- Drag the blue point on the curve to choose the expansion point.
- Move the slider (allowed values ).
- Drag the orange point on the curve to choose where you evaluate the approximation.
- The blue curve is .
- The pink curve is the Taylor polynomial around the chosen (only shown when the required derivatives exist).
- The green vertical dashed segment at the current is the remainder (its length is ).
- If the Taylor polynomial is not defined (the “failure case”), the applet hides and , and the graph of turns red as a warning.
- First set and move close to : the Taylor polynomial is still defined, and near the remainder segment tends to get small.
- Now set and drag toward :
- as gets sufficiently close to , the applet declares the Taylor polynomial undefined (pink curve and green remainder disappear, and turns red).
- this corresponds to the fact that does not exist, so the degree-6 Taylor polynomial at is not well-defined.
- Even before the polynomial disappears, you can observe instability for when is near :
- keep ,
- choose close to ,
- move the evaluation point a bit away from ,
- notice that the remainder segment can become very large.
- Hold Shift + scroll to zoom
- Hold Shift + drag to move
- Points shaped like <> act as sliders
Description
Reference: Lecture Notes Calculus 1 ( May22,2022 ) Definition6.6 and Theorem6.19 page 115
In both applets:
- Drag the blue point to choose the expansion point.
- Use the slider to choose the Taylor degree.
- Drag the orange point to evaluate the approximation at a point.
- The vertical segment labelled visualizes the approximation error at the current .
Example 1:
For the exponential function, all derivatives exist everywhere and satisfy
Hence the Taylor polynomial is well-defined for every degree and every expansion point .
In the code, the Taylor polynomial is implemented as in the definition:
const T = (x: number) => {
const x0 = getX0();
const n = getN();
let s = 0;
const dx = x - x0;
for (let k = 0; k <= n; k++) {
s += (fDerivAt(k, x0) / factorial(k)) * Math.pow(dx, k);
}
return s;
};
The remainder is drawn as a vertical segment at the current x:
createSegment(board, [
[() => getX(), () => f(getX())],
[() => getX(), () => T(getX())],
], {
name: "Rₙ(x)",
dash: 2,
strokeWidth: 4,
withLabel: true,
}, COLORS.green);
Example 2:
In this applet we use
Equivalently,
so it coincides with for and with for .
The -th Taylor polynomial of a function at the expansion point is defined by
const T = (x: number) => {
const x0 = getX0();
const n = getN();
const dx = x - x0;
let s = 0;
for (let k = 0; k <= n; k++) {
const dk = gDerivAt(k, x0); // g^(k)(x0)
s += (dk / factorial(k)) * Math.pow(dx, k);
}
return s;
};
For , since
the function is a polynomial on each side of .
At we have
but the sixth derivative does not exist, because the left and right limits differ:
Therefore, is five times differentiable at , but not six times differentiable at .
In the applet, this situation is handled by declaring the Taylor polynomial undefined when is sufficiently close to and :
const EPS = 0.05;
const taylorIsDefined = () =>
!(Math.abs(getX0()) < EPS && getN() >= 6);
The Taylor graph and the remainder segment are hidden whenever this condition fails:
const updateVisibility = () => {
const v = taylorIsDefined();
tGraph.setAttribute({ visible: v });
rSeg.setAttribute({ visible: v });
};
board.on("update", updateVisibility);
updateVisibility();
To observe the failure, drag the blue point to and set the slider to . The Taylor polynomial disappears because is not six times differentiable at .