Build a Taylor polynomial at the correct center
A square root near 9
The chalk curve shows \(\sqrt{x}\). The orange dot marks the point \((9, 3)\), because the square root of 9 is 3.
The orange curve is a polynomial with center \(x=9\), which means it is a sum of numbers times powers of \(x-9\). The slider sets its degree, which is the highest power it uses.
At degree 1 the orange curve is the tangent line, which has the same height and slope as the chalk curve at the dot. Each added degree matches one more derivative at the center, so at degree 2 the orange curve also bends the way the chalk curve does.
The red segment at \(x=11\) is the error, which is the gap between the two curves. It is large at degree 1 and small at degree 2.
Any function, any center
The chalk curve is now any function \(f\), and the orange dot marks the center \(a\). When you move the center with the first slider, the orange polynomial moves with it and stays close to the chalk curve near the dot.
Wherever the center is, a polynomial of degree \(n\) has the same height as \(f\) there and the same first \(n\) derivatives.
Notation
Each term is a number times a power of \(x-a\), the distance from the center \(a\). The number in front of \((x-a)^k\) is the coefficient \(c_k\).
\[\begin{aligned}c_0&+c_1(x-a)+c_2(x-a)^2\\&+\cdots+c_n(x-a)^n\end{aligned}\]Every positive power of \(x-a\) is 0 at the center, so only \(c_0\) sets the height there.
The polynomial must have the same \(k\)-th derivative as \(f\) at the center. At \(x=a\), every other term of its \(k\)-th derivative is 0, and \(c_k(x-a)^k\) gives \(c_k\cdot k!\). This means \(c_k\) is the \(k\)-th derivative of \(f\) divided by \(k!\).
\[\cy{c_k}=\dfrac{f^{(k)}(a)}{k!}\]The symbol \(k!\) means \(1\cdot2\cdots k\), and \(0!=1\). For \(k=0\) the coefficient is the height \(f(a)\).
In words, the polynomial adds, for \(k\) from 0 to \(n\), the \(k\)-th derivative at the center divided by \(k!\), times \((x-a)^k\).
\[\begin{aligned}\cy{P_n(x)}&=f(a)+f'(a)(x-a)\\&\quad+\dfrac{f''(a)}{2!}(x-a)^2+\cdots\\&\quad+\dfrac{f^{(n)}(a)}{n!}(x-a)^n\end{aligned}\]The function must have derivatives up to order \(n\) at \(a\). Choose a center where they are easy to find and close to the input you need.
When it fails
The square root has a vertical tangent at \(x=0\), so it has no derivative there. This means \(c_1\) does not exist, and no polynomial of degree 1 or higher can be built at that center.
At 9 every derivative exists, and \(\sqrt9=3\) makes each one a simple fraction.
Example 1: the reciprocal near 4
Find the Taylor polynomial of degree 3 for \(f(x)=\dfrac1x\) at the center \(a=4\).
Differentiate three times.
\[\begin{aligned}f'(x)&=-\dfrac{1}{x^2},\quad f''(x)=\dfrac{2}{x^3}\\f'''(x)&=-\dfrac{6}{x^4}\end{aligned}\]Substitute the center \(x=4\) into \(f\) and into each derivative.
\[\begin{aligned}f(4)&=\dfrac14,\quad f'(4)=-\dfrac1{16}\\f''(4)&=\dfrac1{32},\quad f'''(4)=-\dfrac3{128}\end{aligned}\]Divide the \(k\)-th derivative by \(k!\), which is 1, 1, 2 and 6, to find the coefficients. The orange curve grows one term at a time.
\[\dfrac14,\quad -\dfrac1{16},\quad \dfrac1{64},\quad -\dfrac1{256}\]Multiply each coefficient by its power of \(x-4\). The orange curve touches the chalk curve at the dot.
\[\begin{aligned}\cy{P_3(x)}&=\dfrac14-\dfrac{x-4}{16}\\&\quad+\dfrac{(x-4)^2}{64}-\dfrac{(x-4)^3}{256}\end{aligned}\]
Example 2: the cosine at π/3
Find the Taylor polynomial of degree 3 for \(f(x)=\cos x\) at the center \(a=\dfrac{\pi}{3}\).
At \(x=\pi/3\) the cosine is \(\tfrac12\) and the sine is \(\tfrac{\sqrt3}{2}\). The derivatives of the cosine are \(-\sin x\), \(-\cos x\) and \(\sin x\), so the four values are:
\[\begin{aligned}f&=\dfrac12,\quad f'=-\dfrac{\sqrt3}{2}\\f''&=-\dfrac12,\quad f'''=\dfrac{\sqrt3}{2}\end{aligned}\]Divide by the factorials 1, 1, 2 and 6 to find the coefficients.
\[\dfrac12,\quad -\dfrac{\sqrt3}{2},\quad -\dfrac14,\quad \dfrac{\sqrt3}{12}\]A tempting wrong move: Write each coefficient in front of a power of \(x\).
\[\cr{\dfrac12-\dfrac{\sqrt3}{2}\,x-\dfrac14\,x^2+\dfrac{\sqrt3}{12}\,x^3}\]At the center \(x=\pi/3\) this polynomial gives about \(-0.515\), but the chalk curve is at \(0.5\) there. The red curve misses the dot.
Write each coefficient in front of a power of \(x-\pi/3\), the distance from the center. Every term after the first is 0 at the center, so the polynomial gives \(\tfrac12\) there.
\[\begin{aligned}\cy{P_3(x)}&=\dfrac12-\dfrac{\sqrt3}{2}\left(x-\dfrac{\pi}{3}\right)\\&\quad-\dfrac14\left(x-\dfrac{\pi}{3}\right)^2\\&\quad+\dfrac{\sqrt3}{12}\left(x-\dfrac{\pi}{3}\right)^3\end{aligned}\]
Practice
Find the Taylor polynomial of degree 2 for \(f(x)=xe^{x}\) at the center \(a=-1\).
Substitute \(x=-1\) into every derivative. The dot is the lowest point of the curve, so the tangent there is flat and one coefficient is 0.
Solution
Differentiate twice with the product rule.
\[\begin{aligned}f'(x)&=(x+1)e^{x}\\f''(x)&=(x+2)e^{x}\end{aligned}\]Substitute \(x=-1\). The slope at the center is 0, so the tangent is flat.
\[\begin{aligned}f(-1)&=-\dfrac1e,\quad f'(-1)=0\\f''(-1)&=\dfrac1e\end{aligned}\]Divide \(f''(-1)\) by \(2!\) and write the powers of \(x+1\).
\[\cy{P_2(x)}=-\dfrac1e+\dfrac{(x+1)^2}{2e}\]
Questions
The chalk curve is the sine. The orange curve is a Taylor polynomial of degree 2, built at one center. Questions 1 and 2 use the figure.
At which input does the orange curve touch the chalk curve?
- \(x=\pi/2\)
- \(x=0\)
- \(x=\pi\)
Answer
\(x=\pi/2\)
What is the coefficient of \((x-\pi/2)\) in the orange polynomial?
- 0
- 1
- \(-\dfrac12\)
Answer
0
What is the Taylor polynomial of degree 2 for \(g(x)=e^{2x}\) at the center \(a=1\)?
- \(e^2\left[1+2(x-1)+2(x-1)^2\right]\)
- \(e^2\left[1+2(x-1)+4(x-1)^2\right]\)
- \(e^2\left[1+2x+2x^2\right]\)
Answer
\(e^2\left[1+2(x-1)+2(x-1)^2\right]\)
Summary
You choose a center \(a\), find the derivatives of \(f\) there, and divide each by its factorial to find the coefficients.
Every positive power of \(x-a\) is 0 at the center, so the polynomial has the same height as the function there.
You use a Taylor polynomial to approximate a function near its center, so you choose a center close to the input.
This is one of four skills in topic 10.11 of Which & Why: AP Calculus.