# What is the Taylor series of a function?

Finds the Taylor polynomial of a function about a point, with checked coefficients.

- Page: https://www.acalculator.org/math/taylor-series-calculator
- JSON spec: https://www.acalculator.org/math/taylor-series-calculator.json
- Version: ace90c66f669

## Default answer

Example with the default inputs (Function f(x) ln(x), Centre a 1, Order n 3): The Taylor polynomial of order 3 of ln(x) about 1 is (x - 1) - (x - 1)^2/2 + (x - 1)^3/3.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| f | Function f(x) | The function, in one letter. |
| a | Centre a | The point the series is built around; 0 gives a Maclaurin series. |
| n | Order n | The highest power of (x − a), 0 to 10. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| polynomial | Taylor polynomial | The sum of f⁽ᵏ⁾(a)/k! (x − a)ᵏ for k = 0 to n. |

## Method

A computer algebra system finds each derivative of f(a + t) at t = 0; each derivative and coefficient is checked numerically.

## Assumptions

- Written in powers of (x − a), lowest first; order 0 to 10.
- An answer that fails its check is not shown.

## Worked examples

1. f = ln(x), a = 1, n = 3 gives polynomial = (x - 1) - (x - 1)^2/2 + (x - 1)^3/3. Source: OpenStax Calculus Vol. 2, 6.3, Ex. 6.11. https://openstax.org/books/calculus-volume-2/pages/6-3-taylor-and-maclaurin-series.
2. f = sin(x), a = 0, n = 5 gives polynomial = x - x^3/6 + x^5/120.
3. f = cbrt(x), a = 8, n = 2 gives polynomial = 2 + (x - 8)/12 - (x - 8)^2/288.

## FAQ

### What is a Taylor series?

The Taylor series of f about x = a is the power series f(a) + f′(a)(x − a) + f″(a)/2! (x − a)² + …, whose k-th coefficient is f⁽ᵏ⁾(a)/k!. Stopping after the (x − a)ⁿ term gives the Taylor polynomial of order n, the polynomial of degree n or less that matches f and its first n derivatives at a.

### What is a Maclaurin series?

A Taylor series about a = 0. The Maclaurin polynomial of eˣ of order 4 is 1 + x + x²/2 + x³/6 + x⁴/24. Set the centre to 0 to get one.

### How good is the approximation?

Near a, very good; further away, it depends on f. By Taylor’s theorem the error of the order-n polynomial is f⁽ⁿ⁺¹⁾(c)/(n + 1)! (x − a)ⁿ⁺¹ for some c between a and x. For ln(x) about 1 the series converges only for 0 < x ≤ 2, so no order helps at x = 3. The two charts show the function and the polynomial on the same range.

### Why does the polynomial have fewer terms than the order?

Terms with a zero coefficient are left out. sin(x) is odd, so its even derivatives at 0 are 0: the Maclaurin polynomial of order 6 is x − x³/6 + x⁵/120, with no x⁶ term.

### Why is there no answer about 0 for ln(x) or 1/x?

The polynomial needs f and its first n derivatives at the centre, and ln(x) and 1/x are not defined at 0. Choose a centre where f is defined, such as 1 for ln(x).

### How is the answer checked?

Each derivative is compared with a numeric difference quotient at 20 points before it is used, and each coefficient f⁽ᵏ⁾(a)/k! is compared with the checked derivative evaluated at a. The written polynomial is then compared with the checked one at 15 points. If any step fails, the page says "No verified answer".

## Sources

- OpenStax, Calculus Volume 2, section 6.3 Taylor and Maclaurin Series: https://openstax.org/books/calculus-volume-2/pages/6-3-taylor-and-maclaurin-series
- NIST Digital Library of Mathematical Functions, section 1.10 Functions of a Complex Variable (Taylor’s theorem): https://dlmf.nist.gov/1.10
