Skip to main content
Logo image

Section 4.6 Approximations of Solutions

In Chapter 4 we have been interested in describing solutions to differential equations. We have focused mostly on pure-time differential equations, which have the form \(\frac{dy}{dt}= f(t)\text{.}\) Given an initial value, we can find a specific solution if we can find the family of antiderivatives of \(f(t)\text{.}\) Even without an initial value, we can describe how the solution changes over time using the Fundamental Theorem of Calculus. Though we have seen several types of functions for which we can compute an antiderivative, this is generally a difficult task. How might we describe the solution to a pure-time differential equation when we cannot compute an antiderivative? Further, how might we describe the solution to a differential equation which is not pure-time?
In this section we will gain a tool for approximating solutions to differential equations. The main method we will use relies on linear approximation (Section 3.1).

Warm-Up 4.6.1.

Consider the initial value problem
\begin{equation*} \frac{dy}{dt} = \frac12 (y + 1), \ y(0) = 0\text{.} \end{equation*}
Note that this differential equation is not pure-time; in fact, it is autonomous (Section 4.1), since the derivative value depends only on the dependent variable \(y\text{.}\) For example, the differential equation along with the initial value \((0,0)\) tells us that the derivative value of the solution function \(y(t)\) at \(t=0\) is
\begin{equation*} \frac{dy}{dt}\bigg\vert_{(0,0)} = \frac12 (y(0) + 1) = \frac12 (0+1) = \frac12\text{.} \end{equation*}
  1. Above we used the differential equation and initial value to find the slope of the tangent line to the solution \(y(t)\) at \(t=0\text{.}\) Now use the given initial value to find the linear approximation of \(y(t)\) centered at \(t=0\text{.}\)
  2. Sketch the linear approximation of \(y(t)\) centered at \(t=0\) on the axes provided in Figure 4.6.1 on the interval \(0\leq t\leq 2\) and use it to approximate \(y(2)\text{,}\) the value of the solution at \(t=2\text{.}\)
    Blank axes for sketching the linear approximation of y centered at zero.
    Figure 4.6.1. Grid for plotting the tangent line.
  3. Assuming that your approximation for \(y(2)\) is the actual value of \(y(2)\text{,}\) use the differential equation to find the slope of the linear approximation of \(y(t)\) centered at \(t=2\text{.}\) Then, write the equation of the linear approximation of \(y(t)\) centered at \(t=2\text{.}\)
  4. Add a sketch of this linear approximation on the interval \(2\leq t\leq 4\) to your plot Figure 4.6.1; use this new linear approximation to approximate \(y(4)\text{,}\) the value of the solution at \(t=4\text{.}\)
  5. Repeat the same step to find an approximation for \(y(6)\text{.}\)

Subsection 4.6.1 Euler’s Method

