# Trapezoidal iteration method for solving differential equation

I am learning on how to use various numerical methods to approximate solutions to differential equations. We are using R, to actually iterate these functions, but I am having difficulties wrapping my head around the "trapezoidal" method.

I have been given the following:

$$\frac{dy}{dt} = -y, \hspace{1mm} y(0)=1$$

And the trapezoidal method is shown as

$$y_{k+1} = y_k + \frac{1}{2}h(f(t_k,y_k)+f(t_{k+1},y_{k+1})).$$

This is implicit as the solution depends on $$f(t_{k+1},y_{k+1})$$, so I am unsure of how to go about this, and turn it into an iterative process, without know the value at $$y_{k+1}$$.

Thanks for any help.

## 1 Answer

You have to solve an equation for $$y_{k+1}$$, which in general itself requires some iterative procedure. This is a basic limitation of implicit methods.

But in this particular case you can solve the equation explicitly: the original method reads

$$y_{k+1}=y_k - h \frac{y_k + y_{k+1}}{2}$$

and you can solve it:

$$y_{k+1}=\frac{1-h/2}{1+h/2} y_k.$$

• This makes sense, and is far simpler than I was imagining. Do I then plug this form of $y_{k+1}$ into the right side of the first equation, or would I just iterate upon this explicit form? – sokomov Feb 22 at 21:06
• @sokomov You can just iterate with the explicit form. – Ian Feb 22 at 23:23