# Rewrite matrix equation for Euler method and Improved Euler method

Consider a system of the form:

(1) $x' = Ax + g$

For appropriate matrices $x'$, $A$, $x$, and $g$.

If we let $y_n$ be the approximation to the solution of (1) at time step $t_n$, what matrix equation will give $y_{n+1}$ for Euler's method? How about the improved Euler method (I understand this case may involve two equations)?

Euler's Method works as follows: Given an ODE $y'(t) = f(t,y(t)$ we can compute $y_{n+1} = y_n +h f(t_n,y(t_n))$ with some given stepsize $h$. In your case ( even though you are speaking of $y_{n+1}$, but your ODE reads $x'=Ax+g$, I assume you then have the ODE $y'=Ay+g$ ) $y_{n+1} = y_n +h (A y_n +g) = (A+h)y_n+ hg$.
Improved Euler method can be split into two equation, but it should rather be called two steps. You basically perform one Euler step, but this time you call the solution $y^*_{n+1}$. You then use the average of the slope at $y_n$ and $y^*_{n+1}$ to approximate the slope for your step $y_{n+1} = y_{n} +h\cdot s$ with $s = (f(y_n)+ f(y_{n+1}^*)/2$. Applied to your problem this would result in the following term. \begin{align}y_{n+1} &=y_n + h\cdot(f(y_n)+ f(y_{n+1}^*)/2 \\ &= y_n+ \frac{h}{2}( A y_n+g+(A+h)y_n+hg) \text{ by Euler method for }y^*_{n+1} \\ &= (1+{Ah}+ \frac{ h^2}{2})y_n +(\frac{h}{2}+\frac{h^2}{2})g\end{align}