Polynomial Approximation

Table of Contents

Introduction

Imagine you have a smooth curve f(x)f(x) and you want to estimate its value near some point aa. If you zoom in close enough, the curve starts looking almost like a straight line.

For small changes h=xah = x - a, we can write:

f(x)f(a)+f(a)hf(x) \approx f(a) + f'(a)h

This is just the tangent line equation. It works because the first derivative gives the slope of the curve at that point.

But what if the function bends away from the tangent line?

We can correct that error by adding a curvature term that accounts for how fast the slope itself changes. This is given by the second derivative:

f(x)f(a)+f(a)h+f(a)2!h2f(x) \approx f(a) + f'(a)h + \frac{f''(a)}{2!}h^2

If that's still not enough, we can keep correcting by adding higher-order derivatives, each compensating for the leftover error of the previous approximation. The more terms we include, the closer our polynomial becomes to the real curve.

Deriving the Formula

To see how this comes together, let's build the pattern step by step.

Suppose f(x)f(x) can be represented as a polynomial centered at aa:

f(x)=c0+c1(xa)+c2(xa)2+c3(xa)3+f(x) = c_0 + c_1(x - a) + c_2(x - a)^2 + c_3(x - a)^3 + \cdots

We can find the coefficients cnc_n by differentiating both sides and evaluating at x=ax = a:

f(a)=c0f(a)=c1f(a)=2!c2f(a)=3!c3\begin{aligned} f(a) &= c_0 \\ f'(a) &= c_1 \\ f''(a) &= 2!c_2 \\ f'''(a) &= 3!c_3 \\ &\vdots \end{aligned}

So in general:

cn=f(n)(a)n!c_n = \frac{f^{(n)}(a)}{n!}

Plugging this back gives us the Taylor Series formula:

f(x)=n=0f(n)(a)n!(xa)nf(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x - a)^n

This expression allows any infinitely differentiable function to be written as an infinite sum of powers, each weighted by its derivatives at a single point.

Maclaurin Series

When the series is centered at a=0a = 0, it becomes a simpler form called the Maclaurin Series:

f(x)=n=0f(n)(0)n!xnf(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(0)}{n!}x^n

This form is often used for common functions like exe^x, sin(x)\sin(x), and cos(x)\cos(x).

Examples of Taylor Series

Let's see how the Taylor formula works in practice by expanding a few well-known functions. Each of these is infinitely differentiable, meaning we can keep taking derivatives forever. Their repeating derivative patterns make them perfect examples.

Exponential Function exe^x

The derivative of exe^x is itself:

f(x)=ex,f(x)=ex,f(x)=ex,f(x) = e^x, \quad f'(x) = e^x, \quad f''(x) = e^x, \quad \dots

At x=0x = 0:

f(0)=f(0)=f(0)==1f(0) = f'(0) = f''(0) = \dots = 1

Plugging into the Maclaurin formula:

ex=1+x1!+x22!+x33!+x44!+e^x = 1 + \frac{x}{1!} + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \cdots

Sine Function sin(x)\sin(x)

Now for something oscillatory. Let's write out the derivatives:

f(x)=sin(x)f(x)=cos(x)f(x)=sin(x)f(x)=cos(x)f(4)(x)=sin(x)\begin{aligned} f(x) &= \sin(x) \\ f'(x) &= \cos(x) \\ f''(x) &= -\sin(x) \\ f'''(x) &= -\cos(x) \\ f^{(4)}(x) &= \sin(x) \end{aligned}

At x=0x = 0:

f(0)=0,f(0)=1,f(0)=0,f(0)=1f(0) = 0, \quad f'(0) = 1, \quad f''(0) = 0, \quad f'''(0) = -1

So the series becomes:

sin(x)=xx33!+x55!x77!+\sin(x) = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \cdots

Notice how:

Cosine Function cos(x)\cos(x)

Similarly, cosine's derivatives repeat every four steps:

f(x)=cos(x)f(x)=sin(x)f(x)=cos(x)f(x)=sin(x)\begin{aligned} f(x) &= \cos(x) \\ f'(x) &= -\sin(x) \\ f''(x) &= -\cos(x) \\ f'''(x) &= \sin(x) \end{aligned}

At x=0x = 0:

f(0)=1,f(0)=0,f(0)=1,f(0)=0f(0) = 1, \quad f'(0) = 0, \quad f''(0) = -1, \quad f'''(0) = 0

Substituting:

cos(x)=1x22!+x44!x66!+\cos(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \cdots

Here:

Together, the sine and cosine series complement each other: one starts at 0 and oscillates through odd powers, while the other starts at 1 and oscillates through even powers.