If we now perform a Taylor expansion $$ x(t+h) = x(t)+hx^{(1)}(t)+\frac{h^2}{2}x^{(2)}(t)+O(h^3). $$ In our case the second derivative is known via Newton's second law, namely \( x^{(2)}(t)=a(x,t) \). If we add to the above equation the corresponding Taylor expansion for \( x(t-h) \), we obtain, using the discretized expressions $$ x(t_i\pm h) = x_{i\pm 1} \hspace{1cm}\mathrm{and}\hspace{1cm} x_i=x(t_i), $$ we arrive at $$ x_{i+1} = 2x_i - x_{i-1} +h^2x^{(2)}_i+O(h^4). $$