Lesson: Numerical Differentiation: Second Derivative of a Continuous Function: Theory

In this segment we'll talk about numerical differentiation of continuous function. So here is the Taylor series for a function which is given to us at x, let's suppose, the first derivative is also known at x, second derivative, third, fourth, and all the derivatives are known. Then we can calculate the value of the function at x plus h. That's the primary thing about the Taylor series; give me the value of the function at a particular point, and all its possible derivative values at that particular point, and I can give you the value of the function at any other point. Of course, there's a fine print, that all these derivatives need to exist and be continuous between the point x and x plus h. So, to derive the formula, all we have to do is to take this Taylor series now which we have just written and instead of h, we put minus h, so instead of plus h we put minus h now, so wherever there's an h, we put minus h like this. So that we can calculate the value of the function at x minus h. So now, if we now expand this, this is what we're going to get for the odd powers of h, we'll have a negative outside, but for the positive for the even powers of h, we're going to get a positive number. Because minus one whole square negative one whole square will be one. So that's why you're finding out now that the sign is going to be alternating from minus to plus to minus to plus and so on and so forth.

So, we basically have written the value of the function at x plus h, and written the function x minus h. So, what does that do? So, we have two equations: equation one and equation two. Where we're writing the Taylor series for the function at x plus h and x minus h. Now what we want to do is we want to get the formula for the second derivative of the function, so somehow, we need to be able to get rid of the first derivative terms, so they don't show up in the formula. So, one of the ways to do it is simply add the two formulas.  So we get this, and what's going to happen is that if we add the left hand side we're going to get this quantity right here, we're going to add these two quantities, we're going to get 2 times f of x, and when we add these two quantities, they cancel out, they give us a zero, and when we add these two quantities gives us 2 times the quantity which is there in one of them, and when we add these two quantities they get they are zero when we add them, and again here when we add these two quantities it's going to have a two in the front because the this term of this term are the same. So that's what we're going to get when we add the two terms or the two equations.

So now what we have to do is we think about hey how can I find the formula for the second derivative of the function. So, we can very well see that this two factorial, two will cancel out also. So, I want to somehow be able to find the expression for the second derivative of the function. So what I’m going to do is I’m going to take 2 times f of x to the left hand side, I’m going to take all these terms there are, many, many terms here guys infinite number of terms I’m going to take all those terms to the left hand side and that's what I’m going to get right here and that left leaves in me with this expression on the right side of the second derivative of the function multiplied by h squared, so in order to find the second derivative of the function at x I will divide by h squared, and I’ll divide by h squared here. So, what's going to happen is that I will be able to figure out hey what is the second derivative function. This one this cancels, this one right here then gives me this part of the expression, while this one here h squared will cancel with h to the power 4, give me h squared, and that's why you have the squared term right here. And so, this becomes this this term here becomes the formula for the second derivative of the function here. It is important for us to think about these terms right here because that is the truncation error for the second derivative of the function.

It becomes also important for you to see that the first term it has h squared in it and that's why you'll find later on that the that the true error or the truncation error in the second derivative of the function by this formula is of the order of h squared. That's a separate lesson, but very important to note from here itself what the truncation error itself looks like. So, this is the formula for the second derivative of the function by using the Center Divided Difference formula. And that makes it to be the end of this segment.