So we’ve now looked at a couple of different functions and found polynomials which approximate the functions to different levels of accuracy. Let’s try and come up with a general method of formulating this. Let’s say that we have some function and we want to approximate it close to . We will then assume that we can write the polynomial approximation as:
Note that previously we wrote but it’s good to get used to slightly changeable notation. The context is what should tell you the meaning.
We want to have that:
We will first ask that the value of the polynomial is equal to the value of the function at . We do this by setting in both sides of the above. Note that we are being slightly ambiguous in what we mean by the approximation here because in a moment we will go from a sign to an sign. This is because while the polynomial is only an approximation, we want that certain properties between the two hold exactly at . OK, setting and asking that this is exact, we have:
Now take a derivative of the above approximation and we have:
The term was a constant and vanished. Now again we ask that the approximation is exact at :
Now take another derivative:
Again, there was a constant term which had the coefficient which vanished. Now set and we get:
Take another derivative:
Thus . Again:
where we’ve used the notation to mean four derivatives of . Set :
The next iteration will give:
. Which gives:
In fact we can see a general pattern emerging, and we can write:
. If this is the case, then we can plug these constants back into our original polynomial and we have:
This is the Taylor approximation for about .
So, what does this mean? It means that we can write down a polynomial approximation for a function about if we can calculate its derivatives at the point . This is a very powerful statement, because polynomials are very easy to deal with, whereas our original expression may be very hard to deal with. The more terms we include, the more accurate will be our approximation. If we only include one term, then our approximation is only valid very very very close to . The more terms we include, the more closely the polynomial will approximate the function further away from . We have to be careful because sometimes this doesn’t work if our original function is badly behaved in particular ways, but for the functions we will look at, this will be fine.
OK, so what do we need to do for a given function? Well, we simply need to calculate the values of the derivatives of the function at and then plug these values into the expression above.
The Maclaurin expansion for
Let’s look at the function and write this as a Taylor polynomial about the point (ie. a Maclaurin polynomial). In order to do this we have to calculate the values of the derivatives of the function at . We set up a table:
In this case it is incredibly simple to work out the derivatives of the function and the value of the derivative at because they are all the same. Now we can plug this into the expression for the Taylor polynomial and find:
where this is only an approximation of if we take a finite number of terms. In this case, if we let we get an exact expression for :
In the following figure you can see how the first six terms in the Maclaurin polynomial add up to get a function which is a better and better approximation of the exponential function.
It is also very important to note that the further away from 0 (which was where we expanded the function about) we are, the worse is our approximation, independent of . For even will give a reasonable approximation to the value of . The further from we go, the higher the we need to get a good approximation for the function value. We can see from the equation itself that there is a balance at play. For close to zero, the higher order terms in the polynomial die off quickly because for small and larger and larger get smaller and smaller. However, for larger , (let’s say 2), the value of increases as gets larger and so we have to wait until the in the denominator get large enough to start to make the terms get small. Of course it’s not quite as simple as that as we are not just looking at individual terms but we are adding them together. The subject of how quickly these terms in the polynomials die off and can be ignored is a subject in and of itself.
What can we do with this? Well, the simplest thing that we can do is to get a value of in an algebraic way. By putting in we find that:
You can thus calculate by hand to arbitrary precision.
Isn’t that pretty amazing that a function which has a particular property related to growth (its derivative is equal to the function) and has a non-rational value, can be written like this as a sum of terms all of whom are rational. The point is that to get the exact value, you have to add up an infinite number of terms, but here we are happy with the approximate value.