# Explain the error term in Euler method

Task: I had to find out some estimates for M and L to make sure the proportional accucrazy is not above $10^{-4}$ in the Euler method with the problem below.

I am trying to understand the page 672 on this book here. The book provides the formula

$$\left|y(x_{n})-y_{n}\right|\leq \left(\frac{M}{2L}\right)\left(e^{L(x_{n}-x_{0})}-1\right)h$$

about the error where you can see the M and L (which looks like some use of Lambert function is needed or rough estimate for the upper bound, look at the $L$ term). There is also an example where it finds some upper bounds and claims some rough estimate. More precisely, I am trying to apply the method of deducing the error term on pages 673-674 for the problem 2 on page 676.

M

I cannot yet understand why the second derivative is used as an estimate for the $M$. On page 673, it just claims that assume that $|y''(x)|\leq M$ but cannot find any premise for it, the 2 in the above. This point about M on pages 673-674 is something black magic to me. Please, explain.

L

The L is apparently just length of the interval.

Definitions

L

$L$ is not the length of the interval, but a Lipschitz constant: some number such that $$|f(x,y_1) - f(x,y_2)| \le L|y_1 - y_2|$$ satisfied for all $y_1,y_2,x$ (in some interval of interest).

M

Similarly, $M$ is any number such that the assumption $|y''(x)| \le M$ is satisfied. The error analysis is also explained in this article here (reference taken from the Wikipedia article on the Euler method).

Example

Suppose the equation $y' = -\frac12 y$ with initial condition $y(0) = 1$ with the Euler method on the interval $x \in [0,1]$. We actually know the exact solution in this case, $y(x) = \exp(\frac12x)$.

Finding L

We note that $f(x,y) = \frac12 y$ in the example, so the equation

$$|f(x,y_1) - f(x,y_2)| \le L|y_1 - y_2|$$

becomes $$|\frac12 y_1 - \frac12 y_2| \le L |y_1 - y_2|.$$

This equation is satisfied for $L = \frac12$, so this is the value of $L$ we will take (we can also have taken a bigger value for $L$, like $L=1$, in which case we'll get a result which is also valid but not as sharp).

Finding M

We need it to satisfy $|y''(x)| \le M$. Since we know the exact solution, $y(x) = \exp(\frac12x)$, we know that $y''(x) = \frac14\exp(\frac12x)$ and so $|y''(x)| \le \frac14$ on the interval $x \in [0,1]$. However, for most equations we do not know the exact solution, so let us pretend we do not. Then what we can do is the following: differentiate the differential equation $y'(x) = \frac12 y$ to get $y''(x) = \frac12 y'$, and then substitute the differential equation in it to get

$$y''(x) = \frac12 \cdot \frac12 y = \frac14y.$$

We do know that the numerical solution given by the Euler method is a decreasing sequence for this example, so $y\le1$ and thus $|y''(x)| \le \frac14$ (as we found before).

Conclusion

So, we can take $L = \frac12$ and $M = \frac14$ in the error bound.

• ...the problem was such that we did not know the term $y$. In this case, my instructor showed me that one can from $\left|f(x,y_{1})-f(x,y_{2})\right|$ deduce some sort of upper bound for $L\left|y_{1}-y_{2}\right|$. Here, the separate-integration in the initial value problem will lead to $y$ where we get the upper bound. It is not crystal clear to me how we can make the Lipschnitz claim just by knowing the first derivative, there is something odd happening. Look we cannot get the function $y$ in the question but still we can get some sort of upper bound, some gap here. – hhh Feb 29 '12 at 10:51
• Way late to the game, but I think it comes down to the fact that if $f$ and $\frac{\partial f}{\partial y}$ are continuous, it implies that $f$ satisfies the Lipschitz condition: That is, there exists an L such that $|f(x,y_1) - f(x,y_2)| \le L|y_1 - y_2|$. The only thing that you are left to do is to determine what L is, as was done in the provided answer. Here is a proof: math.stackexchange.com/q/476075 – rocksNwaves Oct 16 '19 at 16:10