1 7 Taylor Series Revisited
1 7 Taylor Series Revisited
1 7 Taylor Series Revisited
07
Taylor Theorem Revisited
The concept of a Taylor series was formulated by the Scottish mathematician James
Gregory and formally introduced by the English mathematician Brook Taylor in 1715. If the
Taylor series is centered at zero, then that series is also called a Maclaurin series, named after
the Scottish mathematician Colin Maclaurin, who made extensive use of this special case of
Taylor series in the 18th century.
A function can be approximated by using a finite number of terms of its Taylor series. Taylor's
theorem gives quantitative estimates on the error introduced by the use of such an
approximation. The polynomial formed by taking some initial terms of the Taylor series is called
a Taylor polynomial. The Taylor series of a function is the limit of that function's Taylor
polynomials as the degree increases, provided that the limit exists. A function may not be equal
to its Taylor series, even if its Taylor series converges at every point. A function that is equal to
its Taylor series in an open interval (or a disc in the complex plane) is known as an analytic
function in that interval.
The use of Taylor series exists in so many aspects of numerical methods that it is imperative
to devote a separate chapter to its review and applications. For example, you must have
come across expressions such as
01.07.1
01.07.2 Chapter 01.07
x2 x4 x6
cos(x) 1 (1)
2! 4! 6!
x3 x5 x7
sin( x) x (2)
3! 5! 7!
x 2 x3
ex 1 x (3)
2! 3!
All the above expressions are actually a special case of Taylor series called the Maclaurin
series. Why are these applications of Taylor’s theorem important for numerical methods?
Expressions such as given in Equations (1), (2) and (3) give you a way to find the
approximate values of these functions by using the basic arithmetic operations of addition,
subtraction, division, and multiplication.
Example 1
Find the value of e 0.25 using the first five terms of the Maclaurin series.
Solution
The first five terms of the Maclaurin series for e x is
x2 x3 x 4
ex 1 x
2! 3! 4!
0.25 2 0.253 0.25 4
e 0.25 1 0.25
2! 3! 4!
1.2840
The exact value of e 0.25 up to 5 significant digits is also 1.2840.
But the above discussion and example do not answer our question of what a Taylor series is.
Here it is, for a function f x
f x 2 f x 3
f x h f x f x h h h (4)
2! 3!
provided all derivatives of f x exist and are continuous between x and x h .
Example 2
Take f x sin x , we all know the value of sin 1 . We also know the f x cosx
2
and cos 0 . Similarly f x sin( x) and sin 1 . In a way, we know the value
2 2
of sin x and all its derivatives at x . We do not need to use any calculators, just plain
2
differential calculus and trigonometry would do. Can you use Taylor series and this
information to find the value of sin 2 ?
Solution
x
2
xh2
h 2 x
2
2
0.42920
So
h2 h3 h4
f x h f x f x h f x f x f ( x)
2! 3! 4!
x
2
h 0.42920
f x sin x , f sin 1
2 2
f x cosx , f 0
2
f x sin x , f 1
2
f x cos(x) , f 0
2
f x sin(x) , f 1
2
Hence
h h h
2 3 4
f h f f h f f f
2 2 2 2 2! 2 3! 2 4!
f 0.42920 1 00.42920 1
0.42920 2 0 0.42920 3 1 0.42920 4
2 2! 3! 4!
1 0 0.092106 0 0.00141393
01.07.4 Chapter 01.07
0.90931
The value of sin 2 I get from my calculator is 0.90930 which is very close to the value I just
obtained. Now you can get a better value by using more terms of the series. In addition, you
can now use the value calculated for sin 2 coupled with the value of cos2 (which can be
calculated by Taylor series just like this example or by using the sin 2 x cos2 x 1 identity)
to find value of sin x at some other point. In this way, we can find the value of sin x for
any value from x 0 to 2 and then can use the periodicity of sin x , that is
sin x sin x 2n , n 1,2, to calculate the value of sin x at any other point.
Example 3
x3 x5 x7
Derive the Maclaurin series of sin x x
3! 5! 7!
Solution
In the previous example, we wrote the Taylor series for sin x around the point x .
2
Maclaurin series is simply a Taylor series for the point x 0 .
f x sin x , f 0 0
f x cosx , f 0 1
f x sin x , f 0 0
f x cosx , f 0 1
f x sin x , f 0 0
f x cos(x) , f 0 1
Example 4
Find the value of f 6 given that f 4 125 , f 4 74 , f 4 30 , f 4 6 and all
other higher derivatives of f x at x 4 are zero.
Solution
h2 h3
f x h f x f x h f x f x
2! 3!
x4
h 64
2
Since fourth and higher derivatives of f x are zero at x 4 .
22 23
f 4 2 f 4 f 42 f 4 f 4
2! 3!
2 2
2 3
f 6 125 742 30 6
2! 3!
125 148 60 8
341
Note that to find f 6 exactly, we only needed the value of the function and all its
derivatives at some other point, in this case, x 4 . We did not need the expression for the
function and all its derivatives. Taylor series application would be redundant if we needed to
know the expression for the function, as we could just substitute x 6 in it to get the value
of f 6 .
Actually the problem posed above was obtained from a known function
f x x 3 3x 2 2 x 5 where f 4 125 , f 4 74 , f 4 30 , f 4 6 , and all other
higher derivatives are zero.
Rn x h
h
n 1
f n 1 c .
(n 1)!
where
xc xh
that is, c is some point in the domain x, x h .
01.07.6 Chapter 01.07
Example 5
The Taylor series for e x at point x 0 is given by
x2 x3 x4 x5
ex 1 x
2! 3! 4! 5!
a) What is the truncation (true) error in the representation of e1 if only four terms of the
series are used?
b) Use the remainder theorem to find the bounds of the truncation error.
Solution
a) If only four terms of the series are used, then
x2 x3
e 1 x
x
2! 3!
12 13
e1 1 1
2! 3!
2.66667
The truncation (true) error would be the unused terms of the Taylor series, which then are
x4 x5
Et
4! 5!
14 15
4! 5!
0.0516152
b) But is there any way to know the bounds of this error other than calculating it
directly? Yes,
hn
f x h f x f x h f n x Rn x h
n!
where
Rn x h
h n1 f n1 c x c x h
, , and
n 1!
c is some point in the domain x, x h . So in this case, if we are using four terms of the
Taylor series, the remainder is given by x 0, n 3
R3 0 1
131 f 31 c
3 1!
1
f 4
c
4!
ec
24
Since
xc xh
0 c 0 1
0 c 1
The error is bound between
Taylor Theorem Revisited 01.07.7
e0 e1
R3 1
24 24
R3 1
1 e
24 24
0.041667 R3 1 0.113261
So the bound of the error is less than 0.113261 which does concur with the calculated error
of 0.0516152 .
Example 6
The Taylor series for e x at point x 0 is given by
x2 x3 x4 x5
ex 1 x
2! 3! 4! 5!
As you can see in the previous example that by taking more terms, the error bounds decrease
and hence you have a better estimate of e1 . How many terms it would require to get an
approximation of e1 within a magnitude of true error of less than 10 6 ?
Solution
Using n 1 terms of the Taylor series gives an error bound of
Rn x h
h
n 1
f n 1 c
n 1!
x 0, h 1, f ( x) e x
Rn 1
1n1 f n1 c
n 1!
1n 1 e c
n 1!
Since
xc xh
0 c 0 1
0 c 1
Rn 1
1 e
(n 1)! (n 1)!
So if we want to find out how many terms it would require to get an approximation of e1
within a magnitude of true error of less than 10 6 ,
e
10 6
(n 1)!
(n 1)! 10 6 e
(n 1)! 10 6 3 (as we do not know the value of e but it is less than 3).
n9
So 9 terms or more will get e1 within an error of 10 6 in its value.
01.07.8 Chapter 01.07
We can do calculations such as the ones given above only for simple functions. To
do a similar analysis of how many terms of the series are needed for a specified accuracy for
any general function, we can do that based on the concept of absolute relative approximate
errors. We use the concept of absolute relative approximate error , which is calculated after
each term in the series is added. The maximum value of m , for which the absolute relative
approximate error is less than 0.5 10 2m % is the least number of significant digits correct in
the answer. It establishes the accuracy of the approximate value of a function without the
knowledge of remainder of Taylor series or the true error.