When a differential equation cannot be solved analytically, we can approximate its solution using numerical methods. Euler's method is the simplest of these, using linear approximation to step along the solution curve.
The method begins with an initial condition \((x_0, y_0)\) and proceeds in steps. Let's define a small, constant step size, \(h\). The \(x\)-coordinate of each subsequent point is found by adding this step size: \(x_{n+1} = x_n + h\).
The core of the method is to approximate the derivative \(\dfrac{dy}{dx}\) using the gradient of the line segment connecting two consecutive points, \((x_n, y_n)\) and \((x_{n+1}, y_{n+1})\):$$ \dfrac{dy}{dx} \text{ at } (x_n, y_n) \approx \dfrac{y_{n+1} - y_n}{x_{n+1} - x_n} = \dfrac{y_{n+1} - y_n}{h}. $$Since the differential equation gives us the exact value of the derivative, \(\dfrac{dy}{dx} = f(x_n, y_n)\), we can set these equal:$$ \dfrac{y_{n+1} - y_n}{h}\approx f(x_n, y_n). $$Rearranging this formula to find the next \(y\)-value, \(y_{n+1}\), gives the iterative step:$$ y_{n+1} \approx y_n + h \cdot f(x_n, y_n). $$The collection of line segments created by this iterative procedure forms a polygonal approximation to the true solution curve.