Taylor Polynomials

A computer can only add, subtract, multiply, and divide—so how does your calculator compute \(\sin(0.5)\) or \(e^1\)? It replaces the curvy function with a polynomial that matches it near a starting point. That's a Taylor polynomial.

By the end you can

From tangent lines to Taylor polynomials

In AB, you already built the degree-1 Taylor polynomial: the tangent line at \(x = a\)!

\[ P_1(x) = f(a) + f'(a)(x - a) \]

It matches \(f\) in value and slope at \(x = a\). To hug the curve even tighter, add a quadratic term to match the concavity (\(f''(a)\)), a cubic term to match \(f'''(a)\), and so on:

\[ P_n(x) = c_0 + c_1(x-a) + c_2(x-a)^2 + c_3(x-a)^3 + \dots + c_n(x-a)^n \]

Where does \(k!\) come from? Differentiate \((x-a)^3\) three times: first you get \(3(x-a)^2\), then \(3\cdot 2(x-a)\), then \(3\cdot 2\cdot 1 = 3!\). So for \(P'''(a)\) to equal \(f'''(a)\), we need \(c_3 \cdot 3! = f'''(a)\), which forces \(c_3 = \dfrac{f'''(a)}{3!}\). The same thing happens at every power \(k\):

\(n\)th-degree Taylor polynomial for \(f\) centered at \(x = a\)
\[ P_n(x) = \sum_{k=0}^{n} \frac{f^{(k)}(a)}{k!}(x - a)^k \] \[ = f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \frac{f'''(a)}{3!}(x-a)^3 + \dots + \frac{f^{(n)}(a)}{n!}(x-a)^n \]

When the center is \(a = 0\), a Taylor polynomial has a special nickname: a Maclaurin polynomial.

See it: Polynomials hugging a function

Drag the degree \(n\) up and watch \(P_n(x)\) wrap tighter around \(f(x)\). Try \(\ln(1+x)\) and \(\frac{1}{1-x}\) too—notice how the polynomial refuses to match past \(|x| = 1\) (a preview of Radius of Convergence!).

Building Taylor polynomials (4 worked examples)

Make a quick 2-column scratch table of \(f^{(k)}(x)\) and \(f^{(k)}(a)\), then plug into the formula.

Example 1 · Maclaurin polynomial for \(e^x\)

Find the 3rd-degree Maclaurin polynomial \(P_3(x)\) for \(f(x) = e^x\).

  1. Every derivative of \(e^x\) is \(e^x\), so at \(a = 0\): \(f(0) = f'(0) = f''(0) = f'''(0) = e^0 = 1\).
  2. Plug into the formula with \(a = 0\): \[ P_3(x) = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} = 1 + x + \frac{x^2}{2} + \frac{x^3}{6} \]
\(P_3(x) = 1 + x + \dfrac{x^2}{2} + \dfrac{x^3}{6}\)
Example 2 · Degree vs. number of nonzero terms

