What is the Taylor series of a function?
Type a function, the centre a, and the order n. The page gives the Taylor polynomial in powers of (x − a) with exact coefficients, and draws it beside the function.
- Taylor polynomial
- (x - 1) - (x - 1)^2/2 + (x - 1)^3/3
The Taylor polynomial of order 3 of ln(x) about 1 is (x - 1) - (x - 1)^2/2 + (x - 1)^3/3.
Taylor polynomial: (x - 1) - (x - 1)^2/2 + (x - 1)^3/3. The Taylor polynomial of order 3 of ln(x) about 1 is (x - 1) - (x - 1)^2/2 + (x - 1)^3/3.
The function f(x) near the centre
The Taylor polynomial on the same range
How to calculate
Finds the Taylor polynomial of a function about a point, with checked coefficients.
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.
Method: A computer algebra system finds each derivative of f(a + t) at t = 0; each derivative and coefficient is checked numerically.
- Written in powers of (x − a), lowest first; order 0 to 10.
- An answer that fails its check is not shown.
Worked examples
Each example is checked against the calculator on every build.
- Function f(x) ln(x), Centre a 1, Order n 3 gives Taylor 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
- Function f(x) sin(x), Centre a 0, Order n 5 gives Taylor polynomial x - x^3/6 + x^5/120.
- Function f(x) cbrt(x), Centre a 8, Order n 2 gives Taylor polynomial 2 + (x - 8)/12 - (x - 8)^2/288.
How it works
The Taylor series calculator finds the Taylor polynomial of order n of f about x = a:
pₙ(x) = f(a) + f′(a)(x − a) + f″(a)/2! (x − a)² + … + f⁽ⁿ⁾(a)/n! (x − a)ⁿ
A computer algebra system (nerdamer, open source) does the algebra on g(t) = f(a + t), so the coefficients are exact and the result comes out directly in powers of t = x − a. Before the algebra, tan, sec, csc and cot are written with sin and cos, and cbrt(u) as u^(1/3); these are the same functions. The algebra runs after you start typing, in the background.
Every answer is checked before it is shown.
- Each derivative g⁽ᵏ⁾ (k = 1 to n) is compared with a five-point central difference of the one before it at 20 points; they must agree to 1 part in a million.
- Each coefficient g⁽ᵏ⁾(0)/k! is compared with the checked derivative evaluated at 0, to 1 part in 10⁹.
- The polynomial, written in powers of (x − a), must equal the checked polynomial at t = x − a at 15 points, to 1 part in 10⁹.
A step that fails means "No verified answer".
What you can type
- The function f, in one lowercase letter: x, t, and so on. Two different letters give no answer. The letter e is Euler’s number, and pi (or π) is π.
- Numbers can have decimals (2.5) and powers of ten (1e-3). Operations: + − * / and ^ for powers; brackets group; a number or bracket next to a letter multiplies.
- Functions: sqrt, cbrt, ln (and log, the same natural logarithm), log10, exp, abs (or |x|), sin, cos, tan, sec, csc, cot, asin, acos, atan (arcsin, arccos, arctan also work), sinh, cosh, tanh and their inverses. Angles are in radians.
- The centre a: a number or a constant expression, such as 0, 1, −2, pi/2 or e. Use 0 for a Maclaurin series.
- The order n: a whole number from 0 to 10.
How answers are written
- The polynomial is a sum of terms c (x − a)ᵏ, lowest power first, in the syntax you type:
(x - 1) - (x - 1)^2/2 + (x - 1)^3/3. With a = 0 the terms are powers of x:x - x^3/6 + x^5/120. - A negative centre gives (x + 2) in place of (x − (−2)); a centre such as π/2 gives (x − π/2).
- Coefficients are exact: fractions, and values such as e, sin(1) or π where the derivatives give them.
- There is one term per power. When the algebra splits a coefficient over several terms, they are joined into one bracket: tan(x) about 1 gives sin(1)/cos(1) + (1 + sin(1)^2/cos(1)^2) (x - 1) + …, where the bracket is the whole coefficient of (x − 1).
- Terms whose coefficient is 0 are left out (log10(1) is 0); if every coefficient is 0 the polynomial is 0.
- A result holding a number the algebra rounded (a fraction whose denominator, after removing factors 2 and 5, is over 1,000,000, or whose numerator times that denominator is over 10¹², or a decimal with more than 12 significant digits) is not shown.
What gets no answer
- A function that is not defined, or not n times differentiable, at a: ln(x) or 1/x about 0, |x| about 0 with n ≥ 1.
- An order outside 0 to 10.
- A step that fails its check, finds no formula, or takes over 3 seconds.
The charts
The first chart draws f(x) and the second the Taylor polynomial, both from a − 2 to a + 2, with the centre marked. Where f is not a real number the curve has a gap.
Worked examples by hand
ln(x) about 1, order 3 (OpenStax Calculus Volume 2, section 6.3, Example 6.11). f(1) = 0; f′(x) = 1/x, so f′(1) = 1; f″(x) = −1/x², so f″(1) = −1; f‴(x) = 2/x³, so f‴(1) = 2. The coefficients are 0, 1, −1/2! = −1/2 and 2/3! = 1/3, so p₃(x) = (x − 1) − (x − 1)²/2 + (x − 1)³/3.
sin(x) about 0, order 5 (OpenStax Calculus Volume 2, section 6.3, Example 6.12). The derivatives of sin at 0 cycle through 0, 1, 0, −1, 0, 1, so p₅(x) = x − x³/3! + x⁵/5! = x − x³/6 + x⁵/120.
∛x about 8, order 2 (OpenStax Calculus Volume 2, section 6.3, Example 6.13). f(8) = 2; f′(x) = (1/3)x^(−2/3), so f′(8) = 1/12; f″(x) = −(2/9)x^(−5/3), so f″(8) = −(2/9)(1/32) = −1/144 and f″(8)/2! = −1/288. So p₂(x) = 2 + (x − 8)/12 − (x − 8)²/288.
Other questions people ask
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".