Taylor Series
calculator.
Taylor polynomials copy a function near one point, using its derivatives at that point.
- P(1)
- 2.718056
- f(1)
- 2.718282
- Actual error
- 0.000226
Each new term is still closing the gap at x = 1. The last term that changed the sum left a miss of 0.000226, so raising the order should help further.
f against P
Drag the point to move xf(x) = exp(x) against its order 6 polynomial about a = 0. The two agree at the center and separate farther out. The polynomial stays within 0.001 of f from x = −1.2875 to x = 1.2308.
A center of 0 gives the Maclaurin series. The center and x can be exact: type pi for π, or / for a fraction.
Coefficients
| k | f⁽ᵏ⁾(a) | Factorial | cₖ |
|---|---|---|---|
| 0 | 1Factorial 1 | 1 | 1 |
| 1 | 1Factorial 1 | 1 | 1 |
| 2 | 1Factorial 2 | 2 | 12 |
| 3 | 1Factorial 6 | 6 | 16 |
| 4 | 1Factorial 24 | 24 | 124 |
| 5 | 1Factorial 120 | 120 | 1120 |
| 6 | 1Factorial 720 | 720 | 1720 |
Adding terms at x = 1
| Order | Pₖ(x) | Error |
|---|---|---|
| 0 | 1 | 1.718282 |
| 1 | 2 | 0.718282 |
| 2 | 2.5 | 0.218282 |
| 3 | 2.666667 | 0.051615 |
| 4 | 2.708333 | 0.009948 |
| 5 | 2.716667 | 0.001615 |
| 6 | 2.718056 | 0.000226 |
A row that repeats the one above means that power is missing from the series, as even powers are for sin x at 0.
Working
- 1Find the derivatives at the centerf(a) = 1, f⁽1⁾(a) = 1, f⁽2⁾(a) = 1, f⁽3⁾(a) = 1, f⁽4⁾(a) = 1, f⁽5⁾(a) = 1, and so on
- 2Divide each derivative by its factorial to get the coefficientcₖ =f⁽ᵏ⁾(a)k!
- 3Add the terms up to the chosen orderP(x) = 1 + x + x22 + x36 + x424 + x5120 + x6720
- 4Put in x = 1P(1) = 2.718056, and f(1) = 2.718282
- 5Bound the error with the next derivative|Rₙ| ≤M|x − a|n + 1(n + 1)!= 0.000539
- 6Check: P matches f at the center, and the real miss sits inside the boundP(a) = 1 and f(a) = 1. The miss at x is 0.000226, against a bound of about 0.000539
How many terms do you need?
Order 6 is the lowest that stays within 0.001 up to order 20. It gives 2.718056, a miss of 0.000226.
How it's worked out
Pick a center a. A polynomial has one free number per power, so you can force it to match the function's value and its first n derivatives at a. OpenStax gives the result: each coefficient is a derivative at the center divided by a factorial. With a center of 0, the same polynomial is called a Maclaurin polynomial.
The factorial is there because differentiating a power k times stacks up that same factor. Dividing by it cancels the factor, so the k-th derivative of P at a comes out equal to that of f.
The error has an exact form called the Lagrange remainder. It uses the next derivative at some point c between a and x. You rarely know c, so you bound the derivative by a number M on that stretch and get a limit on the miss.
The remainder figure here takes M from the largest next derivative at 41 points between a and x. That is sampling and not a proof, so read it as an estimate of the bound. The derivatives themselves come from automatic differentiation, which pushes whole power series through your formula. It stays reliable to order 20, where small-step differences would drown in rounding.
Worked examples
Nadia estimates e with six terms after the constant
Every derivative of is , so each one equals 1 at the center. The coefficients are then just one over a factorial.
At this gives 2.718056, and e is 2.718282, so she misses by 0.000226. The remainder estimate is 0.000539, which is larger than the real miss, as a bound should be.
If her target is an error under 0.001, order 6 is the first that gets there. Order 5 misses by 0.001615.
Omar checks a sine table at 10 degrees
The series uses radians, so 10 degrees becomes . Sine has no even powers, so order 6 adds nothing to order 5. The polynomial gives 0.17364818, and the miss is 9.78 × 10⁻¹⁰.
The bound comes to 9.79 × 10⁻¹⁰, because the next derivative is a cosine, which never goes past 1. OpenStax reaches the same figure for this angle.
Omar also wants to know how far this polynomial can be trusted. It stays within 0.0001 of the sine out to about 0.908 radians, on either side of 0. OpenStax gets from the bound, which runs slightly above the real miss.
Priya sees a series stop working
Priya builds the series for and compares two points with the same terms. At 0.5, order 6 is already within 0.001 of the true value. At 1.5, the misses grow as the order rises.
| Order | At x = 0.5 | At x = 1.5 |
|---|---|---|
| 2 | 3.05 × 10⁻² | 0.54 |
| 4 | 4.42 × 10⁻³ | 0.68 |
| 8 | 1.5 × 10⁻⁴ | 1.82 |
| 16 | 3.05 × 10⁻⁷ | 24.01 |
The polynomial is fine; the point is the problem. This series only converges for x above −1 and up to 1, so past that the powers of x outrun the shrinking fractions. She gets a better result by moving the center closer to 1.5.
Reading your result
Actual error compares P with the true value of f at your x. Trust this one when f can be evaluated. Remainder estimate is what you would quote when it cannot.
A bound can be far above the real miss. For at order 5 and , the actual error is 0.03125 and the estimate is 2. The bound takes the worst case on the whole stretch, and this function grows fast near its pole at 1.
A coefficient of 0 means that power is missing. Odd functions such as have only odd powers, and even functions such as have only even ones.
The range of a series does not depend on your order. Some converge for every x and others only on a short stretch, as the table shows. OpenStax lists these in its table of common series.
| Function | First terms | Converges for |
|---|---|---|
| All x | ||
| All x | ||
| All x | ||
Common mistakes
- Leaving out the factorial. The coefficient is the derivative over the factorial of k, not the derivative alone. Without it, the series for turns into the one for .
- Writing powers of x with a nonzero center. Away from 0, each power must be of . The terms expand into a different-looking polynomial, but you should not mix the two forms.
- Counting terms as the order. Order 7 for has only 4 terms that are not 0. When a question says "first four terms", check which it means.
- Using the n-th derivative in the bound. The remainder for order n uses derivative n + 1, one step higher than the last term you kept.
- Using degrees. The series for sine and cosine assume radians. Convert the angle first, or the sum answers a different question.