Consider the numerical routine:
$$\frac{1}{\Delta t^2} (U_i^{n+1} -2U_i^{n} + U_i^{n-1}) - \frac{a^2}{\Delta x^2} (U_{i+1}^{n} -2U_i^{n} + U_{i-1}^{n})$$
which solves the $1$-dimensional wave equation $$u_{tt} - a^2 u_{xx} = 0$$ where a $\in \mathbb{R}$ and $U_i^n$ is the numerical approximation of $u(j\Delta x,n\Delta t)$.
So my book mentions multiple times that this numerical scheme is second-order accurate. It kind of passingly mentions this with really saying how I would go about actually showing it, nor can I find any example of how to do so. The only thing it says is that
a truncation error analysis reveals second-order accuracy.
I tried looking this up and again I'm having a difficult time seeing what exactly it is I need to do. I think I need to perform a Taylor expansion but I don't know around which variables this needs to happen or where to evaluate it. I would appreciate it if someone could show how this is second order accurate or provide some references of where I would learn how to do so. It's something that keeps popping up.
Consider the spatial derivative (dropping the time index for convenience). Using the 4th order Taylor expansion we have
$$U_{i+1} = U_i + U_{x,i} \Delta x + \frac{1}{2}U_{xx,i}\Delta x^2 + \frac{1}{6}U_{xxx,i}\Delta x^3 + O(\Delta x^4), \\ U_{i-1} = U_i - U_{x,i} \Delta x + \frac{1}{2}U_{xx,i}\Delta x^2 - \frac{1}{6}U_{xxx,i}\Delta x^3 + O(\Delta x^4). $$
Adding the two equations, we get
$$U_{i+1} + U_{i-1} =2U_i + U_{xx,i}\Delta x^2 + O(\Delta x^4).$$
Rearrranging,
$$\frac{U_{i+1} -2U_i + U_{i-1}}{\Delta x^2} = U_{xx,i} + O(\Delta x^2).$$
This shows the truncation error associated with the central difference approximation of the second partial derivative is of second order. A similar result is obtained for the second partial derivative with respect to the time variable.