I have been looking through some notes on approximating solutions to 2nd order ODEs, and came across this approximation $$\left(\frac{d^2y}{dx^2}\right)_0 \approx \frac{y_1 - 2y_0 + y_{-1}}{h^2}$$ but there is no indication about where this comes from. There are similar first order approximations given, but I understand where these come from.
I am also not very sure how to use the approximation, so if someone could give an example or link to some material, that'd be useful.
Write down the Taylor series $$ y(\pm h)=y(0)\pm y'(0)h+\frac12y''(0)h^2+\frac16y'''(0)h^3+O(h^4) $$ and consider the sum and difference of both, \begin{align} y(h)-y(-h)&=2y'(0)h+O(h^3)\\ y(h)+y(-h)&=2y(0)+y''(0)h^2+O(h^4) \end{align} and solve for the derivatives. In the first derivative you get the central difference quotient $$y'(0)=\frac{y(h)-y(-h)}{2h}+O(h^2)$$ and the second derivative approximation is $$y''(0)=\frac{y(h)-2y(0)+y(-h)}{h^2}+O(h^2).$$