Search Knowledge

© 2026 LIBREUNI PROJECT

Calculus & Analysis / Overview

Taylor and Power Series

Taylor and Power Series

A Taylor series is an infinite sum of terms that are expressed in terms of the function’s derivatives at a single point.

Taylor’s Formula

The Taylor series of a real or complex-valued function f(x)f(x) that is infinitely differentiable at a real or complex number aa is the power series: f(x)=f(a)+f(a)1!(xa)+f(a)2!(xa)2+f(x) = f(a) + \frac{f'(a)}{1!}(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \dots

python
1import numpy as np
2 
3def sin_taylor(x, n_terms):
4 res = 0
5 for n in range(n_terms):
6 sign = (-1)**n
7 term = (x**(2*n + 1)) / np.math.factorial(2*n + 1)
8 res += sign * term
9 return res
10 
11x_val = np.pi / 4 # 45 degrees
12print(f"sin(pi/4) exact: {np.sin(x_val):.6f}")
13print(f"Taylor (1 term): {sin_taylor(x_val, 1):.6f}")
14print(f"Taylor (3 terms): {sin_taylor(x_val, 3):.6f}")

Radius of Convergence

A power series an(xa)n\sum a_n (x-a)^n has a radius of convergence RR such that the series converges absolutely for xa<R|x-a| < R and diverges for xa>R|x-a| > R.

What is the Taylor series of exp(x) centered at 0?

Remainder Term: Taylor’s Theorem

Taylor’s Theorem gives an estimate of the error when a function is approximated by its nn-th degree Taylor polynomial. The Lagrange form of the remainder is: Rn(x)=f(n+1)(c)(n+1)!(xa)(n+1)R_n(x) = \frac{f^{(n+1)}(c)}{(n+1)!}(x-a)^{(n+1)} for some cc between aa and xx.

python
1def exp_error_estimate(x, n):
2 import math
3 # Error for exp(x) is x^(n+1)/(n+1)! * exp(c)
4 # where c is in [0, x]. Max error at c=x.
5 return (abs(x)**(n+1) / math.factorial(n+1)) * math.exp(abs(x))
6 
7print(f"Max error for exp(1) with 5 terms: {exp_error_estimate(1, 5):.6f}")

Can any infinitely differentiable function be represented exactly by its Taylor series everywhere?

Previous Module Systems of ODEs
Next Module Vector Fields