01 / Before finding the whole function
Leave a slope at every position first.
Even before you have a formula, the equation tells you which way the curve must head at every position. Fill the plane with those directions, and you have a slope field.
The last two pages found exact solutions of y′=y and then drew the curves. Now go the other way. Suppose you don’t know a formula for the solution yet. Can the equation alone show roughly how it moves?
Write a first-order equation as y′=f(x,y). Pick a point (x,y) on the plane and put its coordinates into f. You get the slope any solution must have if it passes through that point. Draw a short line with that slope there, then do the same at many other points. The result is a slope field, also called a direction field.
| Point on the plane | Put into the rule | Read left to right |
|---|---|---|
| (0, 1) | f(0,1)=1 | Tilts up |
| (1, 1) | f(1,1)=1 | Same as the point above |
| (0, 0) | f(0,0)=0 | Flat |
| (0, −2) | f(0,−2)=−2 | Tilts down |
So for y′=y, every dash in the same horizontal row points the same way. The higher you go in the upper half of the plane, the larger the positive slope. The lower you go in the lower half, the larger the absolute value of the negative slope. These dashes describe a local constraint. They haven’t chosen a starting point for you yet.
Slope is Δy/Δx in coordinates. If one unit on the x-axis and one unit on the y-axis have different lengths on screen, a slope of 1 won’t look like exactly 45°. This page converts directions using the scales of both axes. Every dash has the same length on screen, so its length says nothing about the rate of change.
02 / Picking up the initial condition
Choose a start, and let the curve follow the rule.
Following the directions doesn’t mean sticking to one short straight piece. Take a step forward, the height changes, and so does the direction you should go.
The initial point you chose in “Solution Families and Initial Conditions” can come with you to this page. Start from (0,1), and you already know the exact solution is eˣ. Its tangent at every position must match the dash there. Start from (0,−1), and it becomes −eˣ. Start from (0,0), and you get the zero solution.
“Matching the direction” does not mean the whole curve clings to one short straight segment. As the curve moves on and reaches a new height, it meets a new slope. For a positive solution of y′=y, a greater height means a steeper slope, so the path gradually bends upward.
First uncheck “Show the exact solution” and look only at the gray directions. Guess how the curve will run to the right of the initial point, then turn the green curve back on to check. The picture helps you make a guess, but a finite number of dashes or pixels can’t prove that a function is a solution. The substitution and derivations from the last two pages are still needed.
Can two solution curves never cross?
For y′=y, a single point fixes C uniquely, so two different solutions never cross. Whether a slope field in general has this property depends on whether its initial value problems have unique solutions. In the example y′=3y2/3 from “Solution Families and Initial Conditions,” the zero solution and x³ pass through the same initial point. One picture is not enough to claim that solutions never meet for every equation.
03 / Starting from a local straight-line approximation
Turn “roughly that way” into a calculation.
Euler’s method writes “head roughly that way” as arithmetic: measure the slope, take a small step, measure again.
Let xₙ be the position after step n, and yₙ the current approximate height. The subscript n counts steps, starting from 0. Choose a positive step size h: how far each step moves to the right along the x-axis.
Find the slope at the current approximate point.
mₙ = f(xₙ, yₙ)Treat that slope as fixed for the whole step. Estimate the change in height with a straight line.
Δy ≈ h mₙAdd that change to reach the next approximate point.
xₙ₊₁ = xₙ + h
yₙ₊₁ = yₙ + h f(xₙ, yₙ)Find the slope again at the new point. Update it at every step; you can’t keep walking along the very first slope.
This is the forward Euler method, called Euler’s method on this page. The equals sign in the update defines the value yₙ₊₁ that the algorithm computes. It does not claim that yₙ₊₁ equals the exact solution at the same position.
Why is it only an approximation? The real curve usually changes its slope within a single small step, but Euler’s method walks the whole step in a straight line. The next step then starts from the approximate point, so errors can also build up as the calculation goes on.
Keep yₙ and y(xₙ) apart. The first is the number the algorithm has built up; the second is the exact solution. Euler’s method computes f(xₙ,yₙ). It never quietly swaps in the exact height as the start of the next step.
04 / y′=y, y(0)=1
From 1 to 2.25, without skipping a step.
The numbers only start to make sense when you work them out one step at a time. Here every step is written out.
This section fixes the initial point at (0,1), the step size at h=0.5 and the endpoint at x=1. If the plot brought in a different initial point, its numbers follow that point. The worked example below stays fixed so you can check it line by line.
The start. x₀=0 and y₀=1, so the current slope is f(0,1)=1.
Step one, from x=0 to x=0.5.
y₁ = 1 + 0.5 × 1 = 1.5You reach the approximate point (0.5,1.5). Find the slope again: it is now 1.5.
Step two, from x=0.5 to x=1.
y₂ = 1.5 + 0.5 × 1.5 = 2.25So Euler’s approximation at the endpoint is 2.25.
Compare with the exact value at the same position.
y(1) = e ≈ 2.718282
|y₂ − y(1)| ≈ 0.468282
If you took both steps along slope 1, you would get 2. That would be extending the initial tangent line, not Euler’s method, which updates the slope at every step.
Shrink the step, and compare at the same endpoint
| Step size h | Steps | Euler value at the end | Absolute error |
|---|---|---|---|
| 0.5 | 2 | 2.250000 | 0.468282 |
| 0.25 | 4 | 2.441406 | 0.276876 |
| 0.125 | 8 | 2.565785 | 0.152497 |
In this example, a smaller step brings the result closer to e, but any finite step still leaves an error. When you compare, always keep the initial condition, the equation and the endpoint the same. Numbers taken at different positions can’t tell you which step size is more accurate.
In this example, you can check every step count directly
Because f(x,y)=y, every step is yₙ₊₁=(1+h)yₙ. Starting from y₀=1 and multiplying n times gives yₙ=(1+h)ⁿ. So two steps give 1.5², four steps give 1.25⁴, and eight steps give 1.125⁸. This is an exact formula for the Euler sequence; the exact solution of the differential equation is still eˣ.
If you halve the step, is the error always halved?
Not exactly half every time. On a fixed, finite interval, when the solution and f are smooth enough and the spread of errors stays under control, the global error of forward Euler is first order, usually written O(h): for small enough h, the error is bounded by some constant times h. That is a statement about size under conditions. It does not promise that the error shrinks steadily for every equation and every step size, and it does not remove floating-point error.
05 / y′=x−y
Flat dashes don’t always join up into a solution.
Connect every place where the slope is 0, and the line you get is usually not a solution. Passing through those places doesn’t mean the line follows the rule itself.
Switch the plot to y′=x−y. Now the slope changes as you move along x at the same height. For example, the slope is −1 at (0,1), 0 at (1,1), and 1 at (2,1). This time, the height alone doesn’t tell you the slope.
At every point on y=x, the right side x−y is 0, so the slope field has flat dashes there. But put the function y=x into the equation: the left side is y′=1 and the right side is x−x=0. They are not equal. The slanted line that connects the zero-slope places is not a solution itself.
This line y=x is the zero-slope isocline: it marks the places that share the same slope. It is a different object from a solution curve. A flat dash at one point doesn’t mean the whole solution is a flat line either.
Where does the green exact solution come from after you switch?
This is an example of a first-order linear equation, which comes later in the series. For now, here is a formula you can check directly:
Differentiating gives y′=1−Ae−(x−x₀). Working out the right side, x−y, gives the same expression, so the equation is satisfied. Substituting x=x₀ gives x₀−1+A=y₀, so the initial condition is met too.
Starting from (0,1) in particular, A=2 and the solution is x−1+2e⁻ˣ. So the exact value at x=1 is 2/e≈0.735759, while Euler’s method with h=0.5 ends at 0.5. The full method for solving it comes in the later page on first-order linear equations.
06 / A way of reading plots to take with you
Keep the rule, the curve and the approximation apart.
The slope field is the rule, the initial point is a choice, and Euler’s method is an approximation. Keep the three apart, and you won’t mistake the gold path for the answer.
The equation determines the slope field. The initial condition chooses which solution to follow. Euler’s method approximates that solution with finite steps. Keeping these three apart stops you from taking the gold path on screen for a new exact solution.
The plot only computes one unit of x to the right, and offers only three step sizes. That is a choice about what to show. It does not mean the equation can only be solved to the right, only for one unit, or that every numerical method uses the same steps. The edge of the window, an approximation going wrong, and an exact solution ceasing to exist are separate things to judge.
1. For y′=y, starting at (0,1) with h=0.25, what is the height after the first step?
See the full reasoning
The initial slope is 1, so the new height is 1+0.25×1=1.25, at x=0.25. That is the Euler value. The exact height is e0.25≈1.284025, so the two already differ.
2. For y′=x−y, the dash at (2,2) is flat. Can you conclude that y=2 is a solution?
See the full reasoning
No. The derivative of y=2 is 0 everywhere, but the right side is x−2, which is 0 only at x=2. This is the principle from the first page again: matching at one point doesn’t mean matching across an interval.
3. For y′=y, starting from height 0, will Euler’s method drift away from zero?
See the full reasoning
With this page’s exact starting value of 0, every step is 0+h×0=0, so Euler’s method matches the exact zero solution and the error is 0. A numerical method is an approximation, but that doesn’t mean it must produce a nonzero error for every special solution.
From what a solution is, to how to choose one, to how to look and approximate when you have no formula: these three pages make a first stretch of connected reading. Later pages take apart how equations are built, and develop the ways to solve them along with the conditions each one needs.
Check and go further
Sources and scope
These three pages are about ordinary differential equations with one independent variable, and they use dimensionless math examples. The plot shows only a finite window. A curve leaving the window does not mean the solution ends there.
The pictures help you see; substitution is what checks that an example satisfies the equation. The general theory of existence and uniqueness, and more ways to solve equations exactly, come in later topics.
- Jiří Lebl · Introduction to differential equations: what equations and solutions are, and how to check a solution.
- Jiří Lebl · Slope fields: slope fields and the conditions for solutions of initial value problems.
- Jiří Lebl · Euler’s method: step-by-step approximation and its error.
- MIT OpenCourseWare · First Order Differential Equations: conceptual, geometric and numerical views of first-order equations.