Skip to main content
Logo image

Section Eulerโ€™s Method: The Full Process

In the previous section, we zoomed in on the single โ€œstepโ€ at the heart of Eulerโ€™s method: move forward by a small amount \(h\) in \(t\text{,}\) and adjust \(y\) by \(h\) times the slope. Now weโ€™ll zoom out. By repeating that step again and again, we can march across an interval, building an approximate solution point by point.

Subsection A Concrete Step Through Eulerโ€™s Method

Before writing any formulas, it helps to see what Eulerโ€™s Method feels like. Think of Eulerโ€™s method like crossing a landscape with only a compass. You know where you start. At each step, you check your direction (the slope from the differential equation), take a small stride that way, then check again. That back-and-forth of โ€œstep, check, adjustโ€ is the rhythm of the method.

The Goal.

Suppose we have the initial value problem
\begin{equation} y'(t) = 6t + y(t), \quad y(0) = -2, \quad t \text{ in } [0, 1.5]\text{.}\tag{27} \end{equation}
Letโ€™s approximate the solution at the equally-spaced \(t\)-values: \(0, 0.5, 1, 1.5\text{.}\) This tells us that our goal is to approximate the \(y\)-values at the following points:
\begin{equation*} \text{Approximation} = \big\{\ (\ 0\ ,\ ?\ ),\ (\ 0.5\ ,\ ?\ ),\ (\ 1\ ,\ ?\ ),\ (\ 1.5\ ,\ ?\ )\ \big\}\text{.} \end{equation*}
Luckily, the first \(y\) value is just the initial condition, \(y(0) = -2\text{,}\) so we add it to the list:
\begin{equation*} \text{Approximation} = \left\{\ (0,-2)\ ,\ (0.5,\ ?\ )\ ,\ (1,\ ?\ )\ ,\ (1.5,\ ?\ )\ \right\}\text{.} \end{equation*}
Starting at \((0,-2)\text{,}\) Eulerโ€™s method finds the rest of the points, one-by-one.

Approximating the Next Point.

From \((0, -2)\text{,}\) we need to get to \((0.5,?)\text{.}\) Clearly, the run is \(0.5\text{,}\) but we also need the slope for our movement direction. This comes directly from the differential equation:
\begin{equation*} \text{slope at}\ (0,-2)\ \os{\large t=0}{\quad\longrightarrow\quad} y'(0) = 6(0) + y(0) = -2\text{.} \end{equation*}
Moving from \((0, -2)\) with a slope of \(-2\) and a run of \(0.5\) is given by:
\begin{equation*} (0, -2) \rightarrow (0 + \text{run}, -2 + \text{slope} \times \text{run}) = (0.5, -2 + -2 \cdot 0.5) = (0.5, -3)\text{.} \end{equation*}
Therefore, the next point is \((0.5, -3)\) and our approximation list becomes:
\begin{equation*} \text{Approximation} = \left\{\ (0,-2)\ ,\ (0.5,-3)\ ,\ (1,\ ?\ )\ ,\ (1.5,\ ?\ )\ \right\}\text{.} \end{equation*}

Approximating the Rest of the Points.

To get the third and fourth point, we just repeat what we just did.
At \((0.5, -3)\text{,}\) we get the slope from:
\begin{equation*} \text{slope at}\ (0.5, -3)\ \os{\large t=0.5}{\quad\longrightarrow\quad} y'(0.5) = 6(0.5) + y(0.5) = 3 + (-3) = 0\text{.} \end{equation*}
Using this slope and the same run, we get the third point:
\begin{equation*} (0.5 + \text{run}, -3 + \text{slope} \times \text{run}) = (1, -3 + 0 \cdot 0.5) = (1, -3)\text{.} \end{equation*}
Now we are at \((1, -3)\) and the slope we move this time is:
\begin{equation*} \text{slope at}\ (1, -3)\ \os{\large t=0}{\quad\longrightarrow\quad} y'(1) = 6(1) + y(1) = 6 + (-3) = 3\text{.} \end{equation*}
and our final point is given by:
\begin{equation*} (1 + \text{run}, -3 + \text{slope} \times \text{run}) = (1.5, -3 + 3 \cdot 0.5) = (1.5, -1.5)\text{.} \end{equation*}
With this, our approximation is now complete:
\begin{equation*} \text{Approximation} = \left\{\ (0,-2)\ ,\ (0.5,-3)\ ,\ (1,-3)\ ,\ (1.5,-1.5)\ \right\}\text{.} \end{equation*}
A plot of the process is given in Figureย 122.
\(t\) \(y\) (approx)
\(0\) \(-2.0\)
\(0.5\) \(-3.0\)
\(1\) \(-3.0\)
\(1.5\) \(-1.5\)
Figure 122. (left) Eulerโ€™s method approximation of the solution to (27) with step size \(0.5\text{.}\) (right) Plot of each point in the approximation.

