Most differential equations cannot be solved with a formula. Two tools still tell you a lot: a slope field, which shows the shape of every solution at once, and Euler's method, which builds a numerical solution step by step from the same idea as linear approximation.
Why it works
The equation $\frac{dy}{dx} = f(x, y)$ tells you the slope of the solution curve through any point $(x, y)$, before you know the solution. Draw a short segment with that slope at many points and you get a slope field; every solution curve must run along those segments. Euler's method follows one segment for a short step $h$: over a small step the curve is close to its tangent line, so
$$y_{n+1} = y_n + h\cdot f(x_n, y_n),$$ $$x_{n+1} = x_n + h.$$
Then repeat from the new point with its own slope.
Key idea
Slope field: at $(x, y)$ draw a segment of slope $f(x, y)$. Euler's method: $y_{n+1} = y_n + h\,f(x_n, y_n)$, always using the slope at the point you are standing on. Smaller steps give better answers.
Worked example: Euler by hand
Use Euler's method with $h = 0.5$ to estimate $y(1)$ for $y' = x + y$, $y(0) = 1$.
- Step 1: at $(0, 1)$ the slope is $0 + 1 = 1$. $y_1 = 1 + 0.5(1) = 1.5$ at $x = 0.5$.
- Step 2: at $(0.5, 1.5)$ the slope is $0.5 + 1.5 = 2$. $y_2 = 1.5 + 0.5(2) = 2.5$ at $x = 1$.
- So $y(1) \approx 2.5$. The exact solution is $y = 2e^{x} - x - 1$, with $y(1) = 2e - 2 \approx 3.44$: Euler underestimates here because the solution bends upward away from its tangent lines.
Answer: $y(1) \approx 2.5$
| $n$ | $x_n$ | $y_n$ | slope $f(x_n, y_n)$ | $y_{n+1} = y_n + 0.5\cdot\text{slope}$ |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 1.5 |
| 1 | 0.5 | 1.5 | 2 | 2.5 |
Common mistake
Using the slope at the new point instead of the current point. Euler's method only knows where you are now; the slope at $(x_{n+1}, y_{n+1})$ needs $y_{n+1}$, which is what you are trying to compute. Check each row: the slope column must be computed from the $x_n$ and $y_n$ in the same row.
Worked example: Reading a slope field
Where are the slopes of $y' = x - y$ equal to 0, and what happens above and below that line?
- $x - y = 0$ on the line $y = x$, so the segments there are flat.
- Below the line ($y < x$) the slopes are positive; above it they are negative.
- So solutions rise when they are below $y = x$ and fall when they are above it: they all drift toward the line $y = x - 1$, which itself is a solution (check: $y' = 1$ and $x - y = 1$).
Answer: Flat along $y = x$; solutions approach $y = x - 1$.