taylor polynomials are certain polynomials that can approximate functions. the more terms in the taylor polynomial, the greater the accuracy of the approximation.
in this article we will define taylor polynomials and work out a number of examples similar to those you might see on the ap calculus bc exam.
taylor polynomials
before we define the taylor polynomial, let’s remember what a normal, everyday kind of polynomial is.
polynomials
a polynomial is any expression of the following form.
here, n is a whole number. each coefficient a0, a1, a2, …, an, must be constant. furthermore, we always insist that an is nonzero. (otherwise, we really wouldn’t have an nth term at all, right?) then we say that the degree of the polynomial is n.
often, you’ll see the terms written in the opposite order, from high degree down to low, which is called standard form. but a taylor polynomial is usually written starting from low degree and then progressing to higher degrees with each term. however you slice it, a polynomial is simply the sum of a terms, each of which involving a whole number power of the variable.
here are a few example polynomials:
here, f has degree 6, g has degree 8, and h has degree 11.
polynomials and derivatives
the nice thing about a polynomial is that it’s very easy to take its derivative. all you need are three simple rules.
- the sum/difference rule
- the constant multiple rule
- and the power rule
now, even if you replace x by (x – c) in a polynomial, you still get a polynomial. let’s explore the derivatives of such a function.
as you keep taking higher-order derivatives, notice how the degree of the polynomial steps down.
another curiousity is how the constant terms behave. by plugging x = c into the function and each successive derivative, you can recover each constant term. take a look at the pattern that emerges.
- original function: f(c) = a0
- first derivative: f '(c) = a1
- second derivative: f ''(c) = 2a2
- third derivative: f '''(c) = 6a3
by the time you get all the way to the nth derivative, there’s nothing left but the last term. each derivative step tacks on another factor, until you end up with all of the counting numbers starting from n down to 1 multiplied to the final coefficient:
you might recognize that “excited” notation, n!, as the factorial of n.
taylor coefficients
now i bet you’re wondering what all of this have to do with taylor polynomials. it’s simple actually!
we get to treat any given function f(x) as if it were a polynomial, and use the formula above to find out what each coefficient should be if it really were a polynomial.
well, first we have to solve for the taylor coefficients an:
(remember that 0! = 1.)
now let’s see a formal definition.
definition of the taylor polynomial
let n ≥ 0 be a whole number. suppose that f is a function with derivatives of order k for each k = 1, 2, …, n. if c is a real number, then the taylor polynomial of order n centered at c is:
examples
the easiest (and most common) kinds of taylor polynomials are those centered at c = 0. in fact, these ones have a special name: maclaurin polynomials.
example: maclaurin polynomials for ex
find a 3rd degree maclaurin polynomial for f(x) = ex, and use it to approximate the value of e.
solution
i like to organize my work in a table. don’t forget to include the “0th” derivative, which is the original function. the taylor coefficients are as follows.
k | f(k)(x) | f(k)(0)/k! |
---|---|---|
0 | f(x) = ex | e0/0! = 1 |
1 | f '(x) = ex | e0/1! = 1 |
2 | f ''(x) = ex | e0/2! = 1/2 |
3 | f '''(x) = ex | e0/3! = 1/6 |
therefore, the 3rd-degree (or 3rd-order) taylor polynomial for ex is:
finally, to approximate e = e1, just plug x = 1 into the taylor polynomial and evaluate.
(the actual value of e is 2.71828…, so our estimate is not too far off!)
example: taylor polynomial for ln(x)
use the 5th degree taylor polynomial for f(x) = ln(x), centered at 1, to approximate the value of ln(2).
solution
again, i’ll use a table to record the taylor coefficients.
k | f(k)(x) | f(k)(1)/k! |
---|---|---|
0 | f(x) = ln x | ln(1) = 0 |
1 | f '(x) = 1/x | 1/1 = 1 |
2 | f ''(x) = -1/x2 | (-1)/2! = -1/2 |
3 | f '''(x) = 2/x3 | 2/3! = 2/6 = 1/3 |
4 | f(4)(x) = -6/x4 | (-6)/4! = -6/24 = -1/4 |
5 | f(5)(x) = 24/x5 | 24/5! = 24/120 = 1/5 |
so our 5th degree polynomial is:
now, to approximate ln(2), we plug x = 2 into this expression. notice that each time you will get a factor of (2 – 1) to some power. of course, 2 – 1 = 1, so those factors won’t matter. it all boils down to an alternating sum of fractions in the end.
ln 2 ≈ 1 – 1/2 + 1/3 – 1/4 + 1/5 = 47/60 ≈ 0.78333
example: maclaurin polynomials for sin x
find the maclaurin polynomials for sin x up to degree 9, and plot them on the same set of axes.
solution
fortunately, there is a repeating pattern in the derivatives of sin x. the derivatives repeat in blocks of four,
- sin x
- cos x
- -sin x
- -cos x
furthermore, when you plug in x = 0, half of the taylor coefficients will become zero because you’re plugging into sin x. the remaining terms end up alternating in sign. keep in mind, cos 0 = 1.
k | f(k)(x) | f(k)(1)/k! |
---|---|---|
0 | f(x) = sin x | sin 0 = 0 |
1 | f '(x) = cos x | cos 0 = 1 |
2 | f ''(x) = -sin x | (-sin 0)/2! = 0 |
3 | f '''(x) = -cos x | (-cos 0)/3! = -1/6 |
4 | f(4)(x) = sin x | (sin 0)/4! = 0 |
5 | f(5)(x) = cos x | (cos 0)/5! = 1/120 |
6 | f(6)(x) = -sin x | (-sin 0)/6! = 0 |
7 | f(7)(x) = -cos x | (-cos 0)/7! = -1/5040 |
8 | f(8)(x) = sin x | (sin 0)/8! = 0 |
9 | f(9)(x) = cos x | (cos 0)/9! = 1/362880 |
let’s label the taylor polynomial of degree n by tn. according to the table, each t2 will be the same as t1 because the degree two coefficient is zero. this is true for all of the even cases. so i’m just going to list the odd degree cases:
below, you can see how they progressively get closer to the graph of y = sin x as the degree goes up.
what’s next?
taylor polynomials are just that: polynomials. and no matter how high the degree, the polynomial will not match the original function f
exactly (unless f is itself a polynomial).
check back on this blog to see what happens when you allow the number of terms to go to infinity. then we can get an exact match for f in a lot of cases.
these ideas are incredibly important in fields like engineering and physics. but that’s a discussion for another day!
leave a reply