Math: Taylor Series

Brain_Boost
5 min readJul 17, 2023

--

Lets suppose you have the graph e^x. If I wanted to compute a value such e^(0.2) I would be able to do that by plugging it into the calculate but how does the calculator get that value?

Well this is all going to be explained through one of the most important theorems in mathematics: Taylor series! The idea is that we want to know how to do approximations in a more accurate manner.

Well you could say that we know e⁰ is equal to 1 so e^(0.2) must be slightly greater than that. But the larger the value of e is the greater this error increases and it increases very quickly.

In calculus a better way was developed to do this known as a linear approximation. Here we have a tangent line with the equation of y= x+1.

Source — https://www.youtube.com/watch?v=9YAaCEA08yM

The closer to where you put the tangent line in this case the tangent line at 0 the closer the approximation will be. Now could we be even better than a linear approximation by using a quadratic?

Source — https://www.youtube.com/watch?v=9YAaCEA08yM

The quadratic just touches at the point x = 0 and the slope in that area is very similar. The error now is so minimal. The error gets further reduced with a cubic.

Source — https://www.youtube.com/watch?v=9YAaCEA08yM

As you continue to increase the value the closer and closer the approximation will become. But how did we come up with those polynomials that so nicely approximate the region? How do we known this is the best polynomial to approximate that region?

So lets go all the way back to linearization. We just approximated with the tangent line. When creating the tangent line at the value of x= 0 . Here they have the same y values and the same slope.

Source-https://www.youtube.com/watch?v=9YAaCEA08yM

So lets look at e^x & c0 + c1x. at the value of x = 0 they are exactly equal. e⁰ = c0 + c1 * 0.

That leaves us with c0 = 1. Now that can be put back into the equation as 1 + c1x(a constant). Now what were going to do is take that the derivative's of both and plug 0 into that then e⁰ is again 1 and our c1 is one as well.

So inconclusion here we have e^x ~ 1 + x. This is not to say that they are exactly equal at they are very far at certain points further from 0 but for nearby 0 it is not a bad approximation.

Now lets try to understand this with quadratics. It will have the same y value, same slope and also the same concavity. A generic quadratic can be written as c0 + c1x + c2x². Three coefficients and three conditions.

Now lets first plug in x = 0. e⁰ and c0 +c1(0) + c2(0²).

e⁰ equals 1 which is just your c0 which makes it so that the quadratic now looks like 1 + c1(0) + c2(0²). Now we have to take the derivative as we want the slopes to be equal. We want our slope to be equal at x = 0 so we plug in 0.

e⁰ is one which equals c1 plus a bunch of other terms which is 0 so that tells us c1 will also have a value of 1.

Source — https://www.youtube.com/watch?v=9YAaCEA08yM

Now lets look at concavity which will be the second derivative and plug in x = 0. This is what happens:

source- https://www.youtube.com/watch?v=9YAaCEA08yM

As we have said many times e⁰ equals 1 and c2 is 1/2 so we get the final polynomial to be 1 + x + 1/2x².

Now lets generalize this.

source- https://www.youtube.com/watch?v=9YAaCEA08yM

Well the first thing we have to do is take a few derivatives. This is what happens:

source- https://www.youtube.com/watch?v=9YAaCEA08yM

Lets do another derivative to get:

source- https://www.youtube.com/watch?v=9YAaCEA08yM

Now if we continue this process and take the nth derivative this is what happens:

source- https://www.youtube.com/watch?v=9YAaCEA08yM

All the lower order terms where the power of x was less than n have had enough derivatives that they go to 0. For the nth term itself in general it becomes n factorial multiplied by the cn as the x goes away. Then there are a bunch of higher order terms where the x’s remain.

Previously after taking derivatives we plugged it in that x = 0 so lets do that again.

source- https://www.youtube.com/watch?v=9YAaCEA08yM

This now gives us a series of equations we can use to compute the c values.

source- https://www.youtube.com/watch?v=9YAaCEA08yM

So for the first line everything but c0 is 0. So c0 is just f(0). For the second line everything but the first remaining coefficient, c1 is is 0 hence c1 equals f(0).

c2 is f”(0)/2 and generically cn is you take n derivatives of it and then you divide it by n factorial to make it balanced. You can interpret the first few terms in the way of factorials:

The Maclaurin Series is one where you are doing a power series around x = 0, you compute out what the coefficients are and get this:

source- https://www.youtube.com/watch?v=9YAaCEA08yM

The fact that we plugged in x = 0 here is unimportant as you can just shift this so everywhere there is a zero you can put in an a. Now it will be x — a and the radius is the absolute value of x-a less than R. The derivative is evaluated a so its a slight shift in a more general case. This is what is known as Taylor Series.

source- https://www.youtube.com/watch?v=9YAaCEA08yM

Maclaurin Series is a special case of Taylor Series.

--

--