# Deriving Eulers method

I am wondering if it is possible to derive Eulers method without doing it graphically.

I am trying to give a detailed derivation of Eulers method, and how the formula is found

$$y_i=y_{i-1}+hf(x_{i-1},y_{i-1})$$

If anyone could derive this formula and show how its found would be great, or even a link to a website/textbook. Thanks!

Here's one simple way to discover Euler's method for solving the differential equation $y'(x) = f(x,y(x))$. You know that $$y(x_i) \approx y(x_{i-1}) + y'(x_{i-1})\Delta x = y(x_{i-1}) + f(x_{i-1}, y(x_{i-1})) \Delta x.$$ That comes directly from the definition of the derivative. Unfortunately, $y(x_{i-1})$ is unknown, but at least we have the approximation $y_{i-1}$ that we already computed at the last iteration. This suggests approximating $y(x_i)$ by the number $y_i$ given by $$y_i = y_{i-1} + f(x_{i-1}, y_{i-1}) \Delta x.$$
You are given an initial value, of $y$, and you want to use the gradient of the function to calculate subsequent values.
I will assume that $f(x_{i-1},y_{i-1})$ is the gradient function. Thus, plugging $x$ and $y$ values into this equation will provide the gradient at a particular point.
Recall that the gradient is the change in the $y$-value divided by a change in $x$. Thus, multiplying your step-size of $h$ by the gradient will estimate the change in the $y$-value. You then add this to the $y$-value at the point to get the new $y$-value of $y_{i}$.