Subsection Eulerโ€™s Method

Now letโ€™s generalize the concrete example. As we do, check the footnotes for the concrete version of each equation and step.
Consider an initial value problem:
โ€‰2โ€‰
\begin{equation*} y'(t) = 6t + y(t), \quad y(0) = -2, \quad t\ \text{in}\ [0, 1.5] \end{equation*}
\begin{equation*} y'(t) = f(t, y), \quad y(t_0) = y_0, \quad t\ \text{in}\ [t_0, t_N]\text{.} \end{equation*}
We divide \([t_0, t_N]\) into equally spaced values (a distance \(h\) apart):
โ€‰3โ€‰
\begin{equation*} \us{\ds t_0}{\us{\uparrow}{0}},\ \us{\ds t_1}{\us{\uparrow}{0.5}},\ \us{\ds t_2}{\us{\uparrow}{1}},\ \us{\ds t_3}{\us{\uparrow}{1.5}}\qquad h = 0.5 \end{equation*}
\begin{equation*} t_0,\ t_1,\ t_2,\ \ldots,\ t_N, \quad\text{where}\quad t_{k+1} = t_k + h \end{equation*}
Using the shorthand \(y_k = y(t_k)\text{,}\) our goal is to approximate the points:
โ€‰4โ€‰
\begin{equation*} \text{Approximation} = \{\ (0,?),\ (0.5,?),\ (1,?),\ (1.5,?)\ \big\} \end{equation*}
\begin{equation*} (t_0, y_0), (t_1, y_1), \ldots, (t_N, y_N). \end{equation*}
The first point, \((t_0, y_0)\text{,}\) is known since it is the initial condition. The remaining points are approximated using the movement rule, where โ€œcurโ€ is \(k\) and โ€œnewโ€ is \(k+1\text{:}\)
\begin{equation*} (t_{k+1},\ y_{k+1}) = (t_k + h,\ y_k + h\cdot\text{slope})\text{.} \end{equation*}
The slope is found from \(f(t_k, y_k)\)
โ€‰5โ€‰
\begin{equation*} 6t + y(t) \end{equation*}
in the differential equation, so the rule becomes:
\begin{equation*} (t_{k+1},\ y_{k+1}) = (t_k + h,\ y_k + h\cdot f(t_k, y_k)). \end{equation*}
Extracting just the \(y\)-coordinate, gives the update rule for Eulerโ€™s method:
\begin{equation*} y_{k+1} = y_k + h\cdot f(t_k, y_k). \end{equation*}
Thatโ€™s it. All of the \(y\) values in the table of Figureย 122 can be found with this formula.

Checkpoint 124. Match Eulerโ€™s Method Parts to their Meaning.

โœ๐Ÿป Method 4. Eulerโ€™s Method.

Given an initial value problem
\begin{equation*} y' = f(t, y), \quad y(t_0) = y_0, \quad t_0 \le t \le t_N \end{equation*}
approximate the solution with the following steps:
Select step size
Choosing a step size \(h\) determines \(t_0,\ t_1,\ t_2,\ ...,\ t_{N}\) where \(t_k = t_0 + kh\) for \(k = 0, 1, 2, ..., N\text{.}\)
Apply Eulerโ€™s update rule
For \(k = 0\) to \(N - 1\text{,}\) compute
\begin{equation*} y_{k+1} = y_k + h \cdot f(t_k, y_k). \end{equation*}
Desipte being based on relatively simple idea, Eulerโ€™s method reveals something profound: with nothing more than a starting point and slope formula, you can approximate a solution that no closed-form equation could describe.

Subsection Examples

๐ŸŒŒ Example 125. Eulerโ€™s Method Example.

