Taylor and Maclaurin



Taylor and Maclaurin polynomials

The purpose is to approach a function with a polynomial in the environment of x=a.

We denote the consecutive derivatives of a function g(x) as

 
g'(x); g"(x); g(3)(x); g(4)(x); ...; g(n)(x); ...
 
Go to the top of the page

Maclaurin polynomial

Theorem:

If the n-th derivative of f(x) exists in a environment of x=0, there is exactly one polynomial V(x), of degree n or lower, such that

 
V(0)=f(0); V'(0)=f'(0); V"(0)=f"(0); ... ; V(n)(0)=f(n)(0)

 

Proof

 
Take
  V(x)  = a + b x + c x2 + ... + l xn
Then
  V'(x) =     b   + 2c x  + ... + n l xn-1
 
  V"(x) =           2 c   + 3.2.d + ... + n(n-1) l xn-2
 
  ...
 
 
  V(n) =  n! l
 
and then
 
  V(0)  = a
 
  V'(0) = b
 
  V"(0) = 2! c
 
  ...
 
 
  V(n)(0) =  n! l

Now we require

 
    V(0)=f(0); V'(0)=f'(0); V"(0)=f"(0); ... ; V(n)(0)=f(n)(0)
 
<=>
    a = f(0);
 
    b = f'(0);
 
  2!c = f"(0);
 
  ...
 
  n! l = f(n)(0)

So all coefficients of V(x) are known and we can conclude :

The only polynomial of degree n or lower, such that

 
V(0)=f(0); V'(0)=f'(0); V"(0)=f"(0); ... ; V(n)(0)=f(n)(0)

is

 
f(0) + x.f'(0)/1! + x2.f"(0)/2! + x3.f(3)(0)/3! +...+ xn.f(n)(0)/n!

This is called the Maclaurin polynomial of order n for the function f(x).

Notation: Tnf(x)

Go to the top of the page

The Maclaurin polynomial of order n for the function f(x) is

 
Tn f(x) = f(0) + x.f'(0)/1! + x2.f"(0)/2! + x3.f(3)(0)/3! +...+ xn.f(n)(0)/n!

 

ex and its Maclaurin polynomial

 
We know that if f(x) = ex then f(n)(x) = ex and f(n)(0) = 1
 
Thus
 
Tn ex = 1 + x/1! + x2/2! + x3/3! + ... + xn/n!
 

sin(x) and its Maclaurin polynomial

 
f(x)    = sin(x)                     => f(0)  = 0
f'(x)   = cos(x)  = sin(x + pi/2)    => f'(0) = 1
f"(x)   = -sin(x) = sin(x + 2.pi/2)  => f"(0) = 0
f"'(x)  = -cos(x) = sin(x + 3.pi/2)  => f"'(0)= -1
...
f(n)(x) = sin(x + n.pi/2)         => f(n)(0) = sin(n.pi/2)
 
Thus
 
Tn sin(x) = x - x3/3! + x5/5! - x7/7! + ... + xn.sin(n.pi/2)/n!
 

If x is very close to 0, we see that x - x3/6 is a good approach for sin(x).

cos(x) and its Maclaurin polynomial

In the same way as above we find for cos(x)

 
Tn cos(x) = 1 - x2/2! + x4/4! - x6/6! + ... + xn.cos(n.pi/2)/n!
 
Go to the top of the page

ln(1+x) and its Maclaurin polynomial

 
f(x) = ln(1+x)             => f(0)   = 0
f'(x) = (1+x)-1         => f'(0)  = 1
f"(x) = -1(1+x)-2       => f"(0)  = -(1!)
f"'(x)= 2(1+x)-3        => f"'(0) = 2!
f(4)= -2.3(1+x)-4    => f(4) = -(3!)
...
 
Thus
 
Tn ln(1+x) = x/1 - x2/2 + x3/3 - x4/4 + ... + (-1)n-1.xn/n
 

(1+x)q and its Maclaurin polynomial

 
f(x) = (1+x)q       => f(0) = 1
f'(x) = q(1+x)q-1  => f'(0) = q
f"(x) = q(q-1)(1+x)q-2 => f"(0) = q(q-1)
f"'(x)= q(q-1)(q-2)(1+x)q-3  => f"'(0) = q(q-1)(q-2)
...
 
Thus
 
Tn (1+x)q = 1 + q x + q(q-1)x2/2! + q(q-1)(q-2) x3/3! + ...
 
analogous
 
Tn (1+x)q = 1 - q x + q(q-1)x2/2! - q(q-1)(q-2) x3/3! + ...
 
For q = -1 we have
 
Tn (1+x)-1 = 1 + x + x2 + x3 + ... + xn
 
for q = 1/2 we have
 
Tn sqrt(1+x) = 1 + x/2 - x2/8 + ...
 
So, if x is very close to 0, we see that 1 + x/2 - x2/8 is a good approach
for sqrt(1+x).
 
analogous
 
Tn sqrt(1-x) = 1 - x/2 - x2/8 + ...
 
If x is very close to 0, we see that 1 + x/2 - x2/8 is a good approach
for sqrt(1-x).
 
Go to the top of the page

Taylor polynomial

Theorem:

If the n-th derivative of f(x) exists in an environment of x=a, there is exactly one polynomial V(x), of degree n or lower, such that

 
V(a)=f(a); V'(a)=f'(a); V"(a)=f"(a); ... ; V(n)(a)=f(n)(a)


Proof:

 
Take
  V(x)  = b + c (x - a) + d (x - a)2 + ... + l (x - a)n