Warm-Up 4.6.1 demonstrates an algorithm known as Euler’s 1  Method, which generates a numerical approximation to the solution of an initial value problem. In this algorithm, we will approximate the solution by taking horizontal steps of a fixed size that we denote by \(\Delta t\text{.}\)
Before explaining the algorithm in detail, let’s remember how we compute the slope of a line: the slope is the ratio of the vertical change to the horizontal change, as shown in Figure 4.6.2.
In other words, \(m = \frac{\Delta y}{\Delta t}\text{.}\) Solving for \(\Delta y\text{,}\) we see that the vertical change is the product of the slope and the horizontal change, or
\begin{equation*} \Delta y = m\Delta t\text{.} \end{equation*}
A graph illustrating the slope of a line as delta y divided by delta t.
Figure 4.6.2. The role of slope in Euler’s Method.
Now, suppose that we would like to solve the initial value problem
\begin{equation*} \frac{dy}{dt} = t - y, \ y(0) = 1\text{.} \end{equation*}
There is an algorithm by which we can find an algebraic formula for the solution to this initial value problem, and we can check that this solution is \(y(t) = t -1 + 2e^{-t}\text{.}\) But we are instead interested in generating an approximate solution by creating a sequence of points \((t_i, y_i)\text{,}\) where \(y_i\approx y(t_i)\text{.}\) For this first example, we choose \(\Delta t = 0.2\text{.}\)
Since we know that \(y(0) = 1\text{,}\) we will take the initial point to be \((t_0,y_0) = (0,1)\) and move horizontally by \(\Delta t = 0.2\) to the point \((t_1,y_1)\text{.}\) Thus, \(t_1=t_0+\Delta t = 0.2\text{.}\) Now, the differential equation tells us that the slope of the tangent line at this point is
\begin{equation*} m=\frac{dy}{dt}\bigg\vert_{(0,1)} = 0-1 = -1\text{,} \end{equation*}
so to move along the tangent line by taking a horizontal step of size \(\Delta t=0.2\text{,}\) we must also move vertically by
\begin{equation*} \Delta y = m\Delta t = -1\cdot 0.2 = -0.2\text{.} \end{equation*}
We then have the approximation \(y(0.2) \approx y_1= y_0 + \Delta y = 1 - 0.2 = 0.8\text{.}\) At this point, we have executed one step of Euler’s method, as seen graphically in Figure 4.6.3.
A graph of a line segment illustrating the first step of Euler’s method.
Figure 4.6.3. One step of Euler’s method.
Now we repeat this process: at \((t_1,y_1) = (0.2,0.8)\text{,}\) the differential equation tells us that the slope is
\begin{equation*} m=\frac{dy}{dt}\bigg\vert_{(0.2,0.8)} = 0.2-0.8 = -0.6\text{.} \end{equation*}
If we move forward horizontally by \(\Delta t\) to \(t_2=t_1+\Delta t = 0.4\text{,}\) we must move vertically by
\begin{equation*} \Delta y = -0.6\cdot0.2 = -0.12\text{.} \end{equation*}
We consequently arrive at \(y_2=y_1+\Delta y = 0.8-0.12 = 0.68\text{,}\) which gives \(y(0.2)\approx 0.68\text{.}\) Now we have completed the second step of Euler’s method, as shown in Figure 4.6.4.
A graph of two line segments illustrating the first two steps of Euler’s method.
Figure 4.6.4. Two steps of Euler’s method.
If we continue in this way, we may generate the points \((t_i, y_i)\) shown in Figure 4.6.5. Because we can find a formula for the actual solution \(y(t)\) to this differential equation, we can graph \(y(t)\) and compare it to the points generated by Euler’s method, as shown in Figure 4.6.6.
A graph of six line segments illustrating the first six steps of Euler’s method.
Figure 4.6.5. The points and piecewise linear approximate solution generated by Euler’s method.
Line segments from Euler’s method graphed along with the exact solution that Euler’s method is estimating.
Figure 4.6.6. The approximate solution compared to the exact solution (shown in blue).
Because we need to generate a large number of points \((t_i,y_i)\text{,}\) it is convenient to organize the implementation of Euler’s method in a table as shown. We begin with the given initial data.
\(t_i\) \(y_i\) \(dy/dt\) \(\Delta y\)
\(0.0000\) \(1.0000\)
From here, we compute the slope of the tangent line \(m=dy/dt\) using the formula for \(dy/dt\) from the differential equation, and then we find \(\Delta y\text{,}\) the change in \(y\text{,}\) using the rule \(\Delta y = m\Delta t\text{.}\)
\(t_i\) \(y_i\) \(dy/dt\) \(\Delta y\)
\(0.0000\) \(1.0000\) \(-1.0000\) \(-0.2000\)
Next, we increase \(t_i\) by \(\Delta t\) and \(y_i\) by \(\Delta y\) to get
\(t_i\) \(y_i\) \(dy/dt\) \(\Delta y\)
\(0.0000\) \(1.0000\) \(-1.0000\) \(-0.2000\)
\(0.2000\) \(0.8000\)
We continue the process for however many steps we decide, eventually generating a table like Table 4.6.7.
Table 4.6.7. Euler’s method for 6 steps with \(\Delta t = 0.2\text{.}\)
\(t_i\) \(y_i\) \(dy/dt\) \(\Delta y\)
\(0.0000\) \(1.0000\) \(-1.0000\) \(-0.2000\)
\(0.2000\) \(0.8000\) \(-0.6000\) \(-0.1200\)
\(0.4000\) \(0.6800\) \(-0.2800\) \(-0.0560\)
\(0.6000\) \(0.6240\) \(-0.0240\) \(-0.0048\)
\(0.8000\) \(0.6192\) \(0.1808\) \(0.0362\)
\(1.0000\) \(0.6554\) \(0.3446\) \(0.0689\)
\(1.2000\) \(0.7243\) \(0.4757\) \(0.0951\)

