So, last time we looked at the Maclaurin expression for e^x. The exponential function was particular easy because its derivative is equal to the function itself every time. Let’s look at a slightly more involved example where this is not true: f(x)=\sin x about x=0. Again, we start with the table of derivatives:

 

\left(  \begin{array}{ccc}  \text{ i} & f^{(i)}\text{(x)} & f^{(i)}\text{(0)} \\  0 & \sin (x) & 0 \\  1 & \cos (x) & 1 \\  2 & -\sin (x) & 0 \\  3 & -\cos (x) & -1 \\  4 & \sin (x) & 0 \\  5 & \cos (x) & 1 \\  \end{array}  \right)

 

Now the values of the derivatives are not always the same. They are zero every other term, and they change in sign when they are not zero. This leads to a very elegant expression for the \sin function expanded around x=0:

 

\sin x\approx\sum_{i=0}^n \frac{(-1)^ix^{2i+1}}{(2i+1)!}

 

An important point is that here the terms get smaller and smaller as you take more and more of them, so if, for instance, you want to know the value of \sin 2.4 you can plug it into the right hand side, take a finite number of terms and you will get an approximation:

 

\sum_{i=0}^n \frac{(-1)^i2.4^{2i+1}}{(2i+1)!}

 

The higher value you choose for n the more accurate will be your answer, but we can see that we can now, in theory calculate the \sin of any number with pen and paper, so long as you have enough patience and will-power.

Had we written our approximation not with n terms, but with \infty instead, we would have, not a polynomial, but a series and it turns out that this is exact. We can write:

 

\sin x=\sum_{i=0}^\infty \frac{(-1)^ix^{2i+1}}{(2i+1)!}

 

However, in general we are only going to be talking about Taylor polynomials, and not series here. Such objects have to be dealt with carefully, because infinities can give us strange answers, as we’ve already seen when we looked at improper integrals.

 

Using Taylor polynomials to understand limits

One way of using Taylor polynomials very effectively is to look at questions about limits. For instance, we might be asked about the limit:

 

\lim_{x\rightarrow 0}\frac{\ln(1+x)-x+x^2}{x^2}

 

It is not clear how this is going to go as it looks like there might be a problem with the \frac{x}{x^2} part, but what we really need to know is how \ln(1+x) goes close to x=0. We can do our usual trick of writing out a table as follows:

 

\left(  \begin{array}{ccc}  \text{ i} & f^{(i)}\text{(x)} & f^{(i)}\text{(0)} \\  0 & \ln(1+x) & 0 \\  1 & \frac{1}{1+x} & 1 \\  2 & -\frac{1}{(1+x)^2} & -1 \\  3 & \frac{2}{(1+x)^3} & 2 \\  4 & -\frac{3.2}{(1+x)^4} & -3! \\  5 & \frac{4.3.2}{(1+x)^5} & 4! \\  6 & -\frac{5.4.3.2}{(1+x)^6} & -5! \\  \end{array}  \right)

 

etc. Thus, combining this with the general expression for the Maclaurin polynomial we have that for \ln(1+x):

 

\ln(1+x)\approx\sum_{i=1}^n (-1)^{i+1}\frac{x^i}{i}

 

Note that all factorials have disappeared. Now, if we are interested in the behaviour of this function close to x=0 we can certainly take just the first few terms, so we can say that:

 

\lim_{x\rightarrow 0}\frac{\ln(1+x)-x+x^2}{x^2}\sim \frac{(x-\frac{x^2}{2}+\frac{x^3}{3}+...)-x+x^2}{x^2}

 

Now we can see that this is given by:

 

\lim_{x\rightarrow 0} \frac{\frac{x^2}{2}+\frac{x^3}{3}-....}{x^2}=\frac{1}{2}

 

So we have used a Maclaurin polynomial to find the limit of what at first sight looked like a rather complicated limit to take. Of course we could have used L’Hospital’s rule, but now we have another method in our armory.

 

Example: A composite function

Let’s now look at an example which at first sight looks like it’s going to be horrendous. What is the Maclaurin polynomial for:

 

x^4 e^{-3x^2}

 

At first sight this looks horrendous. We will have to take derivatives of this function which is going to give more and more complication expressions. However, there’s something we can use to our advantage. We already know the Maclaurin polynomial for e^x and we can use this to simply substitute in x\rightarrow -3x^2. This then gives:

 

x^4 e^{-3x^2} \approx x^4 \sum_{i=0}^n \frac{(-3x^2)^i}{i!}=\sum_{i=0}^n \frac{(-3)^i x^{2i+4}}{i!}

 

And that’s it! You don’t have to do any more complicated differentiating.

 

Example: \cos x

How about the Maclaurin polynomial for \cos x. Well, we have already calculated \sin x and we know that \cos x=\frac{d \sin x}{dx} so we can simply take the derivative of the expansion for \sin x:

\cos =\frac{d\sin x}{dx}