In the same way as for the Maclaurin polynomial, you can show that

 
  V(a) = f(a)  <=>  b = f(a)
  V'(a) = f'(a) <=> c = f'(a)/1!
  V'(a) = f"(a) <=> d = f"(a)/2!
  ...
  V(n)(a) = f(n)(a)  <=>  l = f(n)(a)/n!

So all coefficients of V(x) are known and we can conclude :

The only polynomial of degree n or lower, such that

 
V(a)=f(a); V'(a)=f'(a); V"(a)=f"(a); ... ; V(n)(a)=f(n)(a)
 
is
 
f(a) + (x-a).f'(a)/1! + (x-a)2.f"(a)/2! + (x-a)3.f(3)(a)/3! +...+ (x-a)n.f(n)(a)/n!

This is called the Taylor polynomial of order n for the function f(x) in an environment of x=a.

Notation: Tn,af(x)

The Taylor polynomial of order n for the function f(x) in an environment of x=a is

 
Tn,a f(x) = f(a) + (x-a).f'(a)/1! + (x-a)2.f"(a)/2!
           + (x-a)3.f(3)(a)/3! +...+ (x-a)n.f(n)(a)/n!


Let x = a + h and the previous formula becomes

 
Tn,a f(a + h) = f(a) + h.f'(a)/1! + h2.f"(a)/2!
           + h3.f(3)(a)/3! +...+ hn.f(n)(a)/n!

Go to the top of the page

ex and the Taylor polynomial

In the same way as for the Maclaurin polynomial you'll find:

 
Tn,a ex = ea( 1 + (x-a)/1! + (x-a)2/2! + (x-a)3/3! + ... + (x-a)n/n!)

sin(x) and its Taylor polynomial

In the same way as for the Maclaurin polynomial you'll find:

 
 
Tn,a sin(x)
 
       sin(a + i.pi/2)
= sum ----------------- .(x-a)i   for i=0...n
   i        i!
 

cos(x) and its Taylor polynomial

In the same way as for the Maclaurin polynomial you'll find:

 
 
Tn,a cos(x)
 
       cos(a + i.pi/2)
= sum ----------------- .(x-a)i   for i=0...n
   i        i!
 
Go to the top of the page

Taylor formula with derivative form of remainder

Theorem:

If f(n+1)(x) exists in an environment of a containing a+h, then

 
f(a+h) = f(a) + h.f'(a)/1! + h2.f"(a)/2!
 + h3.f(3)(a)/3! +...+ hn.f(n)(a)/n! + hn+1.f(n+1)(c)/(n+1)!

with c between a and a+h.


Proof:
There is always a suitable number r such that

 
f(a+h) = f(a) + h.f'(a)/1! + h2.f"(a)/2!
 + h3.f(3)(a)/3! +...+ hn.f(n)(a)/n! + hn+1.r/(n+1)!

We'll prove that r = f(n+1)(c) with c between a and a+h.

Create the function

 
g(x) = f(a+x)-( f(a) + x.f'(a)/1! + x2.f"(a)/2!
 + x3.f(3)(a)/3! +...+ xn.f(n)(a)/n! + xn+1.r/(n+1)! )

and calculate the n+1 derivatives.

 
g'(x) = f'(a+x) -( f'(a) + x.f"(a)/1! + ...
       + xn-1.f(n)(a)/(n-1)! + xn.r/n! )
 
g"(x) = f"(a+x) -( f"(a) + ... + xn-2.f(n)(a)/(n-2)! + xn-1.r/(n-1)! )
 
...
 
g(n)(x) = f(n)(a+x) -( f(n)(a) + x r )
 
g(n+1)(x) = f(n+1)(a+x)-r
 

Since f, ... f(n) are continuous in the environment of a, we can use Rolle's theorem on g(x) and all the derivatives.

 
g(0)=g(h) => there is a c1 between 0 and h such that g'(c1) = 0.
 
g'(0)=g'(c1) => there is a c2 between 0 and h such that g"(c2) = 0.
 
...
 
g(n)(0)=g(n)(cn) =>there is a cn+1 between 0 and h such
                                       that g(n+1)(cn+1) = 0.
 

And from this last conclusion, we can write

 
        0 = f(n+1)(a+cn+1)-r
 
<=>    f(n+1)(c) = r  for a value c between a and a+h.

The term hn+1.f(n+1)(c)/(n+1)! is called 'the derivative form of the remainder'.

 

Go to the top of the page

Maclaurin formula with derivative form of remainder

Take the Taylor formula with derivative form of remainder, choose a = 0 and write x instead of h.

If f(n+1)(x) exists in an environment of 0 containing x, then

 
f(x) = f(0) + x.f'(0)/1! + x2.f"(0)/2!
 + x3.f(3)(0)/3! +...+ xn.f(n)(0)/n! + xn+1.f(n+1)(c)/(n+1)!

with c between 0 and x.

 

Expansion of ex

With the Maclaurin formula we can write

 
ex = 1 + x/1! + x2/2! + ... + xn/n! + ec.xn+1/(n+1)!
 
If n --> infinity  then xn+1/(n+1)! has limit 0 for all x.

Therefore we can write

ex = 1 + x/1! + x2/2! + ... + xn/n! + ... for all x

 

Expansion of sin(x)

With the Maclaurin formula we can write

 
sin(x) = x/1! - x3/3! + x5/5! - ... + sin(n.pi/2).xn/n! +
                              sin(c + (n+1).pi/2).xn+1/(n+1)!
 
If n --> infinity  then xn+1/(n+1)! has limit 0 for all x.

Therefore we can write

sin(x) = x/1! - x3/3! + x5/5! -x7/7! + ...

 

Expansion of cos(x)

In the same way as for sin(x) we can deduce the formula

cos(x) = 1 - x2/2! + x4/4! -x6/6! + ...


Go to the top of the page