# Approximation to the second derivative of a function through second differences

Professor Strang introduces approximations to second derivatives through second differences after clearly explaining the idea of first derivatives approximated by either of three first differences:

\begin{align} \text{forward: }&\Delta_F U=\frac{U(x+h)-U(x)}{h}\tag1\\ \text{backward: }&\Delta_B U=\frac{U(x)-U(x-h)}{h}\tag 2\\ \text{centered: }&\Delta_C U=\frac{U(x+h)-U(x-h)}{2h}\\ \end{align}

This is clear, and the advantage of centering is explained well.

However, there is a bit of a leap in the explanation of second derivatives:

$$\frac{d^2U}{dx^2}\approx\frac{-U_{i+1}+2U_i-U_{i-1}}{(\Delta x)^2}\\$$

The numerator seems to arise from the substraction of the numerators of Eq. 2 from Eq.1 with a change of sign. But it is not clear why this works. It does look like taking two adjacent approximations to the first derivative side-by-side, as opposed to the difference of a difference, or a multiplication of $\Delta_F\Delta_B.$ The squared delta in the denominator will presumably follow from the answer to the problem with the numerator.

What is the explanation as to why this approximation of the second derivative through second differences works?

The formula you have written is an approximation for the negative of the second derivative, not the second derivative itself. This approximation just comes from taking $$U''(x)\approx\frac{U'(x+h)-U'(x)}{h}\approx\frac{\frac{U(x+h)-U((x+h)-h)}{h}-\frac{U(x)-U(x-h)}{h}}{h}=\frac{U(x+h)-2U(x)+U(x-h)}{h^2}.$$ Here we first used $h$ as the increment for approximating $U''(x)$ with a forward difference, and then used $h$ as the increment for approximating each of $U'(x+h)$ and $U'(x)$ with a backward difference. (It takes some work to rigorously justify that you can really use the same $h$ in all of these approximations, but I'm guessing you aren't particularly interested in such technicalities.)