Euler's Method for Approximating Solutions to Differential Equations

Euler's Method for Approximating Solutions to Differential Equations

We are now going to look at a numerical method for approximating a solution of a first order differential equation initial value problem known as Euler's Method or The Tangent Line Method.

Suppose that $\frac{dy}{dt} = f(t, y)$ is a first order differential equation with the initial condition that $y(t_0) = y_0$, and suppose that both $f$ and $\frac{\partial f}{\partial y}$ are continuous on an interval containing $t_0$. Then we know that a solution exists and that this solution is unique, so call it $y = \phi (t)$.

Now consider the line that passes through the point $(t_0, y_0)$ (which is given by the initial condition of the initial value problem) and has the slope $f(t_0, y_0)$. Then this line is tangent to the unique solution $y = \phi (t)$ at $(t_0, y_0)$ (since the slope of the tangent line at $(t_0, y_0)$ on $y = \phi (t)$ is $f(t_0, y_0)$). Furthermore, the equation of this line in point-slope form is given by the following formula:

(1)
\begin{align} \quad y - y_0 = f(t_0, y_0)(t - t_0) \\ \quad y = y_0 + f(t_0, y_0)(t - t_0) \end{align}

Note that this tangent line is a pretty accurate approximation of the solution $y = \phi (t)$ for values of $t$ that are very close to $t_0$. Now suppose that $t_1$ is close to $t_0$, and that we want to approximate the value of $\phi (t_1)$ using the line approximation $y = y_0 + f(t_0, y_0)(t - t_0)$. Then by plugging in $t = t_1$ to the equation given above, we will obtain an approximation, call it $y_1$, of $\phi (t_1)$.

(2)
\begin{align} \quad y_1 = y_0 + f(t_0, y_0)(t_1 - t_0) \end{align}

Since $y_1$ is an approximation of $\phi(t_1)$, we have that $y_1 \approx \phi(t_1)$. We will now consider the line that passes through the point $(t_1, y_1)$ and has the slope $f(t_1, y_1)$. In point-slope form, the equation of this line is given by the following formula:

(3)
\begin{align} \quad y = y_1 + f(t_1, y_1)(t - t_1) \end{align}

Once again, if $t_2$ is a value that is close to $t_1$, then we can obtain an approximation $y_2 = y(t_2)$ of the true value $\phi (t_2)$ using this new line, $y = y_1 + f(t_1, y_1)(t - t_1)$, by plugging in $t = t_2$:

(4)
\begin{align} \quad y_2 = y_1 + f(t_1, y_1)(t_2 - t_1) \end{align}

If we repeat this process, then the equation for the tangent line that passes through the the point $(t_n, y_n)$ for $n = 0, 1, 2, ...$ is given by:

(5)
\begin{align} \quad y = y_n + f(t_n, y_n)(t - t_n) \end{align}

Furthermore, the approximation $y_{n+1}$ of the value $\phi(t_{n+1})$ is obtained by plugging $t = t_{n+1}$ into the equation of the tangent line that passes through the point $(t_n, y_n)$ whose formula is:

(6)
\begin{align} \quad y_{n+1} = y_n + f(t_n, y_n)(t_{n+1} - t_n) \end{align}

Now suppose that we want to approximate the solution $y = \phi (t)$ of our differential equation $\frac{dy}{dt} = f(t, y)$ using $t_0, t_1, t_2, ...$. If we connect the line segments between the points $(t_0, y_0)$, $(t_1, y_1)$, …, $(t_n, y_n)$, … then we obtained a piecewise linear function which approximates $y = \phi (t)$.

Of course, for practical reasons, it's nice if the difference between consecutive values $t_j$ and $t_{j+1}$ are equal, that is the step size between $t_j$ and $t_{j+1}$ is say $h > 0$ for $j = 0, 1, 2, ...$. The formula for the approximation of $y_{n+1}$ of $\phi(t_{n+1})$ can thus be rewritten as:

(7)
\begin{align} \quad y_{n+1} = y_n + f(t_n, y_n)h \end{align}

Of course, the accuracy of our piecewise approximation of the unique solution $y = \phi (t)$ varies depending on how large are steps are, how large our interval we're approximating is, and the behaviour of the solution itself. Let's look at an example of using Euler's Method in order to approximate the solution to a first order differential equation.

Example 1

Consider the first order differential equation $\frac{dy}{dt} = 0.5 - t + 2y$ with the initial condition $y(0) = 1$. Approximate the values of the unique solution $y = \phi (t)$ for this initial value problem using Euler's Method at the values $t = 0.1, 0.2, 0.3, 0.4$ with the step size $h = 0.1$.

The tangent line that passes through the point $(0, 1)$ (which is given by the initial condition as $y(0) = 1$) has the slope $f(0, 1) = 0.5 - 0 + 2 = 2.5$. Therefore, the equation of this tangent line is:

(8)
\begin{align} \quad y = 1 + 2.5(t - 0) \end{align}

We will now use this line in order to approximate the value of $\phi(0.1)$. Plugging in $0.1$ to the tangent line above and we get that:

(9)
\begin{align} \quad y_1 = 1 + 2.5(0.1 - 0) \\ \quad y_1 = 1.25 \end{align}

We thus obtain the point $(0.1, 1.25)$ as an approximation of $\phi(0.1)$. The slope of the tangent line that passes through this point is $f(0.1, 1.25) = 0.5 - 0.1 + 2(1.25) = 2.9$. Therefore the equation of this tangent line is:

(10)
\begin{align} \quad y = 1.25 + 2.9(t - 0.1) \end{align}

We will now use this line in order to approximate the value of $\phi(0.2)$. Plugging in $0.2$ to the tangent line above and we get that:

(11)
\begin{align} \quad y_2 = 1.25 + 2.9(0.2 - 0.1) \\ \quad y_2 = 1.25 + 0.29 \\ \quad y_2 = 1.54 \end{align}

We thus obtain the point $(0.2, 1.54)$ as an approximation of $\phi (0.2)$. The slope of the tangent line that passes through this point is $f(0.2, 1.54) = 0.5 - 0.2 + 2(1.54) = 3.38$. Therefore the equation of this tangent line is:

(12)
\begin{align} \quad y = 1.54 + 3.38(t - 0.2) \end{align}

We will now use this line in order to approximate the value of $\phi(0.3)$. Plugging in $0.3$ to the tangent line above and we get that:

(13)
\begin{align} \quad y_3 = 1.54 + 3.38(0.3 - 0.2) \\ \quad y_3 = 1.54 + 0.338 \\ \quad y_3 = 1.878 \end{align}

We thus obtain the point $(0.3, 1.878)$ as an approximation of $\phi(0.3)$. The slope of the tangent line that passes through this point is $f(0.3, 1.878) = 0.5 - 0.3 + 2(1.878) = 4.056$. Therefore the equation of this tangent line is:

(14)
\begin{align} \quad y = 1.878 + 4.056(t - 0.3) \end{align}

We will now use this line in order to approximate the value of $\phi(0.4)$. Plugging in $0.4$ to the tangent line above and we get that:

(15)
\begin{align} \quad y_4 = 1.878 + 4.056(0.4 - 0.3) \\ \quad y_4 = 1.878 + 0.4056 \\ \quad y_4 = 2.2836 \end{align}

We thus obtain the point $(0.4, 2.2836)$

The following curve in blue represents the actual solution to this initial value problem, $y = 0.5t + e^{2t}$. The curve in green is the piecewise curve created by joining the tangent line segments to create a function that approximates the actual solution.

Screen%20Shot%202015-03-09%20at%205.41.28%20PM%281%29.png
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License