Contents
Definition #
If f is infinitely differentiable at x = a, its Taylor series centered at a is:
f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x - a)^n
Expanded:
f(x) = f(a) + f'(a)(x - a) + \frac{f''(a)}{2!}(x - a)^2 + \frac{f'''(a)}{3!}(x - a)^3 + \cdots
When a = 0, it is called a Maclaurin series:
f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(0)}{n!}\,x^n
Intuition #
Each term adds a better local approximation:
- Order 0: f(a) matches the function's value at a.
- Order 1: adds the slope, giving the tangent line.
- Order 2: adds curvature, giving a parabola that hugs the function.
- Higher orders: keep matching more derivatives, so the polynomial stays close to f over a wider region.
Truncating the series after N terms gives the Taylor polynomial of degree N, a practical approximation.
How to Compute One #
- Pick the center a.
- Compute the derivatives f'(a), f''(a), f'''(a), \dots
- Plug them into \frac{f^{(n)}(a)}{n!}(x - a)^n.
- Look for a pattern to write the general term.
Example: e^x at a = 0 #
Every derivative of e^x is e^x, and e^0 = 1, so:
e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!} = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots
Common Maclaurin Series #
| Function | Series | Converges for |
|---|---|---|
| e^x | \displaystyle\sum_{n=0}^{\infty} \frac{x^n}{n!} | all x |
| \sin x | \displaystyle\sum_{n=0}^{\infty} \frac{(-1)^n x^{2n+1}}{(2n+1)!} | all x |
| \cos x | \displaystyle\sum_{n=0}^{\infty} \frac{(-1)^n x^{2n}}{(2n)!} | all x |
| \dfrac{1}{1-x} | \displaystyle\sum_{n=0}^{\infty} x^n | \lvert x \rvert < 1 |
| \ln(1+x) | \displaystyle\sum_{n=1}^{\infty} \frac{(-1)^{n+1} x^n}{n} | -1 < x \le 1 |
Accuracy and Error #
The error of a degree-N Taylor polynomial T_N(x) is given by the Lagrange remainder:
R_N(x) = \frac{f^{(N+1)}(c)}{(N+1)!}(x - a)^{N+1}, \quad \text{for some } c \text{ between } a \text{ and } x
Rules of thumb:
- The closer x is to a, the smaller the error.
- Higher degree usually means a better approximation.
- The series only equals f inside its radius of convergence.
Why It Matters #
- Numerical computing: calculators and libraries approximate \sin, \cos, e^x with polynomials.
- Physics and engineering: the small-angle approximation \sin x \approx x comes from the first term.
- Machine learning: gradient descent and Newton's method rely on first- and second-order Taylor expansions of the loss.
- Integration: functions without elementary antiderivatives can be integrated term by term.
Quick Python Example #
import math
def taylor_exp(x, terms=10):
return sum(x**n / math.factorial(n) for n in range(terms))
print(taylor_exp(1)) # ≈ 2.71828
print(math.exp(1)) # 2.718281828...
Comments
Loading comments…