Activity 4.6.2.

Consider the initial value problem
\begin{equation*} \frac{dy}{dt} = 2t-1, \ y(0) = 0 \end{equation*}
  1. Use Euler’s method with \(\Delta t = 0.2\) to approximate the solution at \(t_i = 0.2, 0.4, 0.6, 0.8\text{,}\) and \(1.0\text{.}\) Record your work in the following table, and sketch the points \((t_i, y_i)\) on the axes provided.
    \(t_i\) \(y_i\) \(dy/dt\) \(\Delta y\)
    \(0.0000\) \(0.0000\)
    \(0.2000\)
    \(0.4000\)
    \(0.6000\)
    \(0.8000\)
    \(1.0000\)
    Table 4.6.8. Table for recording results of Euler’s method.
    Blank axes for plotting approximate solution values obtained using Euler’s method.
    Figure 4.6.9. Grid for plotting points generated by Euler’s method.
  2. Find the exact solution to the original initial value problem and use this function to find the error in your approximation at each one of the points \(t_i\text{.}\)
  3. Explain why the value \(y_5\) generated by Euler’s method for this initial value problem produces the same value as a left Riemann sum for the definite integral \(\int_0^1 (2t-1)~dt\text{.}\)
  4. How would your computations differ if the initial value was \(y(0) = 1\text{?}\) What does this mean about different solutions to this differential equation?

Activity 4.6.3.

Consider the differential equation \(\frac{dy}{dt} = 6y-y^2\text{.}\)
  1. Using the initial value \(y(0) = 1\text{,}\) use Euler’s method with \(\Delta t = 0.2\) to approximate the solution at \(t_i = 0.2, 0.4, 0.6, 0.8\text{,}\) and \(1.0\text{.}\) Record your results in Table 4.6.10 and sketch the corresponding points \((t_i, y_i)\) on the axes provided in Figure 4.6.11.
    \(t_i\) \(y_i\) \(dy/dt\) \(\Delta y\)
    \(0.0\) \(1.0000\)
    \(0.2\)
    \(0.4\)
    \(0.6\)
    \(0.8\)
    \(1.0\)
    Table 4.6.10. Table for recording results of Euler’s method with \(\Delta t = 0.2\text{.}\)
    Blank axes for plotting approximate solution values obtained using Euler’s method.
    Figure 4.6.11. Axes for plotting the results of Euler’s method.
  2. What happens if we apply Euler’s method to approximate the solution with \(y(0) = 6\text{?}\) What would you call the point \((0,6)\) in this system, based on a similar concept in discrete-time dynamical systems?

Subsection 4.6.2 The error in Euler’s method

Since we are approximating the solutions to an initial value problem using local linearizations, we should expect that the error in the approximation will be smaller when the step size is smaller. Consider the initial value problem
\begin{equation*} \frac{dy}{dt} = y, \ y(0) = 1\text{,} \end{equation*}
whose specific solution is possible find.
The question posed by this initial value problem is “what function do we know that is the same as its own derivative and has value 1 when \(t=0\text{?}\)” It is not hard to see that the solution is \(y(t) = e^t\text{.}\) We now apply Euler’s method to approximate \(y(1) = e\) using several values of \(\Delta t\text{.}\) These approximations will be denoted by \(E_{\Delta t}\text{,}\) and we’ll use them to see how accurate Euler’s Method is.
To begin, we apply Euler’s method with a step size of \(\Delta t = 0.2\text{.}\) In that case, we find that \(y(1) \approx E_{0.2} = 2.4883\text{.}\) The error is therefore
\begin{equation*} y(1) - E_{0.2} = e - 2.4883 \approx 0.2300\text{.} \end{equation*}
Repeatedly halving \(\Delta t\) gives the following results, expressed in both tabular and graphical form.
\(\Delta t\) \(E_{\Delta t}\) Error
\(0.200\) \(2.4883\) \(0.2300\)
\(0.100\) \(2.5937\) \(0.1245\)
\(0.050\) \(2.6533\) \(0.0650\)
\(0.025\) \(2.6851\) \(0.0332\)
Table 4.6.12. Errors that correspond to different \(\Delta t\) values.
A plot of the error using Euler’s method as a function of the step size delta t.
Figure 4.6.13. A plot of the error as a function of \(\Delta t\text{.}\)
Notice, both numerically and graphically, that the error is roughly halved when \(\Delta t\) is halved. This example illustrates the following general principle.
If Euler’s method is used to approximate the solution to an initial value problem at a point \(\overline{t}\text{,}\) then the error is proportional to \(\Delta t\text{.}\) That is,
\begin{equation*} y(\overline{t}) - E_{\Delta t} \approx K\Delta t \end{equation*}
for some constant of proportionality \(K\text{.}\)

