Hi everyone! Now we’ll switch directions away from integration and toward infinite series. Indeed, this topic motivates everything we’ll be studying for the next several lessons.

This lesson will build on what you learned about the tangent line in your Calculus I class. We’ll spend this lesson and Lesson 12 (link here) on this topic and revisit it in Lesson 20.

Your textbook is a bit unusual in that it covers Taylor polynomials and Taylor series in the same section. We’ll start with Taylor polynomials today and then over the next several lessons build toward understanding Taylor series in Lesson 20.

Lesson 11: Taylor and Maclaurin Polynomials (part 1)

Learning goals:

  • Describe the procedure for finding a Taylor polynomial of a given order for a function.
  • Explain the relationship between the family of Taylor polynomials and the function.

Topic:

WeBWorK:

  • Series – Taylor and Maclaurin Polynomials

Motivating question

In your Calculus I class, you saw that the tangent line to the graph of a function at a point is the line that best approximates the graph near that point. Today we ask: how can we modify the tangent line to get a better approximation?

Warmup exercise 1

Determine the equation of the line tangent to the graph of $f(x) = \ln (1+x)$ at $a=0$

Show answer 1

Recall that the point-slope form of the equation of a line is $y-y_1 = m(x-x_1)$. For us, the line will pass through the point $(x_1, y_1) = (a, f(a))$ and will have slope $m = f'(a)$. So the equation becomes $y- f(a) = f'(a)(x-a)$. For reasons that will become more obvious later in the lesson, we’ll rearrange this equation to write: \[y = f(a) + f'(a)(x-a).\]

For this exercise, $a=0$ and $f(0) = \ln(1+0) = \ln(1) = 0$. Also, $f'(x) = \frac{1}{1+x}$ so $f'(0) = \frac{1}{1+0} = 1$.

So the equation of our tangent line is: $y = 0 + 1\cdot(x-0)$ so $y=x$.

Figures 1, 2, and 3 below show the graph of the function $f(x) = \ln(1+x)$ (the black dotted curve) and its tangent line at $a=0$ which we say in Warmup exercise 1 had equation $y=x$ (the solid red line). In Figure 1, we’re pretty zoomed out to see a big window. In Figure 2, we’ve zoomed in much more closely on the point of tangency and in Figure 3 we’re zoomed in even closer. Notice how in Figure 1, the black curve and red line don’t seem to have much to do with one another, but in Figure 2, the red line looks very close to the black curve and in Figure 3, there’s almost no difference. This interactive Desmos graph lets you zoom in and out on your own (link here; the interactive graph has other elements we’ll turn on later but for now you can just zoom in and out).

Figure 1
Figure 2
Figure 3

Better approximations

The motivating question above asks: can we do better?

A worse approximation

First, let’s start with a graph that does a worse job than the tangent line at approximating the graph of a function near a point. This will give us a first idea of how to find a better approximation. We can choose lots of worse approximations by just picking random functions! But we want one that’s just a little bit worse in a specific way.

Remember that the tangent line satisfies two conditions:

  1. goes through the point of tangency $(a, f(a))$, and
  2. has the same slope as the graph $y=f(x)$ right at $x=a$.

Remember that we rewrote the equation of the line tangent to the graph $y=f(x)$ at $x=a$ as

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

Notice that in our equation has two terms on the right:

  1. the first one involves $f(a)$, and
  2. the second term involves $f'(a)$.

These two terms line up exactly with the two conditions above! The first term guarantees that the tangent line passes through the point of tangency on the graph $y=f(x)$—that is, the point on the tangent line with $x=a$ has the same height as the point with $x=a$ on $y=f(x)$. The second term guarantees that the tangent line has the same slope as the graph $y=f(x)$ at $x=a$—that is, the tangent line and the function $f(x)$ have the same first derivative at $x=a$.

So one way to get an approximation of $y=f(x)$ that is worse than the tangent line near $x=a$ is to get rid of the second condition, which means to get rid of the second term, so we get:

\[y = f(a).\]

This will just be a horizontal line at the right height. You can see this approximation in Figure 4, zoomed in in Figure 5, and zoomed in again in Figure 6. This approximation isn’t bad, but it isn’t good either. We can see clearly that the tangent line is better.

Figure 4
Figure 5
Figure 6

Getting better…

Let’s call the tangent line our “first approximation” and name the function $p_1(x)$. That makes our worse approximation the “zeroth approximation” $p_0(x)$. So

  • $p_0(x) = f(a)$, and
  • $p_1(x) = f(a) + f'(a)(x-a)$.

Now let’s work on our “second approximation” $p_2(x)$. Linear functions like our first and zeroth approximations are nice because they’re familiar and easy to work with, but the tangent line is a line, so it can’t approximate a curve that well, especially as we move away from the point of tangency. So what’s the next best thing to a tangent line? What’s something that’s familiar and easy to work with, but is curved?

A tangent…parabola?

Yes! We can “correct” the equation of the tangent line by adding a small quadratic term to $p_2(x)$.

  • $p_0(x) = f(a)$,
  • $p_1(x) = f(a) + f'(a)(x-a)$, and
  • $p_2(x) = f(a) + f'(a)(x-a) + \frac{f”(a)}{2}(x-a)^2$.

In our example where $f(x) = \ln(1+x)$ and $a=0$, we have $f”(x) = \frac{-1}{(1+x)^2}$ so $f”(0)= -1$.

  • $p_0(x) = 0$,
  • $p_1(x) = 0+1\cdot(x-0) = x$
  • $p_2(x) = 0+1\cdot(x-0) + (-1)( x-0)^2 = x – x^2$.

Again, in Figures 7, 8, and 9 below we’ll look at how the graph of this quadratic function $p_2(x)$ compares to the graph of the original function $f(x) = \ln(1+x)$ near $a=0$. Again, we’ll zoom in more and more in these figures. Notice how at each of these three zoom levels, this second approximation is closer to the black dotted graph $y=f(x)$ than the first approximation (tangent line) and zeroth approximation (constant function) were.

Figure 7
Figure 8
Figure 9

Notice that our second approximation $p_2(x)$ has the same zeroth, first, and second derivatives as our original $f(x)$ does, so we’re doing a better job of approximating $f(x)$ near $x=a$.

Taylor polynomials

So we have a degree 0 approximation $p_0(x)$, a degree 1 approximation $p_1(x)$, and a degree 2 approximation $p_2(x)$. You might ask now can we do better and the answer is: yes! These are just the first three approximations on an infinite list of approximations!

  • $p_0(x) = f(a)$,
  • $p_1(x) = f(a) + f'(a)(x-a)$,
  • $p_2(x) = f(a) + f'(a)(x-a) + \frac{f”(a)}{2}(x-a)^2$,
  • $p_3(x) = f(a) + f'(a)(x-a) + \frac{f”(a)}{2}(x-a)^2 + \frac{f”(a)}{3!}(x-a)^3$,
  • $p_4(x) = f(a) + f'(a)(x-a) + \frac{f”(a)}{2}(x-a)^2 + \frac{f^{(3)}(a)}{3!}(x-a)^3 + \frac{f^{(4)}(a)}{4!}(x-a)^4$,
  • … and so on forever …

These are called Taylor polynomials of $f(x)$ centered at $x=a$. The degree $N$ Taylor polynomial of a function $f(x)$ centered at $x=a$ has the same first $N$ derivatives as $f(x)$ does at $x=a$. The higher the degree, the better the approximation.

The Taylor polynomial of degree $N$ of $f(x)$ centered at $x= a$ is given by:

\[p_N(x) = \sum_{n=0}^N \frac{f^{(n)}}{n!}(x-a)^n\]

\[ = f(a) + f'(a)(x-a) + \frac{f”(a)}{2}(x-a)^2 + \frac{f^{(3)}(a)}{3!}(x-a)^3 + \dots + \frac{f^{(N)}(a)}{N!}(x-a)^N\]

A Maclaurin polynomial is just a Taylor polynomial centered at $a=0$.

Back to our example

See the interactive Desmos graph (link here) again. More Taylor polynomials are listed on the left of the screen but by default only the tangent line is displayed. Click the grey circles to the left of the functions’ formulas to display them one by one. Notice how as the degree increases, the graphs do a better and better job of approximating the curve of the graph $y=\ln(1+x)$ near $a=0$.

Video 1 below shows us the work we must do to determine the degree 4 Taylor polynomial for $f(x)= \ln(1+x)$ centered at $a=0$—the example we’ve been working on in this lesson. Notice that the notation used is $T_n(x)$ instead of our $p_N(x)$ and uses $c$ instead of $a$ for the center.

The video also gives us a formula for the remainder (which measures how good our approximation is close to the center) and applies it to this example—we’ll come back to the remainder in Lesson 12.

Video 1

More Examples

Video 2 below takes us through some of the theory discussed above and two more examples.

Video 2

Video 3 below shows another example.

Video 3

Exercise 2

Choose your favorite angle in radians between $0$ and $\frac{\pi}{2}$. Determine the first few Taylor polynomials for $f(x) = \cos(x)$ centered at the angle you chose.

Hint: choose a special angle and perform all the calculations by hand.

Show answer 2

Your answer will depend on the angle you chose. In this interactive Desmos graph (link here) you can set the slider $a$ to be that angle. Only the degree zero and degree one Taylor polynomials are displayed by default. Click the circles next to the others on the left to display higher degree Taylor polynomials. Do the graphs match the graphs of the polynomials you found?

Applications

What can we use a Taylor polynomial for? Polynomials are nice functions for computers and calculators since they’re built from the elementary operations: $+$, $-$, $\times$. Some calculators actually use Taylor polynomials instead of the original functions they’re based on. So for example, when you ask the calculator for $\sin(0.1)$ the calculator might use the degree 10 Taylor polynomial for $f(x)=\sin(x)$ centered at $x=0$ and spit out $T_{10}(0.1)$ instead of using the function $\sin(x)$ itself. We know that $T_{10}(x)$ just approximates $\sin(x)$ near $x=0$, so $T_{10}(0.1)$ is not equal to $\sin(0.1)$. But $0.1$ is pretty close to $0$, so we can expect $T_{10}(0.1)$ to be pretty close to $\sin(0.1)$, and usually it’s close enough for our purposes!

Summary and a question to ponder

Taylor polynomials approximate a function near a point called the center. This is similar to how a tangent line approximates the graph of a function near the point of tangency. As the degree of the Taylor polynomial increases, the approximation gets better and better. So what would the “best approximation” of the function be? We’ll come back to this in Lesson 12 (link here) and again in Lesson 20.

Exit ticket

  1. Let $f(x)$ be a polynomial of degree $N$. What are the Taylor polynomials $p_0(x), p_1(x), p_2(x), \dots, p_N(x)$ for $f(x)$ centered at $x=0$?
  2. Let $f(x) = \sin(x)$. Determine the degree 4 Taylor polynomial for $f(x)$ centered at $a= \frac{\pi}{2}$.