Use Eulerโ€™s method to approximate the solution to the differential equation
\begin{equation*} y' = t + y, \quad y(0) = -\frac{7}{8} \end{equation*}
over the interval \([0, 1.5]\) with a step size of \(h = 0.5\text{.}\)
Solution.
Select step size. The step size is \(h = 0.5\text{,}\) so the approximation locations are \(t_0 = 0, t_1 = 0.5, t_2 = 1.0, t_3 = 1.5\text{.}\)
Apply Eulerโ€™s update rule. The initial condition gives the first value in our approximation, \(y_0 = -\frac{7}{8} = -0.875\text{.}\)
Now, we can use the formula
\begin{equation*} y_{k+1} = y_k + h\left(t_k + y_k\right) \end{equation*}
to find \(y_1\text{,}\) \(y_2\) and \(y_3\) as follows:
\begin{align*} \text{G} \amp\text{iven} \\ k \amp = 0 \\ k \amp = 1 \\ k \amp = 2 \end{align*}
\begin{align*} y_0 \amp = -0.875 \\ y_1 \amp = y_0 + h\left(t_0 + y_0\right) = -0.875 + 0.5\left(0 - 0.875\right) \\ y_2 \amp = y_1 + h\left(t_1 + y_1\right) = -1.3125 + 0.5\left(0.5 - 1.3125\right) \\ y_3 \amp = y_2 + h\left(t_2 + y_2\right) = -1.5625 + 0.5\left(1.0 - 1.5625\right) \end{align*}
The simplified calculations are summarized in the following table:
\(k\) \(t_k\) \(y_k\)
\(0\) \(0.0\) \(-0.875\)
\(1\) \(0.5\) \(-0.75\)
\(2\) \(1.0\) \(-0.5\)
\(3\) \(1.5\) \(-0.125\)
Thus, the approximate solution to the initial-value problem is
\begin{equation*} y(0) \approx -\frac{7}{8}, \quad y(0.5) \approx -\frac{3}{4}, \quad y(1.0) \approx -\frac{1}{2}, \quad y(1.5) \approx -\frac{1}{8}. \end{equation*}
We can visualize the approximation by plotting the points \((t_k, y_k)\) and connecting them with line segments. The exact solution to the initial-value problem is given by
\begin{equation*} y(t) = \frac{1}{8}e^t - t - 1. \end{equation*}
The following plot shows the approximation and the exact solution.
The red curve is the exact solution, while the green points are the approximated values at \(t = 0, 0.5, 1.0, 1.5\text{.}\) The blue line segments connect the points in the approximation, showing how Eulerโ€™s method steps through the solution.
The following plot shows the approximation and the exact solution, with a grid for better visualization.
\begin{align*} y'(t_k) \amp = (y(t_k))^2 - t_k \\ \frac{y(t_{k+1}) - y(t_k)}{h} \amp = (y(t_k))^2 - t_k \\ \frac{y_{k+1} - y_k}{h} \amp = (y_k)^2 - t_k \\ y(t_{k+1}) - y(t_k) \amp = h\left((y(t_k))^2 - t_k\right) \\ y(t_{k+1}) \amp = y(t_k) + h\left((y(t_k))^2 - t_k\right) \end{align*}

๐ŸŒŒ Example 126. Analytical and Numerical Solutions.

Consider the differential equation
\begin{equation*} y' + 4ty = 0, \, y(0) = 1\text{.} \end{equation*}
  1. Find the analytical solution to this equation using the method of separation of variables.
  2. Use Eulerโ€™s method with a step size of \(h = 0.1\) to approximate the solution at \(t = 0.5\text{.}\)
  3. Compare the analytical solution with the numerical approximation obtained from Eulerโ€™s method.
