Taylor polynomial approximation
The tangent line of topic 4.6, \(\cy{L(x)}=f(a)+f'(a)(x-a)\), has the value and the slope of \(f\) at its center \(a\). A polynomial of higher degree can also match the second derivative of \(f\) at \(a\), the third, and so on. In powers of the displacement \(x-a\) from the center, a polynomial of degree at most \(n\) is
with the coefficients \(c_0,c_1,\dots,c_n\). This topic finds the coefficients that match \(f\) and its first \(n\) derivatives at \(a\). It then approximates \(f\) with the result and reads the information that the polynomial provides.
Matching the derivatives at the center
The graph of f(x) = √x for x from 0 to 9. It starts at the origin and rises more and more slowly through (4, 2) and (9, 3). An orange dot at (4, 2) marks the center, with a faint dashed vertical line through it. An orange polynomial of the degree set by a slider, from 1 to 4, passes through the dot: at degree 1 it is the tangent line, and from degree 2 on it bends with the curve and stays close to it over a wider interval as the degree rises. Red shading fills the gap between the two curves, which is widest near the origin. A faint dashed line marks an input x, at 0.25 at first, where a chalk dot on the curve and an orange dot on the polynomial are joined by a red segment. A button moves the center along the curve to the origin, where the curve has a vertical tangent. On the way the shading fades and the polynomial becomes steeper at the center, and at the origin only the curve and the orange dot remain.
In Figure 1, \(f(x)=\sqrt{x}\), and the orange dot marks the center \(a=4\).
The coefficients come from the derivatives of \(p\) at \(a\), taken one term at a time. For \(k\ge1\), the power rule and the chain rule give \(k(x-a)^{k-1}\) as the derivative of \((x-a)^k\). Each differentiation brings the exponent down as a factor and lowers it by one, so \(k\) of them leave a constant:
Fewer differentiations than the exponent leave a factor \(x-a\), so the result is 0 at \(x=a\). More differentiations than the exponent leave 0 everywhere. At \(a\), only the term \(c_k(x-a)^k\) therefore contributes to the \(k\)th derivative of \(p\), and \(p^{(k)}(a)=k!\,c_k\). With \(0!=1\), this holds for \(k=0\) too, because \(p(a)=c_0\).
The polynomial matches the \(k\)th derivative of \(f\) at \(a\) exactly when \(c_k=\frac{f^{(k)}(a)}{k!}\). With these coefficients for \(k=0,1,\dots,n\), \(p\) is the Taylor polynomial of degree \(n\) for \(f\) about \(a\), written \(\cy{P_n}\). Some books say “of order \(n\)” or “centered at \(a\)”. About the center 0, it is also called a Maclaurin polynomial. It exists only if \(f\) has derivatives of orders 1 through \(n\) at \(a\). Each coefficient is forced, so no other polynomial of degree at most \(n\) matches \(f(a),f'(a),\dots,f^{(n)}(a)\).
For \(f(x)=\sqrt{x}\), \(f(4)=2\), and the derivatives \(f'(x)=\frac12x^{-1/2}\) and \(f''(x)=-\frac14x^{-3/2}\) give \(f'(4)=\frac14\) and \(f''(4)=-\frac{1}{32}\). Divide by \(0!\), \(1!\) and \(2!\) to find the polynomial of degree 2 in Figure 1:
Move the degree slider from 1 to 4. At degree 1, the orange curve is the tangent line at the orange dot. At degree 2, it also bends downward like the chalk curve, because \(f''(4)<0\). Each added degree keeps the curves close over a wider interval around the center, and the red shading shrinks.
The coefficients use only the values of \(f\) and its derivatives at the center. Choose a center where these values are known exactly, close to the inputs you need.
Every coefficient after the first needs a derivative at the center. Use the button under Figure 1 to move the center to 0. On the way, the orange curve becomes steeper at the center, because \(f'(a)=\frac{1}{2\sqrt{a}}\) grows without bound as \(a\) approaches 0. At 0 the graph has a vertical tangent, so \(f'(0)\) does not exist. No Taylor polynomial of degree 1 or more exists there, so only the chalk curve and the orange dot at the center remain.
Approximating a value
Near the center, \(f(x)\approx\cy{P_n(x)}\). In Figure 1, with the center at 4, a faint dashed line marks the input \(x\). The chalk dot on it has the height \(f(x)\), and the orange dot has the height \(\cy{P_n(x)}\). The red segment between them shows the error, or remainder, \(\cr{R_n(x)}=f(x)-\cy{P_n(x)}\).
To evaluate \(\cy{P_n(x)}\), find the displacement \(x-a\), which is negative to the left of the center. Then raise it to each power. The coefficient of \((x-a)^k\) does not depend on \(n\), so \(\cy{P_{n-1}}\) is \(\cy{P_n}\) without its last term. Use the degree that a question asks for, because another degree can give another value.
To approximate \(\sqrt5\), use the center 4, where \(\sqrt4=2\). The center 5 would need \(\sqrt5\) itself. At \(x=5\) the displacement is 1, so \(\cy{P_2(5)}=2+\frac14-\frac{1}{64}=\frac{143}{64}\). This is about 2.2344, and \(\sqrt5\approx2.2361\).
At the start of Figure 1, \(n=2\) and \(x=0.25\), where the error is about \(-0.34\). Raise the degree to 4. The red segment shortens, and the error becomes about \(-0.18\). Then drag the input toward the center. The segment shrinks, and at \(x=4\) it has length 0 at every degree, because \(\cy{P_n(4)}=f(4)\).
The error and its first \(n\) derivatives are 0 at \(a\), because \(\cy{P_n}\) matches \(f\) there. Because \(f^{(n)}(a)\) exists, the derivatives of lower order exist on an interval around \(a\). Then \(n-1\) uses of L’Hôpital’s rule (topic 4.7), each on a form \(\frac00\) and none if \(n=1\), turn \(\cr{R_n(x)}/(x-a)^n\) into \(\cr{R_n^{(n-1)}(x)}/\big(n!\,(x-a)\big)\). Because \(\cr{R_n^{(n-1)}(a)}=0\), this is a difference quotient of \(\cr{R_n^{(n-1)}}\) divided by \(n!\), so it approaches \(\cr{R_n^{(n)}(a)}/n!=0\). Near the center, the error is therefore small even compared with \((x-a)^n\), a power that shrinks faster at a higher degree. For many functions, as in Figure 1, a higher degree also helps farther from the center. The limit gives no information there, and topic 10.12 bounds the error.
Reading a Taylor polynomial
When a problem gives \(\cy{P_n}\), each coefficient gives a derivative at the center: \(f^{(k)}(a)=k!\,c_k\) for \(k\) from 0 to \(n\). A power \((x-a)^k\) with \(k\le n\) that does not appear has the coefficient 0, so \(f^{(k)}(a)=0\), even for \(k=n\). These values are exact. The height of the graph at the center is \(c_0\), its slope is \(c_1\), and \(c_2\) has the sign of \(f''(a)\). If \(c_1=0\) and \(c_2\ne0\), the Second Derivative Test (topic 5.7) gives a local minimum at \(a\) when \(c_2>0\) and a local maximum when \(c_2<0\).
The polynomial gives no derivative of order above \(n\), and away from the center it gives only approximations. For example, add \(b(x-a)^4\) to a polynomial \(\cy{P_3}\) of degree 3. The term and its first three derivatives are 0 at \(a\), so \(f(x)=\cy{P_3(x)}+b(x-a)^4\) has the value and the first three derivatives of \(\cy{P_3}\) there. By the uniqueness above, \(\cy{P_3}\) is the Taylor polynomial of degree 3 for \(f\), for every \(b\), but \(f^{(4)}(a)=24b\).
An orange cubic polynomial with an orange dot at its center a, which a faint dashed vertical line marks. A chalk curve meets the polynomial at the dot with the same slope and the same bend. A slider sets a constant b from −0.2 to 0.2. The chalk curve is the polynomial plus b times the fourth power of the distance from a, so it lies above the polynomial when b is positive and below it when b is negative, and the gap between them grows away from the center. The orange curve does not move. Red shading fills the gap between them. At an input x to the right of the center, a faint dashed line has a chalk dot on the curve and an orange dot on the polynomial, joined by a red segment.
Move the slider under Figure 2. The chalk curve moves, but the orange curve stays, and at the center the curves keep the same height, slope and bend. The red segment at \(x\) has the length \(|b|(x-a)^4\), which changes with \(b\), while \(\cy{P_3(x)}\) does not.
Example 1
Build a Taylor polynomial at the correct center
Find the third-degree Taylor polynomial for \(f(x)=xe^x\) about \(x=-1\).
Solution
The function \(f\) has derivatives of all orders. By the product rule, \(f'(x)=e^x+xe^x\), which is \((x+1)e^x\). Each further differentiation adds another \(e^x\) in the same way, so the \(k\)th derivative is \(f^{(k)}(x)=(x+k)e^x\). At the center \(-1\), the values are
The factorials of the orders are 1, 1, 2 and 6. Dividing by them gives the coefficients \(-\frac1e\), 0, \(\frac{1}{2e}\) and \(\frac{1}{3e}\). The center is \(-1\), so the powers are of \(x-(-1)=x+1\):
The polynomial has no term of degree 1, because \(f'(-1)=0\): the graph of \(f\) has a horizontal tangent at the center.
Example 2
Distinguish coefficients from derivatives
The function \(h\) has derivatives of all orders, and the table gives \(h\) and its first three derivatives at \(x=5\). Write the third-degree Taylor polynomial for \(h\) about \(x=5\). In the fourth-degree Taylor polynomial for \(h\) about \(x=5\), the coefficient of \((x-5)^4\) is \(\frac13\). Find \(h^{(4)}(5)\). \[\begin{array}{c|cccc}k&0&1&2&3\\\hline h^{(k)}(5)&9&10&14&-12\end{array}\]
Solution
The center is 5, so the polynomial uses powers of \(x-5\). Each coefficient is the derivative in the table divided by the factorial of its order:
Write each coefficient in front of its power of \(x-5\):
In the other direction, a derivative at the center is its coefficient times the factorial of its order:
Example 3
Use the polynomial to approximate a value
The fourth-degree Taylor polynomial for \(\ln x\) about \(x=1\) is \[\begin{aligned}P_4(x)={}&(x-1)-\tfrac12(x-1)^2\\&+\tfrac13(x-1)^3\\&-\tfrac14(x-1)^4\end{aligned}\] Use the third-degree Taylor polynomial for \(\ln x\) about \(x=1\) to approximate \(\ln 0.8\).
Solution
The coefficients do not depend on the degree, so the third-degree polynomial \(\cy{P_3}\) is \(P_4\) without its last term. The input 0.8 lies 0.2 to the left of the center, so the displacement is \(x-1=-0.2\). Its square is 0.04, and its cube is \(-0.008\):
The approximation is \(\ln 0.8\approx-\frac{167}{750}\).
Example 4
Read the information a polynomial provides
The third-degree Taylor polynomial for a function \(g\) about \(x=0\) is \(T(x)=5-4x^2+2x^3\). Does \(g\) have a relative maximum, a relative minimum, or neither at \(x=0\)? Justify your answer. Find \(g'''(0)\). Can \(g^{(4)}(0)\) or \(g\big(\tfrac12\big)\) be found from \(T\)?
Solution
Because \(T\) exists, \(g\) has derivatives of orders 1 through 3 at 0. The coefficients of \(T\) are \(c_0=5\), \(c_1=0\), \(c_2=-4\) and \(c_3=2\), since \(T\) has no term in \(x\). Each gives a derivative, \(g^{(k)}(0)=k!\,c_k\):
Because \(g'(0)=0\) and \(g''(0)<0\), the Second Derivative Test shows that \(g\) has a relative maximum at \(x=0\), with the value \(g(0)=5\).
The problem gives the Taylor polynomial of degree 3, so \(T\) gives no fourth derivative. Each function \(T(x)+bx^4\) has \(T\) as its third-degree Taylor polynomial about 0, but its fourth derivative at 0 is \(24b\). The value \(T\big(\tfrac12\big)=\tfrac{17}{4}\) only approximates \(g\big(\tfrac12\big)\), because \(\tfrac12\) is not the center.
Each example is one of the four skills of topic 10.11 in Which & Why: AP Calculus.