\approx\frac{d}{dx}\sum_{i=0}^n \frac{(-1)^i x^{2i+1}}{(2i+1)!}

\approx\sum_{i=0}^n \frac{(-1)^i \frac{dx^{2i+1}}{dx}}{(2i+1)!}

\approx\sum_{i=0}^n\frac{(-1)^ix^{2i}}{(2i)!}

\approx 1-\frac{x^2}{2}+\frac{x^4}{4!}-\frac{x^6}{6!}+...

 

You should remember the Maclaurin polynomials for e^x, \sin x and \cos x.

 

Approximating \pi

We saw previously how we could calculate a polynomial expression for the number e. Let’s ask about a polynomial expression for \pi. We know that \arctan 1=\frac{\pi}{4}, so let’s try and get a Maclaurin polynomial for \arctan x and then substitute in x=1 and see what happens. Well, let’s start with our normal table…

 

\left(  \begin{array}{ccc}  \text{i} & f^{(i)}\text{(x)} & f^{(i)}\text{(0)} \\  0 & \tan ^{-1}(x) & 0 \\  1 & \frac{1}{x^2+1} & 1 \\  2 & -\frac{2 x}{\left(x^2+1\right)^2} & 0 \\  3 & \frac{8 x^2}{\left(x^2+1\right)^3}-\frac{2}{\left(x^2+1\right)^2} & -2 \\  4 & \frac{24 x}{\left(x^2+1\right)^3}-\frac{48 x^3}{\left(x^2+1\right)^4} & 0 \\  5 & -\frac{288 x^2}{\left(x^2+1\right)^4}+\frac{24}{\left(x^2+1\right)^3}+\frac{384 x^4}{\left(x^2+1\right)^5} & 24 \\  6 & -\frac{720 x}{\left(x^2+1\right)^4}-\frac{3840 x^5}{\left(x^2+1\right)^6}+\frac{3840 x^3}{\left(x^2+1\right)^5} & 0 \\  7 & \frac{17280 x^2}{\left(x^2+1\right)^5}-\frac{720}{\left(x^2+1\right)^4}+\frac{46080 x^6}{\left(x^2+1\right)^7}-\frac{57600 x^4}{\left(x^2+1\right)^6} & -720 \\  \end{array}  \right)

 

But this is horrible and doing these derivatives gets harder and harder. Is there any easier way to do this? It turns out that there is. Let’s look instead at the Maclaurin polynomial for \frac{1}{1+x}. The table in this case is given by:

 

\left(  \begin{array}{ccc}  \text{i} & f^{(i)}\text{(x)} & f^{(i)}\text{(0)} \\  0 & \frac{1}{x+1} & 1 \\  1 & -\frac{1}{(x+1)^2} & -1 \\  2 & \frac{2}{(x+1)^3} & 2 \\  3 & -\frac{6}{(x+1)^4} & -3! \\  4 & \frac{24}{(x+1)^5} & 4! \\  5 & -\frac{120}{(x+1)^6} & -5! \\  6 & \frac{720}{(x+1)^7} & 6! \\  7 & -\frac{5040}{(x+1)^8} & -7! \\  \end{array}  \right)

 

Which is much easier to handle. So the Maclaurin polynomial for \frac{1}{1+x} is given by:

 

1 - x + x^2 - x^3 + x^4 - x^5 + x^6 - x^7+...=\sum_{i=0}^n(-1)^i x^i

 

We can use the same trick as before to calculate the Maclaurin polynomial for \frac{1}{1+x^2} which is just by substituting x\rightarrow x^2 which gives:

 

\frac{1}{1+x^2}\approx 1 - x^2 + x^4 - x^6 + x^8 - x^{10} + x^{12} - x^{14}+...=\sum_{i=0}^n(-1)^i x^{2i}

 

But we also know that \arctan x=\int \frac{1}{1+x^2} dx, so if we integrate the above, we should get the polynomial for \arctan x:

\arctan x\approx\int \sum_{i=0}^n(-1)^i x^{2i} dx= x-\frac{x^3}{3}+\frac{x^5}{5}-\frac{x^7}{7}+\frac{x^9}{9}+...=\sum_{i=0}^n \frac{(-1)^{i}x^{2i+1}}{2i+1}

 

Now we can substitute in x=1 and find that:

 

\arctan 1=\frac{\pi}{4}\sim\sum_{i=0}^n \frac{(-1)^{i}}{2i+1}=1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+...

 

So now we have a polynomial approximation for \pi. Again, an irrational function which can be written as a sum of rational values with a very specific pattern.

It turns out that you have to take a lot of terms for this to give a good approximation for \pi. Whereas our approximation for e converged very quickly, you have to take around 5 billion terms for this to approximate \pi to 10 decimal places. That’s not a great way to get \pi

It turns out that there is another expression for \pi which converges much much faster, which was found by the Indian Mathematician Ramanujan who we heard about in a previous bonus section.

How clear is this post?