[MUSIC] In this session, we're just going to take what we've learned about Taylor series so far. And reframe it to a form that will help us understand the expected error in an approximation. So as we've already seen, we can build up a sequence of gradually improving approximations to functions by adding higher power terms. All I'm going to do now is change the notation of some of the terms. So if we take our first order approximation as an example, what this expression is saying to us is starting from the height f of p, as you move away from p, your corresponding change in height is equal to your distance away from p times the gradient of your function at p. So in a sense, rather than using gradient equals rise over run, we are just rearranging to rise equals gradient times run. You are ultimately going to use your approximation to evaluate the function near p, as you must already know about it at p. So I'm now going to say that our distance from p which we currently call x - p, we will now call delta p to signify that it represents a small step size away from p. Or we can also recast x now in terms of p, saying x is just p + delta p. Finally, it actually is now time to say goodbye to p. As in our first order approximation, everything is actually in terms of p. So all I'm going to do is swap all the p's for x's. As this is the form that people would usually expect to see it in. I'm going to do it all at once to make it as painless as possible. I haven't changed anything conceptually, I've just written an x everywhere where we used to have a p. And we can now of course also rewrite our Taylor series expression in this new form with just x and delta x. So we're in good shape to talk about approximations. What I now want to know is, when I use the first order approximation, instead of evaluating the base function, how big should I expect the error to be? You can see, for example, that the gap between the white and green lines grows as we move along the x-axis away from the point x. Well, one way to think about it is that we know our function can be exactly represented by this infinitely long series. So although we won't be able to evaluate all of the terms, we do know that the next term along, i.e. the first term that we ignore, when we're using our first order of approximation, has a delta x squared in it. This means that if we can say that delta x is a small number, then delta x squared must be a really small number, and similarly, delta x cubed must be a ridiculously small number. So we can now rewrite our first order approximation to include an error term, which we just say is on the order of delta x squared, or equally that it is second order accurate. This process of taking a function and ignoring the terms above delta x is referred as linearisation and I hope it's now clear to you why that's the case. We've taken some potentially very nasty function and just approximated it with a straight line. The last idea that I'm going to share with you in this video is perhaps the most interesting, as it brings us right back to our rise over run approximation that we met at the beginning of the course. The green line is our first order, Taylor series approximation to the function at the point x, which is of course also the tangent to the curve at x. But let's now add another line which is the approximation to the gradient at x using our rise over run method with a second point delta x away. We use this forward different method to help us build the definition of a derivative at the beginning of the course. And we noticed that as delta x goes to 0, the approximation becomes exact. However, what happens if delta x does not go to 0 and the second point remains some finite distance away from x? Well, your calculated gradient will now contain an error. And once again, we can rearrange the full Taylor series to work out how big we'd expect that error to be. With a bit of slightly fiddly algebra, we can rearrange the expression such that the gradient term f dash of x is isolated on the left-hand side. Because this series is infinite, this is still an exact expression for the gradient at x. But what we get on the right-hand side is something that looks suspiciously like the rise over run expression plus a collection of higher order terms. If we notice that the first of the higher order terms has a delta x in it. We know that we can now lump them all together and say that using the rise of a run method between two points with a finite separation will give us an approximation to the gradient that contains an error proportional to delta x. Or more simply put, the forward difference method is first order accurate. That's all for this video. It might seem a little odd to go to all that trouble just to get an idea of the error in an approximation. But it turns out to be a hugely important concept when, as is typical, we ask computers to solve numerically rather than analytically. See you next time. [MUSIC]