Solution.
To solve the differential equation
\begin{equation*} y' + 4ty = 0 \end{equation*}
using the method of separation of variables, we separate the variables as follows:
\begin{equation*} \frac{dy}{y} = -4t \, dt \end{equation*}
Integrating both sides gives:
\begin{equation*} \ln |y| = -2t^2 + C \end{equation*}
Exponentiating both sides results in:
\begin{equation*} y = Ce^{-2t^2} \end{equation*}
Since the initial condition, \(y(0) = 1\text{,}\) gives \(C = 1\text{,}\) the analytical solution is:
\begin{equation*} y(t) = e^{-2t^2} \end{equation*}
Next, we apply Eulerโ€™s method to approximate the solution at \(t = 0.5\text{.}\) The general formula for Eulerโ€™s method is:
\begin{equation*} y_{k+1} = y_k + h f(t_k, y_k) \end{equation*}
where \(f(t, y) = -4ty\) and \(h=0.1\text{.}\) So, we can update the formula as:
\begin{equation*} y_{k+1} = y_k - 0.4 t_k y_k \quad \text{where}\ y_0 = 1. \end{equation*}
For \(k = 0, 1, \ldots, 4\text{,}\) we contruct the following table:
\(k\) \(t_k\) \(y_k\) \(y_{k+1}\)
\(0\) \(0.0\) \(y_0 = {\DLBa 1}\) \(y_1 = {\DLBa 1} + 0.1(-4 \cdot 0.0 \cdot {\DLBa 1}) = {\DLGa 1}\)
\(1\) \(0.1\) \(y_1 = {\DLBa 1}\) \(y_2 = {\DLBa 1} + 0.1(-4 \cdot 0.1 \cdot {\DLBa 1}) = {\DLGa 0.96}\)
\(2\) \(0.2\) \(y_2 = {\DLBa 0.96}\) \(y_3 = {\DLBa 0.96} + 0.1(-4 \cdot 0.2 \cdot {\DLBa 0.96}) = {\DLGa 0.8832}\)
\(3\) \(0.3\) \(y_3 = {\DLBa 0.8832}\) \(y_4 = {\DLBa 0.8832} + 0.1(-4 \cdot 0.3 \cdot {\DLBa 0.8832}) \approx {\DLGa 0.7772}\)
\(4\) \(0.4\) \(y_4 = {\DLBa 0.7772}\) \(y_5 = {\DLBa 0.7772} + 0.1(-4 \cdot 0.4 \cdot {\DLBa 0.7772}) \approx {\DLGa 0.6529}\)
Since \(t_5=0.5\text{,}\) the approximation we are looking for is \(y_5 \approx 0.6529\text{.}\)
Comparing this with the analytical solution at \(t = 0.5\text{,}\) we see the true value is:
\begin{equation*} y(0.5) = e^{-2(0.5)^2} = e^{-0.5} \approx 0.6065. \end{equation*}
Although there is some error between the two values, it is more due to the step size we chose, rather than the method itself. A smaller step size would yield a more accurate approximation. For example, using \(h = 0.001\) gives the approximation: \(y(0.5) \approx 0.6069\text{.}\)

๐ŸŒŒ Example 127. Example: Eulerโ€™s Method with \(h = 0.5\).

Use Eulerโ€™s method to approximate the solution to
\begin{equation*} y'(t) = 6t + y(t), \quad y(0) = -2 \end{equation*}
over \(t = 0\) to \(1.5\) using step size \(h = 0.5\text{.}\)
Solution.
The formula is:
\begin{equation*} y_{k+1} = y_k + 0.5 \cdot (6t_k + y_k) \end{equation*}
\(k\) \(t_k\) \(y_k\) \(y_{k+1} = y_k + 0.5(6t_k + y_k)\)
0 0.0 -2.0 -3.0
1 0.5 -3.0 -3.0
2 1.0 -3.0 -1.5
Thus, the approximate values are:
\begin{equation*} y(0) \approx -2,\quad y(0.5) \approx -3,\quad y(1.0) \approx -3,\quad y(1.5) \approx -1.5 \end{equation*}
Eulerโ€™s method runs on an intuitive idea: use the slope at each point to โ€œpredictโ€ the next point. Itโ€™s simple, but that simplicity is its strength. This method is often the first stepping stone into the world of numerical methods and the same pattern of โ€œpredict, step, repeatโ€ forms the backbone of many other techniques.

๐Ÿ“ค Wrap-Up.

๐Ÿ—๏ธ Key Takeaways...

  • Eulerโ€™s Method turns slope information into a sequence of small steps forward.
  • Each step uses the simple rule: \(y_{k+1} = y_k + h f(t_k, y_k)\text{.}\)
  • Smaller step sizes usually mean better accuracy โ€” but more steps.
  • This method is the foundation for more advanced numerical techniques.
You have attempted of activities on this page.