Find the 4th-degree Maclaurin polynomial \(P_4(x)\) for \(f(x) = \cos x\).

  1. List derivatives at \(a = 0\):
    • \(f(0) = \cos 0 = 1\)
    • \(f'(0) = -\sin 0 = 0\)
    • \(f''(0) = -\cos 0 = -1\)
    • \(f'''(0) = \sin 0 = 0\)
    • \(f^{(4)}(0) = \cos 0 = 1\)
  2. Plug in (the odd terms vanish!): \[ P_4(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} = 1 - \frac{x^2}{2} + \frac{x^4}{24} \] Notice \(P_4(x)\) has degree 4, even though it only has 3 nonzero terms!
\(P_4(x) = 1 - \dfrac{x^2}{2} + \dfrac{x^4}{24}\)
Example 3 · Centered away from zero (\(a \ne 0\))

Find the 3rd-degree Taylor polynomial for \(f(x) = \ln x\) centered at \(a = 1\).

  1. Compute derivatives and evaluate at \(a = 1\):
    • \(f(x) = \ln x \Rightarrow f(1) = 0\)
    • \(f'(x) = x^{-1} \Rightarrow f'(1) = 1\)
    • \(f''(x) = -x^{-2} \Rightarrow f''(1) = -1\)
    • \(f'''(x) = 2x^{-3} \Rightarrow f'''(1) = 2\)
  2. Plug into \(P_3(x)\) with powers of \((x - 1)\): \[ P_3(x) = 0 + 1(x-1) + \frac{-1}{2!}(x-1)^2 + \frac{2}{3!}(x-1)^3 \]
  3. Simplify \(\frac{2}{6} = \frac{1}{3}\):
\(P_3(x) = (x-1) - \dfrac{(x-1)^2}{2} + \dfrac{(x-1)^3}{3}\)
Example 4 · Using \(P_2(x)\) to approximate \(\sqrt{4.1}\)

Find the 2nd-degree Taylor polynomial for \(f(x) = \sqrt{x}\) centered at \(a = 4\), and use it to approximate \(\sqrt{4.1}\).

  1. Derivatives at \(a = 4\):
    • \(f(4) = \sqrt{4} = 2\)
    • \(f'(x) = \frac12 x^{-1/2} \Rightarrow f'(4) = \frac14\)
    • \(f''(x) = -\frac14 x^{-3/2} \Rightarrow f''(4) = -\frac{1}{32}\)
  2. Build \(P_2(x)\) (don't forget to divide \(f''(4)\) by \(2! = 2\)!): \[ P_2(x) = 2 + \frac{1}{4}(x-4) - \frac{1}{64}(x-4)^2 \]
  3. Plug in \(x = 4.1\) (so \(x - 4 = 0.1\)): \[ P_2(4.1) = 2 + \frac{0.1}{4} - \frac{0.01}{64} = 2 + 0.025 - 0.00015625 \approx 2.02484 \] The exact value is \(\sqrt{4.1} \approx 2.02485\)—accurate to 4 decimal places from just three terms!
\(P_2(x) = 2 + \frac14(x-4) - \frac{1}{64}(x-4)^2\); \(\sqrt{4.1} \approx 2.025\).

Two huge AP skills: tables & working backwards

Skill 1: Building from a table of derivatives

On FRQs, AP rarely asks you to differentiate an ugly formula 4 times—it hands you a table of \(f(a), f'(a), f''(a), \dots\) directly!

Example 5 · Table problem

A function \(f\) has derivatives of all orders with \(f(2) = -3,\; f'(2) = 5,\; f''(2) = 4,\; f'''(2) = -12\). Write the 3rd-degree Taylor polynomial for \(f\) about \(x = 2\).

  1. Plug straight into the formula (remember \(x - 2\) and \(k!\)): \[ P_3(x) = -3 + 5(x-2) + \frac{4}{2!}(x-2)^2 + \frac{-12}{3!}(x-2)^3 \]
  2. Simplify: \(-3 + 5(x-2) + 2(x-2)^2 - 2(x-2)^3\).
\(P_3(x) = -3 + 5(x-2) + 2(x-2)^2 - 2(x-2)^3\)

Skill 2: Working backwards (reading derivatives from coefficients)

Since the coefficient of \((x - a)^k\) is \(c_k = \dfrac{f^{(k)}(a)}{k!}\), solving for \(f^{(k)}(a)\) gives:

Reading a derivative off a Taylor polynomial
\[ f^{(k)}(a) = k! \cdot c_k \]
Example 6 · Reading derivatives & local extrema

Suppose the 3rd-degree Taylor polynomial for \(g\) about \(x = 5\) is \(P_3(x) = 7 - 4(x-5)^2 + \tfrac12(x-5)^3\). Find \(g(5), g'(5), g''(5), g'''(5)\), and determine if \(g\) has a relative max, min, or neither at \(x = 5\).

  1. Match each coefficient \(c_k\) and multiply by \(k!\):
    • \(g(5) = 0!\cdot 7 = 7\)
    • \(g'(5) = 1!\cdot 0 = 0\) (there is no \((x-5)^1\) term!)
    • \(g''(5) = 2!\cdot (-4) = -8\)
    • \(g'''(5) = 3!\cdot \tfrac12 = 3\)
  2. Second Derivative Test: since \(g'(5) = 0\) and \(g''(5) = -8 < 0\), \(g\) has a relative maximum at \(x = 5\).
\(g(5)=7,\; g'(5)=0,\; g''(5)=-8,\; g'''(5)=3\); relative maximum at \(x = 5\).
Differentiating and integrating Taylor polynomials

If \(P(x)\) is the Taylor polynomial for \(f(x)\), then \(P'(x)\) is the Taylor polynomial for \(f'(x)\), and \(\int_a^x P(t)\,dt\) is the Taylor polynomial for \(\int_a^x f(t)\,dt\)! For example, differentiating \(P_4(x) = 1 - \frac{x^2}{2} + \frac{x^4}{24}\) for \(\cos x\) gives \(-x + \frac{x^3}{6}\), which is \(P_3(x)\) for \(-\sin x\). We'll use this power tool constantly in Taylor & Maclaurin Series.

If the Taylor polynomial for \(f\) about \(x = 3\) is \(P_3(x) = 2 + 6(x-3) - 5(x-3)^2 + 4(x-3)^3\), what is \(f'''(3)\)?

The coefficient of \((x-3)^3\) is \(\frac{f'''(3)}{3!} = 4\), so \(f'''(3) = 4 \cdot 3! = 4 \cdot 6 = 24\). Forgetting to multiply by \(3! = 6\) is the classic multiple-choice trap!

Careful with wording! What is the difference between "the 3rd-degree Maclaurin polynomial for \(\sin x\)" and "the first 3 nonzero terms of the Maclaurin series for \(\sin x\)"?

Read AP prompts like a hawk! "Degree \(n\)" means highest power is \(x^n\) (so for \(\sin x\), \(P_3(x) = x - \frac{x^3}{6}\) has only 2 nonzero terms). "First \(k\) nonzero terms" means keep going until you have written \(k\) terms that aren't zero!

Common mistakes

Watch out for these

Practice problems

Warm-up

Write the 5th-degree Maclaurin polynomial for \(f(x) = \sin x\).

Hint

Derivatives of \(\sin x\) at \(0\) cycle: \(0, 1, 0, -1, 0, 1\).

Solution
\[ P_5(x) = x - \frac{x^3}{3!} + \frac{x^5}{5!} = x - \frac{x^3}{6} + \frac{x^5}{120} \]
\(P_5(x) = x - \dfrac{x^3}{6} + \dfrac{x^5}{120}\)
Warm-up

Find the 3rd-degree Taylor polynomial for \(f(x) = \dfrac{1}{x}\) centered at \(a = 1\).

Hint

\(f(1)=1,\; f'(1)=-1,\; f''(1)=2,\; f'''(1)=-6\). Notice how the factorials cancel completely!

Solution
\[ P_3(x) = 1 - (x-1) + \frac{2}{2!}(x-1)^2 - \frac{6}{3!}(x-1)^3 = 1 - (x-1) + (x-1)^2 - (x-1)^3 \]
\(P_3(x) = 1 - (x-1) + (x-1)^2 - (x-1)^3\)
Medium

Let \(f\) satisfy \(f(3) = 4,\; f'(3) = -2,\; f''(3) = 6,\; f'''(3) = 18\).
(a) Write \(P_3(x)\) centered at \(x = 3\).
(b) Use \(P_3(x)\) to approximate \(f(3.1)\).

Hint

Divide \(6\) by \(2!\) and \(18\) by \(3!\), then plug in \(x - 3 = 0.1\).

Solution

(a) \(P_3(x) = 4 - 2(x-3) + 3(x-3)^2 + 3(x-3)^3\).

(b) \(P_3(3.1) = 4 - 2(0.1) + 3(0.01) + 3(0.001) = 4 - 0.2 + 0.03 + 0.003 = 3.833\).

(a) \(4 - 2(x-3) + 3(x-3)^2 + 3(x-3)^3\); (b) \(3.833\)
Medium

The 4th-degree Taylor polynomial for \(h(x)\) about \(x = -1\) is \(P_4(x) = 5 + 3(x+1)^2 - \frac14(x+1)^4\). Find \(h'(-1)\), \(h''(-1)\), and \(h^{(4)}(-1)\), and determine whether \(h\) has a relative min, max, or neither at \(x = -1\).

Hint

Use \(h^{(k)}(-1) = k!\cdot c_k\). Look for the missing \((x+1)^1\) term.

Solution

\(h'(-1) = 0\), \(h''(-1) = 2!\cdot 3 = 6\), \(h^{(4)}(-1) = 4!\cdot(-\frac14) = -6\).

Since \(h'(-1) = 0\) and \(h''(-1) = 6 > 0\), \(h\) has a relative minimum at \(x = -1\).

\(h'(-1)=0,\; h''(-1)=6,\; h^{(4)}(-1)=-6\); relative minimum at \(x = -1\).
AP-style

Using \(P_3(x) = 1 + x + \frac{x^2}{2} + \frac{x^3}{6}\) for \(e^x\), write the 4th-degree Maclaurin polynomial for \(g(x) = \displaystyle\int_0^x e^t\,dt\) and the 2nd-degree Maclaurin polynomial for \(h(x) = e^{2x}\).

Hint

Integrate \(P_3(t)\) term-by-term for \(g\); substitute \(2x\) for \(x\) in \(P_2\) for \(h\).

Solution

For \(g(x)\): \(\int_0^x (1 + t + \frac{t^2}{2} + \frac{t^3}{6})\,dt = x + \frac{x^2}{2} + \frac{x^3}{6} + \frac{x^4}{24}\).

For \(h(x) = e^{2x}\): \(1 + (2x) + \frac{(2x)^2}{2} = 1 + 2x + 2x^2\).

\(g\): \(x + \frac{x^2}{2} + \frac{x^3}{6} + \frac{x^4}{24}\); \(h\): \(1 + 2x + 2x^2\).