Subsection 4.6.3 Summary

  • Question 4.6.14.

    What is Euler’s method and how can we use it to approximate the solution to an initial value problem?
    Answer.
    Euler’s method is an algorithm for approximating the solution to an initial value problem by following the tangent lines while we take horizontal steps across the \(t\)-axis.
  • Question 4.6.15.

    How accurate is Euler’s method?
    Answer.
    If we wish to approximate \(y(\overline{t})\) for some fixed \(\overline{t}\) by taking horizontal steps of size \(\Delta t\text{,}\) then the error in our approximation is proportional to \(\Delta t\text{.}\)

Exercises 4.6.4 Exercises

1.

Newton’s Law of Cooling says that the rate at which an object, such as a cup of coffee, cools is proportional to the difference in the object’s temperature and room temperature. If \(T(t)\) is the object’s temperature and \(T_r\) is room temperature, this law is expressed as
\begin{equation*} \frac{dT}{dt} = -k(T-T_r)\text{,} \end{equation*}
where \(k\) is a constant of proportionality. In this problem, temperature is measured in degrees Fahrenheit and time in minutes.
  1. Two calculus students, Alice and Bob, enter a 70\(^\circ\) classroom at the same time. Each has a cup of coffee that is 100\(^\circ\text{.}\) The differential equation for Alice has a constant of proportionality \(k=0.5\text{,}\) while the constant of proportionality for Bob is \(k=0.1\text{.}\) What is the initial rate of change for Alice’s coffee? What is the initial rate of change for Bob’s coffee?
  2. What feature of Alice’s and Bob’s cups of coffee could explain this difference?
  3. As the heating unit turns on and off in the room, the temperature in the room is
    \begin{equation*} T_r=70+10\sin t\text{.} \end{equation*}
    Implement Euler’s method with a step size of \(\Delta t = 0.1\) to approximate the temperature of Alice’s coffee over the time interval \(0\leq t\leq 50\text{.}\) This will most easily be performed using a spreadsheet such as Excel. Graph the temperature of her coffee and room temperature over this interval.
  4. In the same way, implement Euler’s method to approximate the temperature of Bob’s coffee over the same time interval. Graph the temperature of his coffee and room temperature over the interval.
  5. Explain the similarities and differences that you see in the behavior of Alice’s and Bob’s cups of coffee.

2.

Euler’s Method is a way to use linear approximations in order to approximate solution values of an initial value problem. In this exercise, we’ll see how this concept can be applied in a similar way using quadratic approximations.
  1. In Euler’s Method using a step size of \(\Delta t\text{,}\) we use the slope \(m\) of the linear approximation at a given point to compute the corresponding increase in \(y\) as \(\Delta y =m \Delta t\text{.}\) If we used a quadratic approximation (where the second derivative value was \(m'\)) instead of a linear approximation, explain why the corresponding increase in \(y\) would be \(\Delta y = m\Delta t + \frac{m'}{2} (\Delta t)^2\text{.}\) HINT: Review quadratic approximations in Section 3.1.
  2. Given the differential equation \(\frac{dy}{dt} = t-y\text{,}\) what is an expression for the second derivative of \(y\) with respect to \(t\text{,}\) \(\frac{d^2y}{dt^2}\text{?}\)
  3. Consider the initial value problem \(\frac{dy}{dt} = t-y\text{,}\) \(y(0)=1\text{,}\) from the beginning of this section. Approximate \(y(1)\) using quadratic approximations and \(\Delta t = 0.2\text{.}\) Compare your approximations to that of Euler’s Method in Table 4.6.7. Given that the exact solution is \(y(t)=t-1+2e^{-t}\text{,}\) which method produces a better approximation? Why do think this is?
“Euler” is pronounced “Oy-ler.” Among other things, Euler is the mathematician credited with the famous number \(e\text{.}\)