[Math] Using Implicit Euler with second order differential equations

calculusintegrationnumerical methodsordinary differential equations

We can numerically integrate first order differential equations using Euler method like this:
$$y_{n+1} = y_n + hf(t_n, y_n)$$

And with Implicit Euler like this:
$$y_{n+1} = y_n + hf(t_{n+1},y _{n+1})$$

If I have a differential equation $y' – ky = 0$, I can integrate $y$ numerically using Implicit Euler:
$$y_{n+1} = y_n + hky_{n+1}$$
$$y_{n+1} = y_n\frac{1}{1-hk}$$

But how I do use Implicit Euler for second order differential equations, like for instance the equation for simple harmonic motion?
$$y'' + w^2y = 0$$

We have to integrate with respect to $y$ and $y'$. For explicit Euler the numerical integration would look like this (?):
$$y_{n+1} = y_n + hf(t_n, y'_n)$$
$$y'_{n+1} = y'_n + hg(t_n, y_n)$$

How would we do integrate using Implicit Euler instead?

Best Answer

Yes. For convenience, name the derivative $v_n=y_n'$. Then \begin{align} y_{n+1}&=y_n+hv_{n+1}\\ v_{n+1}&=v_n-hw^2y_{n+1}\\ \implies y_{n+1}(1+h^2w^2)&=y_n+hv_n\\ v_{n+1}(1+h^2w^2)&=v_n-hw^2y_n \end{align} which looks like an explicit Euler method with a correction factor.