Taylor Series
From Math Images
Line 8:  Line 8:  
::<math>\sin(x) \approx P_n(x) = x  {x^3 \over 3!} + {x^5 \over 5!}  {x^7 \over 7!} + \cdots + (1)^{{n1}\over2} {x^n \over n!}</math>  ::<math>\sin(x) \approx P_n(x) = x  {x^3 \over 3!} + {x^5 \over 5!}  {x^7 \over 7!} + \cdots + (1)^{{n1}\over2} {x^n \over n!}</math>  
<br>  <br>  
  :In this example, ''n'' varies from 0 to 36. As we can see, as ''n'' becomes larger and there are more terms in the Taylor polynomial, the Taylor polynomial comes to "look" more like the original function; it becomes a progressively better approximation of the function sin(''x''). If ''n'' were to go to infinity, the approximating polynomial would become identical to both the Taylor series and the original function ''y'' = sin(''x''). Since it is impossible to  +  :In this example, ''n'' varies from 0 to 36. As we can see, as ''n'' becomes larger and there are more terms in the Taylor polynomial, the Taylor polynomial comes to "look" more like the original function; it becomes a progressively better approximation of the function sin(''x''). 
+  <br>  
+  :If ''n'' were to go to infinity, the approximating polynomial would become identical to both the Taylor series and the original function ''y'' = sin(''x''). Since it is impossible to evaluate every term in an infinite series, we settle for using a Taylor polynomial with finite ''n'' as an approximation.  
<br>  <br>  
:In this page, we will focus on how such approximations might be obtained as well as how the error of such approximations might be bounded.  :In this page, we will focus on how such approximations might be obtained as well as how the error of such approximations might be bounded.  
Line 14:  Line 16:  
:For the math behind this, please go to the [[#MMEMore Mathematical Explanation]] section.  :For the math behind this, please go to the [[#MMEMore Mathematical Explanation]] section.  
ImageDescElem=<br>  ImageDescElem=<br>  
  Taylor series are important because they allow us to compute functions that cannot otherwise be computed. While the above Taylor polynomial for the sine function  +  Taylor series are important because they allow us to compute functions that cannot otherwise be computed by conventional means. While the above Taylor polynomial for the sine function seems complicated and is annoying to evaluate, it is just the sum of terms composed of exponents and factorials, so the Taylor polynomial can be reduced to the basic operations of addition, subtraction, multiplication, and division. We can obtain an approximation by writing the function as a polynomial, which we know how to evaluate reliably. 
  <br>  +  <br><br> 
  Readers may already be familiar with a particular type of Taylor series. Consider, for instance, an infinite geometric series with common ratio ''x'':  +  Readers may, without knowing it, already be familiar with a particular type of Taylor series. Consider, for instance, an infinite geometric series with common ratio ''x'': 
  <br>  +  <br><br> 
:<math>{1 \over {1x}} = 1 + x + x^2 + x^3 + \cdots</math> for <math>1 < x < 1</math>  :<math>{1 \over {1x}} = 1 + x + x^2 + x^3 + \cdots</math> for <math>1 < x < 1</math>  
<br>  <br>  
  The right side of the equation is an infinite power series, so we have the Taylor series for <math>f (x) = {1 \over {1x}}</math>, the sum of the infinite geometric series.  +  The right side of the equation is an infinite power series, so we have the Taylor series for <math>f (x) = {1 \over {1x}}</math>, the sum of the infinite geometric series. The [[#MMEMore Mathematical Explanation]] will provide examples of some other Taylor series, as well as the process for deriving them from the original functions. 
  +  
  The [[#MMEMore Mathematical Explanation]] will provide  +  
<br><br>  <br><br>  
Using Taylor series, we can approximate infinitely differentiable functions. For example: <!choose an example for the geometric series>  Using Taylor series, we can approximate infinitely differentiable functions. For example: <!choose an example for the geometric series>  
Line 52:  Line 52:  
<div id = "MME"></div>  <div id = "MME"></div>  
ImageDesc=<br>  ImageDesc=<br>  
  ==The  +  ==The general form of a Taylor series== 
<br>  <br>  
In this subsection, we will derive a general formula for a function's Taylor series using the derivatives a general function ''f''(''x''). Taylor polynomials are defined as follows:  In this subsection, we will derive a general formula for a function's Taylor series using the derivatives a general function ''f''(''x''). Taylor polynomials are defined as follows:  
Line 94:  Line 94:  
which gives us the quadratic approximation shown in [[#Figure2cFigure 2c]]. This approximation is better still.  which gives us the quadratic approximation shown in [[#Figure2cFigure 2c]]. This approximation is better still.  
<br><br>  <br><br>  
  As we can see, the quality of our approximation increases as we add more terms to the Taylor polynomial. Since Taylor series is the Taylor polynomial of infinitely large degree, it should be a perfect approximation  +  As we can see, the quality of our approximation increases as we add more terms to the Taylor polynomial. Since Taylor series is the Taylor polynomial of infinitely large degree, it should be a perfect approximation, identical to the original function at every point. 
<br><br>  <br><br>  
Taylor proved that such a series <math>T(x)</math> must exist for every infinitely differentiable function ''f''. In fact, without loss of generality, using the definition of a power series, we can write the Taylor series of a function ''f'' around ''a'' as  Taylor proved that such a series <math>T(x)</math> must exist for every infinitely differentiable function ''f''. In fact, without loss of generality, using the definition of a power series, we can write the Taylor series of a function ''f'' around ''a'' as  
Line 128:  Line 128:  
==Finding the Taylor series for a specific function==  ==Finding the Taylor series for a specific function==  
  Many Taylor series can be derived using {{EquationNoteEq. 2}}  +  Many Taylor series can be derived using {{EquationNoteEq. 2}} by substituting in ''f'' and ''a''. Here we will demonstrate this process in detail for the natural logarithm function. Other elementary functions, such as sin(''x''), cos(''x''), and ''e'' <sup>''x''</sup>, can be treated similarly. Their Taylor series will also be provided. 
<br><br>  <br><br>  
The natural log function is:  The natural log function is:  
Line 138:  Line 138:  
:<math> f'(x)=1/x </math>, <math> f''(x)=1/x^2 </math>, <math> f ^{(3)}(x)=2/x^3, \cdots</math> <math> f ^{(k)}(x) = {{(1)^{k1} \cdot (k1)!} \over x^k}</math>  :<math> f'(x)=1/x </math>, <math> f''(x)=1/x^2 </math>, <math> f ^{(3)}(x)=2/x^3, \cdots</math> <math> f ^{(k)}(x) = {{(1)^{k1} \cdot (k1)!} \over x^k}</math>  
<br>  <br>  
  Since this function and its derivatives are undefined at ''x'' = 0, we cannot construct a Maclaurin series (a Taylor series centered at ''x'' = 0) for it. Note that, when choosing ''a'', one must select a value not only for which the derivatives ''f''<sup>(''k'')</sup>(''a'') are defined but at which they can be evaluated. Centering our Taylor series at ''a'' = 2 would not work because ''f''<sup>(0)</sup>(2) = log(2) is unknown and, in fact, cannot even be approximated until we have obtained our Taylor series. For the natural log, it makes sense to let ''a'' = 1 and compute the derivatives at this point:  +  Since this function and its derivatives are undefined at ''x'' = 0, we cannot construct a Maclaurin series (a Taylor series centered at ''x'' = 0) for it. Note that, when choosing ''a'', one must select a value not only for which the derivatives ''f'' <sup>(''k'')</sup>(''a'') are defined but at which they can be evaluated. Centering our Taylor series at ''a'' = 2 would not work because ''f'' <sup>(0)</sup>(2) = log (2) is unknown and, in fact, cannot even be approximated until we have obtained our Taylor series. For the natural log, it makes sense to let ''a'' = 1 and compute the derivatives at this point: 
<br><br>  <br><br>  
:<math> f(1) = \log 1 = 0</math>, <math> f'(1) = {1 \over 1} = 1</math>, <math> f''(1) = { 1 \over 1^2} = 1</math>, <math> f ^{(3)} (1) = {2 \over 1^3} = 2, \cdots</math> <math> f ^{(k)} (1) = {(1)^{k1} \cdot (k1)!}</math>  :<math> f(1) = \log 1 = 0</math>, <math> f'(1) = {1 \over 1} = 1</math>, <math> f''(1) = { 1 \over 1^2} = 1</math>, <math> f ^{(3)} (1) = {2 \over 1^3} = 2, \cdots</math> <math> f ^{(k)} (1) = {(1)^{k1} \cdot (k1)!}</math>  
Line 147:  Line 147:  
:<math> \log (x) = (x1)  {(x1)^2 \over 2} + {(x1)^3 \over 3} + \cdots </math>  :<math> \log (x) = (x1)  {(x1)^2 \over 2} + {(x1)^3 \over 3} + \cdots </math>  
<br>  <br>  
  We can avoid the cumbersome (''x''  1)<sup>k</sup> notation by introducing a new function ''g''(''x'') = log (1 + ''x''). Now we can expand  +  We can avoid the cumbersome (''x''  1)<sup>k</sup> notation by introducing a new function ''g''(''x'') = log (1 + ''x''). Now we can expand our polynomial around ''x'' = 0: 
<br><br>  <br><br>  
:<math> \log (1 + x) = x  {x^2 \over 2} + {x^3 \over 3}  {x^4 \over 4} + \cdots </math>  :<math> \log (1 + x) = x  {x^2 \over 2} + {x^3 \over 3}  {x^4 \over 4} + \cdots </math>  
Line 158:  Line 158:  
:<math> \log (1 + x) = x  {x^2 \over 2} + {x^3 \over 3}  {x^4 \over 4} + \cdots </math>  :<math> \log (1 + x) = x  {x^2 \over 2} + {x^3 \over 3}  {x^4 \over 4} + \cdots </math>  
<br>  <br>  
  Let's consider an arbitrary term in this series: <math>\pm x^n \over n</math>. As ''n'' increases, the denominator grows linearly, and the numerator [[Exponential Growthgrows exponentially]]. Exponential growth will eventually override linear growth for arbitrarily large ''n'', so the convergence or divergence of the series will be determined by ''x''<sup>''n''</sup>. So if ''x'' > 1, then the ''n''<sup>th</sup> term will grow without bound, and the Taylor series will  +  Let's consider an arbitrary term in this series: <math>\pm x^n \over n</math>. As ''n'' increases, the denominator grows linearly, and the numerator [[Exponential Growthgrows exponentially]]. Exponential growth will eventually override linear growth for arbitrarily large ''n'', so the convergence or divergence of the series will be determined by ''x''<sup>''n''</sup>. So if ''x'' > 1, then the ''n''<sup>th</sup> term will grow without bound, and the Taylor series will diverge. This is why we observe the abnormal behavior of the right side of [[#Figure2dFigure 2d]]. In this "divergent zone", although we can still write out and evaluate the polynomial, we cannot expect it to approximate the function. 
<br>  <br>  
Does this make it impossible to approximate the log(''x'') for values of ''x'' greater than 2? It would seem that this would make our Taylor series useless in many cases. For example, imagine that we want to approximate log(4):  Does this make it impossible to approximate the log(''x'') for values of ''x'' greater than 2? It would seem that this would make our Taylor series useless in many cases. For example, imagine that we want to approximate log(4):  
Line 164:  Line 164:  
:<math>log (4) = log (1 + 3) = 3  {3^2 \over 2} + {3^3 \over 3}  {3^4 \over 4} \cdots</math> (divergent)  :<math>log (4) = log (1 + 3) = 3  {3^2 \over 2} + {3^3 \over 3}  {3^4 \over 4} \cdots</math> (divergent)  
<br>  <br>  
  Instead, we can write:  +  We know that log (4) is defined, but our Taylor series cannot approximate it. Instead, we can write: 
<br><br>  <br><br>  
:<math>log (4) = log (e \cdot {4 \over e}) = log (e) + log ({4 \over e}) \approx 1 + log (1.47152) = 1 + log (1 + 0.47152)</math>  :<math>log (4) = log (e \cdot {4 \over e}) = log (e) + log ({4 \over e}) \approx 1 + log (1.47152) = 1 + log (1 + 0.47152)</math>  
Line 173:  Line 173:  
<br><br><br>  <br><br><br>  
Using a similar process, we can obtain Taylor series for a variety of other functions, such as the following:  Using a similar process, we can obtain Taylor series for a variety of other functions, such as the following:  
  
  
  
<br>  <br>  
  :<math>\  +  :<math>\sin (x) = x  {x^3 \over 3!} + {x^5 \over 5!}  {x^7 \over 7!} + {x^9 \over 9!}  \cdots</math> , expanded around the origin. ''x'' is in [[Radiansradians]]. 
<br>  <br>  
  :<math>e^x = 1 + x + {x^2 \over 2!} + {x^3 \over 3!} + {x^4 \over 4!} + {x^5 \over 5!} \cdots</math> , expanded around the origin. ''e'' is [[Euler's number]].  +  :<math>\cos (x) = 1  {x^2 \over 2!} + {x^4 \over 4!}  {x^6 \over 6!} + {x^8 \over 8!}  \cdots</math> , expanded around the origin. ''x'' is in [[Radiansradians]]. 
  <  +  <br> 
  Note that the powers of each successive term in the Taylor series for sine and cosine increase by 2; this makes sense when we consider the nature of successive derivatives of sin(  +  :<math>e^x = 1 + x + {x^2 \over 2!} + {x^3 \over 3!} + {x^4 \over 4!} + {x^5 \over 5!} + \cdots</math> , expanded around the origin. ''e'' is [[Euler's number]]. 
+  <br>  
+  Note that the powers of each successive term in the Taylor series for sine and cosine increase by 2, and each term alternates between positive and negative; this makes sense when we consider the nature of successive derivatives of sin (''x'') and cos(''x'') at ''x'' = 0. The Taylor series for ''e''<sup>''x''</sup> follows from the fact that the derivative of ''e''<sup>''x''</sup> is itself. Let it the derivation of these series using {{EquationNoteEq. 2}} be left to the reader.  
==Error bound of a Taylor series==  ==Error bound of a Taylor series==  
Line 202:  Line 201:  
<br><br>  <br><br>  
The answer to this latter question is yes. There are algorithms that give an approximate value of sine, for example, using only the four basic operations (+, , x, /)<ref name = ref1>[http://www.homeschoolmath.net/teaching/sine_calculator.php How does the calculator find values of sine], from homeschoolmath. This is an article about calculator programs for approximating functions.</ref>. Before the age of electronic calculators, mathematicians studied these algorithms in order to approximate these functions manually. The Taylor series, named after English mathematician Brook Taylor, is one such way of making these approximations. Basically, Taylor said that there is a way to expand any [[Differentiabilityinfinitely differentiable]] function into a polynomial series about a certain point. The power of the Taylor series is to approximate certain functions that cannot otherwise be calculated.  The answer to this latter question is yes. There are algorithms that give an approximate value of sine, for example, using only the four basic operations (+, , x, /)<ref name = ref1>[http://www.homeschoolmath.net/teaching/sine_calculator.php How does the calculator find values of sine], from homeschoolmath. This is an article about calculator programs for approximating functions.</ref>. Before the age of electronic calculators, mathematicians studied these algorithms in order to approximate these functions manually. The Taylor series, named after English mathematician Brook Taylor, is one such way of making these approximations. Basically, Taylor said that there is a way to expand any [[Differentiabilityinfinitely differentiable]] function into a polynomial series about a certain point. The power of the Taylor series is to approximate certain functions that cannot otherwise be calculated.  
  <br>  +  <br><br> 
  The calculator's algorithm uses this method to efficiently find a suitable approximation in the form of a polynomial series. Expanding enough terms for several digits of accuracy is easy for a computing device, even though Taylor series may look daunting to the naked eye. This algorithm is built in the permanent memory (ROM) of electronic calculators, and is triggered when a function like sine or cosine is called<ref name = ref2>[http://en.wikipedia.org/wiki/Calculator Calculator], from Wikipedia. This article explains the structure of an electronic calculator.</ref>.  +  The calculator's algorithm uses this method to efficiently find a suitable approximation in the form of a polynomial series. Expanding enough terms for several digits of accuracy is easy for a computing device, even though Taylor series may look daunting and tedious to the naked eye. This algorithm is built in the permanent memory (ROM) of electronic calculators, and is triggered when a function like sine or cosine is called<ref name = ref2>[http://en.wikipedia.org/wiki/Calculator Calculator], from Wikipedia. This article explains the structure of an electronic calculator.</ref>. 
<br><br>  <br><br>  
As is shown in the [[#MMEMore Mathematical Explanation]], Taylor series can be used to derive many interesting and useful series. Some of these series have helped mathematicians to approximate the values of important irrational constants such as <math>\pi</math> and <math>e</math>.  As is shown in the [[#MMEMore Mathematical Explanation]], Taylor series can be used to derive many interesting and useful series. Some of these series have helped mathematicians to approximate the values of important irrational constants such as <math>\pi</math> and <math>e</math>. 
Revision as of 14:52, 23 May 2013
Taylor Series 

Taylor Series
A Taylor series is a power series representation of an infinitely differentiable function. In other words, certain functions, like the trigonometric functions, can be written as the sum of an infinite series. Taylor series, then, provide an alternative method of evaluating those functions.
 An n^{th}degree Taylor polynomial for a function approximates the value of the function around a certain point by evaluating only up to the n^{th}degree term of the Taylor series. By doing so, we obtain a finite series, which can be summed but will not exactly match the infinite Taylor series. In the animation on the right, successive Taylor polynomials are compared to the actual function y = sin(x) using the following polynomial expansion:
 In this example, n varies from 0 to 36. As we can see, as n becomes larger and there are more terms in the Taylor polynomial, the Taylor polynomial comes to "look" more like the original function; it becomes a progressively better approximation of the function sin(x).
 If n were to go to infinity, the approximating polynomial would become identical to both the Taylor series and the original function y = sin(x). Since it is impossible to evaluate every term in an infinite series, we settle for using a Taylor polynomial with finite n as an approximation.
 In this page, we will focus on how such approximations might be obtained as well as how the error of such approximations might be bounded.
 For the math behind this, please go to the More Mathematical Explanation section.
Contents 
Basic Description
Taylor series are important because they allow us to compute functions that cannot otherwise be computed by conventional means. While the above Taylor polynomial for the sine function seems complicated and is annoying to evaluate, it is just the sum of terms composed of exponents and factorials, so the Taylor polynomial can be reduced to the basic operations of addition, subtraction, multiplication, and division. We can obtain an approximation by writing the function as a polynomial, which we know how to evaluate reliably.
Readers may, without knowing it, already be familiar with a particular type of Taylor series. Consider, for instance, an infinite geometric series with common ratio x:
 for
The right side of the equation is an infinite power series, so we have the Taylor series for , the sum of the infinite geometric series. The More Mathematical Explanation will provide examples of some other Taylor series, as well as the process for deriving them from the original functions.
Using Taylor series, we can approximate infinitely differentiable functions. For example:
First we must convert degrees to radians in order to use the Taylor series:
Then, substitute into the Taylor series of cosine above:
Here we only used 3 terms, since this should be enough to tell us something. Notice that the right side of the equation above involves only the four simple operations, so we can easily calculate its value:
On the other hand, trigonometry gives us the exact numerical value of this particular cosine:
So our approximating value agrees with the actual value to the fourth decimal, which is good accuracy for a basic approximation. Better accuracy can be achieved by using more terms in the Taylor series.
We can get the same conclusion if we graph the original cosine function and its approximation together as shown in Figure 1b. We can see that the original function and the approximating Taylor series are almost identical when x is small. In particular, the line x = π/6 cuts the two graphs almost simultaneously, so there is not much difference between the exact value and the approximating value. However, this doesn't mean that these two functions are exactly the same. For example, when x grows larger, they start to deviate significantly from each other. What's more, if we zoom in the graph at the intersection point, as shown in Figure 1c, we can see that there is indeed a difference between these two functions, which we cannot see in a graph of normal scale.
A More Mathematical Explanation
 Note: understanding of this explanation requires: *Calculus
The general form of a Taylor series
In this subsection, we will derive a general formula for a function's Taylor series using the derivatives a general function f(x). Taylor polynomials are defined as follows:
 The Taylor polynomial of degree n for f at a, written as , is the polynomial that has the same 0^{th} to n^{th}order derivatives as function f(x) at point a. In other words, the n^{th}degree Taylor polynomial must satisfy:
 (the 0^{th}order derivative of a function is itself)
 in which is the k^{th}order derivative of both and at a.
 The Taylor series is just with infinitely large degree n. Notice that f must be infinitely differentiable in order to have a Taylor series; every derivative of f must exist and be equal to that derivative of .
The following set of images show some examples of Taylor polynomials, from 0^{th} to 2^{nd}order:



From the definition above, the function f and its 0^{th}order Taylor polynomial must have the same 0^{th}order derivatives at a. Since the 0^{th}order derivative of a function is just itself by definition, we have:
which gives us the horizontal line shown in Figure 2a. This is certainly not a very close approximation. So we need to add more terms.
The first order Taylor polynomial must satisfy:
which gives us the linear approximation shown in Figure 2b. This approximation is better than the 0^{th}order one, but still not very usable far from a.
Similarly, the second degree Taylor polynomial must satisfy:
which gives us the quadratic approximation shown in Figure 2c. This approximation is better still.
As we can see, the quality of our approximation increases as we add more terms to the Taylor polynomial. Since Taylor series is the Taylor polynomial of infinitely large degree, it should be a perfect approximation, identical to the original function at every point.
Taylor proved that such a series must exist for every infinitely differentiable function f. In fact, without loss of generality, using the definition of a power series, we can write the Taylor series of a function f around a as
in which a_{0}, a_{1}, a_{2} ... are unknown coefficients. Our goal is to find these coefficients. From the definition of Taylor polynomials, we know that function f and Taylor series must have same derivatives of all degrees:
 , , ,
Using the constraints above, we can determine the value of all unknown coefficients in Eq. 1. Just consider of Eq. 1 and we get:
Note that the Taylor series approximates an infinitely differentiable function by exploiting qualities of the differentiability of polynomials. With each derivative, the constant term goes to 0, and every other term, its order being decreased by one, is multiplied by its previous order. The terms before a_{k} "vanish" because their associated power of (x  a ) doesn't "survive" taking k derivatives. The terms after a_{k} vanish because they still contain (x  a ) to some power, so when evaluated at x = a, they go to 0. So we are left with this simple equation, from which we can directly get:
Since 0! = 1, then this formula holds for all nonnegative integers n from 0 to infinity. So, using derivatives, we have obtained an expression for all unknown coefficients of the given function f. Substitute them back into Eq. 1 to get an explicit expression of Taylor series:
or,
This is the standard formula of Taylor series that we will use throughout the rest of this page. In many cases, it is convenient to let a = 0 to get a neater expression:
Eq. 3 is called the Maclaurin series after Scottish mathematician Colin Maclaurin, who made extensive use of these series in the 18th century.
Finding the Taylor series for a specific function
Many Taylor series can be derived using Eq. 2 by substituting in f and a. Here we will demonstrate this process in detail for the natural logarithm function. Other elementary functions, such as sin(x), cos(x), and e ^{x}, can be treated similarly. Their Taylor series will also be provided.
The natural log function is:
Its derivatives are:
 , ,
Since this function and its derivatives are undefined at x = 0, we cannot construct a Maclaurin series (a Taylor series centered at x = 0) for it. Note that, when choosing a, one must select a value not only for which the derivatives f ^{(k)}(a) are defined but at which they can be evaluated. Centering our Taylor series at a = 2 would not work because f ^{(0)}(2) = log (2) is unknown and, in fact, cannot even be approximated until we have obtained our Taylor series. For the natural log, it makes sense to let a = 1 and compute the derivatives at this point:
 , , ,
Substitute these derivatives into Eq. 2, and we can get the Taylor series for centered at x = 1:
We can avoid the cumbersome (x  1)^{k} notation by introducing a new function g(x) = log (1 + x). Now we can expand our polynomial around x = 0:
The animation to the right shows this Taylor polynomial with degree n varying from 0 to 25. As we can see, the left part of this polynomial quickly comes to approximate the original function with fair accuracy. However, the right part exhibits some strange behavior: it seems to diverge farther away from the function as n grows larger. This tells us that a Taylor series is not always a reliable approximation of the original function. The fact that they have same derivatives doesn't guarantee that the Taylor series will represent a suitable approximation at all values of x. Other factors need to be considered.
This is true because power series, like the Taylor series for log(1 + x) do not necessarily converge for all values of x. The Taylor series for natural log is divergent when , while a valid polynomial approximation needs to be convergent.
Same thing happens in the Taylor series of natural log:
Let's consider an arbitrary term in this series: . As n increases, the denominator grows linearly, and the numerator grows exponentially. Exponential growth will eventually override linear growth for arbitrarily large n, so the convergence or divergence of the series will be determined by x^{n}. So if x > 1, then the n^{th} term will grow without bound, and the Taylor series will diverge. This is why we observe the abnormal behavior of the right side of Figure 2d. In this "divergent zone", although we can still write out and evaluate the polynomial, we cannot expect it to approximate the function.
Does this make it impossible to approximate the log(x) for values of x greater than 2? It would seem that this would make our Taylor series useless in many cases. For example, imagine that we want to approximate log(4):
 (divergent)
We know that log (4) is defined, but our Taylor series cannot approximate it. Instead, we can write:
 (convergent)
By using the identity log(a ·b ) = log (a ) + log (b ), we saved our approximation from the "divergent zone." Larger powers of e may be used as appropriate for larger values of x.
Using a similar process, we can obtain Taylor series for a variety of other functions, such as the following:
 , expanded around the origin. x is in radians.
 , expanded around the origin. x is in radians.
 , expanded around the origin. e is Euler's number.
Note that the powers of each successive term in the Taylor series for sine and cosine increase by 2, and each term alternates between positive and negative; this makes sense when we consider the nature of successive derivatives of sin (x) and cos(x) at x = 0. The Taylor series for e^{x} follows from the fact that the derivative of e^{x} is itself. Let it the derivation of these series using Eq. 2 be left to the reader.
Error bound of a Taylor series
error things here
Why It's Interesting
Have you ever wondered how calculators determine square roots, sines, cosines, and exponentials? For instance, if you were to type or into your calculator, how does it determine which value to spit out? The number must be related to our input in some way, but what exactly is the relationship? Does the calculator just read from an index of known values? Is there a more mathematical and precise way for the calculator to evaluate these functions?
The answer to this latter question is yes. There are algorithms that give an approximate value of sine, for example, using only the four basic operations (+, , x, /)^{[1]}. Before the age of electronic calculators, mathematicians studied these algorithms in order to approximate these functions manually. The Taylor series, named after English mathematician Brook Taylor, is one such way of making these approximations. Basically, Taylor said that there is a way to expand any infinitely differentiable function into a polynomial series about a certain point. The power of the Taylor series is to approximate certain functions that cannot otherwise be calculated.
The calculator's algorithm uses this method to efficiently find a suitable approximation in the form of a polynomial series. Expanding enough terms for several digits of accuracy is easy for a computing device, even though Taylor series may look daunting and tedious to the naked eye. This algorithm is built in the permanent memory (ROM) of electronic calculators, and is triggered when a function like sine or cosine is called^{[2]}.
As is shown in the More Mathematical Explanation, Taylor series can be used to derive many interesting and useful series. Some of these series have helped mathematicians to approximate the values of important irrational constants such as and .
Approximating pi
, or the ratio of a circle's circumference to its diameter, is one of the oldest, most important, and most interesting mathematical constants. The earliest documentation of can be traced back to ancient Egypt and Babylon, in which people used empirical values of such as 25/8 = 3.1250, or (16/9)^{2} ≈ 3.1605^{[3]}.
The first recorded algorithm for rigorously calculating the value of was a geometrical approach using polygons, devised around 250 BC by the Greek mathematician Archimedes. Archimedes computed upper and lower bounds of by drawing regular polygons inside and outside a circle, and calculating the perimeters of the outer and inner polygons. He proved that 223/71 < < 22/7 by using a 96sided polygon, which gives us 2 accurate decimal digits: π ≈ 3.14^{[4]}.
Mathematicians continued to use this polygon method for the next 1,800 years. The more sides their polygons have, the more accurate their approximations would be. This approach peaked at around 1600, when the Dutch mathematician Ludolph van Ceulen used a 2^{60}  sided polygon to obtain the first 35 digits of ^{[5]}. He spent a major part of his life on this calculation. In memory of his contribution, sometimes is still called "the Ludolphine number".
However, mathematicians have had enough of trillionsided polygons. Starting from the 17^{th} century, they devised much better approaches for computing , using calculus rather than geometry. Mathematicians discovered numerous infinite series associated with , and the most famous one among them is the Leibniz series:
We have seen the Leibniz series as an example of convergent series in the More Mathematical Explanation section. Here we are going to briefly explain how Leibniz got this result. This amazing sequence comes directly from the Taylor series of arctan(x):
We can get Eq. 4a by directly computing the derivatives of all orders for arctan(x) at x = 0, but the calculation involved is rather complicated. There is a much easier way to do this if we notice the following fact:
Recall that we gave the summation formula of geometric series in the More Mathematical Explanation section :
 ,
If we substitute r =  x^{2} into the summation formula above, we can expand the right side of Eq. 4b into an infinite sequence:
So Eq. 4b changes into:
Integrating both sides gives us:
Let x = 0, this equation changes into 0 = C . So the integrating constant C vanishes, and we get Eq. 4a.
One may notice that, like Taylor series of many other functions, this series is not convergent for all values of x. It only converges for 1 ≤ x ≤ 1. Fortunately, this is just enough for us to proceed. Substituting x = 1 into it, we can get the Leibniz series:
The Leibniz series gives us a radically improved way to approximate : no polygons, no square roots, just the four basic operations. However, this particular series is not suitable for computing , since it converges too slowly. The first 1,000 terms of Leibniz series give us only two accurate digits: π ≈ 3.14. This is horribly inefficient, and no mathematicians will ever want to use this algorithm.
Fortunately, we can get series that converge much faster if we substitute smaller values of x , such as , into Eq. 4a:
which gives us:
This series is much more efficient than the Leibniz series, since there are powers of 3 in the denominators. The first 10 terms of it give us 5 accurate digits, and the first 100 terms give us 50. Leibniz himself used the first 22 terms to compute an approximation of pi correct to 11 decimal places as 3.14159265358.
However, mathematicians are still not satisfied with this efficiency. They kept substituting smaller x values into Eq. 4a to get more convergent series. Among them is Leonhard Euler, one of the greatest mathematicians in the 18^{th} century. In his attempt to approximate , Euler discovered the following nonintuitive formula:
Although Eq. 4c looks really weird, it is indeed an equality, not an approximation. The following hidden section shows how it is derived in detail:
The next step is to expand Eq. 4c using Taylor series, which allows us to do the numeric calculations:
This series converges so fast that each term of it gives more than 1 digit of . Using this algorithm, it will not take more several days to calculate the first 35 digits of with pencil and paper, which Ludolph spent most of his life on.
Although Euler himself has never undertaken the calculation, this idea was developed and used by many other mathematicians at his time. In 1789, the Slovene mathematician Jurij Vega calculated the first 140 decimal places for of which the first 126 were correct. This record was broken in 1841, when William Rutherford calculated 208 decimal places with 152 correct ones. By the time of the invention of electronic digital computers, had been expanded to more than 500 digits. And we shouldn't forget that all of these started from the Taylor series of trigonometric functions.
Acknowledgement: Most of the historical information in this section comes from these this article: click here^{[6]}.
Approximating e
The mathematical constant , approximately equal to 2.71828, is also called Euler's Number. This important constant appears in calculus, differential equations, complex numbers, and many other branches of mathematics. What's more, it's also widely used other subjects such as physics and engineering. So we would really like to know its exact value.
Mathematically, is defined as:
In principle, we could have approximated using this definition. However, this method is so slow and inefficient that we are forced to find another one. For example, set n to 100 in the definition, and we can get:
which gives us only 2 accurate digits. This is really, really horrible accuracy for an approximating algorithm. So we have to find another way to do this.
One possible way is to use the Taylor series of function e^{x}, which has a very nice property:
The proof of this property can be found in almost every calculus textbook. It tells us that all derivatives of the exponential function are equal:
, and:
Substitute these derivatives into Eq. 2, the general formula of Taylor Series, we can get:
Let x = 1, and we can get another way to approximate :
This sequence is strongly convergent, since there are factorials in the denominators, and factorials grow really fast as n increases. Just take the first 10 terms and we can get:
The real value of is 2.718281828··· , so we have got 7 accurate digits! Compared to the approximation by definition, which gives us only two digits at order 100, this algorithm is incredibly fast and efficient.
In fact, we can get the same conclusion if we plot the function e^{x} and its two approximations together, and see which one converges faster. We already have the Taylor series approximation:
We can also find the powers of using the definition:
in which n' = n·x . We can switch between n' and n because both of the go to infinity, and which one we use doesn't matter.
In Figure 5b, these two approximations are graphed together to approximate the original function e^{x}. As we can see in the animation, Taylor series approximates the original function much faster than the definition does.
Teaching Materials
 There are currently no teaching materials for this page. Add teaching materials.
References
 ↑ How does the calculator find values of sine, from homeschoolmath. This is an article about calculator programs for approximating functions.
 ↑ Calculator, from Wikipedia. This article explains the structure of an electronic calculator.
 ↑ Pi, from Wolfram MathWorld. This article contains some history of Pi.
 ↑ Archimedes' Approximation of Pi. This is a thorough explanation of Archimedes' method.
 ↑ Digits of Pi, by Barry Cipra. Documentation of Ludolph's work is included here.
 ↑ How Euler Did It, by Ed Sandifer. This articles talks about Euler's algorithm for estimating π.
Leave a message on the discussion page by clicking the 'discussion' tab at the top of this image page.