# Euler’s Method for Approximating Solutions to Differential Equations Examples 1

Recall from the Euler’s Method for Approximating Solutions to Differential Equations page that if we have a first order differential equation $\frac{dy}{dt} = f(t, y)$ with the initial condition $y(t_0) = y_0$. If it is difficult to solve this first order differential equation, then sometimes we can use Euler’s Method to find approximations $y_n$ of $\phi(t_n)$ with equations of lines that pass through the points $(t_n, y_n)$ with slopes $f(t_n, y_n)$ given by:

(1)

And the values of $y_{n+1}$ can be computed with the formula:

(2)

Furthermore, if the difference between consecutive values $v_j$ and $v_{j+1}$ is $h$ (the step size from one $v_j$ to the next is $h$) then the approximations $y_{n+1}$ of $\phi(t_{n+1})$ can be obtained by the formula:

(3)

We will now look at some more examples of using Euler’s Method to approximate the solutions to differential equations.

## Example 1

**Consider the first order differential equation $\frac{dy}{dt} = t^2 + y^2$ 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, 0.5$ with the step size $h=0.1$.**

Let $f(t, y) = \frac{dy}{dt} = t^2 + y^2$.

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

(4)

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:

(5)

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

(6)

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:

(7)

We thus obtain the point $(0.2, 1.222)$ as an approximation of $\phi(0.2)$. The slope of the tangent line that passes through this point is $f(0.2, 1.222) = 1.533284$. Therefore the equation of this tangent line is:

(8)

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:

(9)

We thus obtain the point $(0.3, 1.3753284)$ as an approximation of $\phi(0.3)$. The slope of the tangent line that passes through this point is $f(0.3, 1.3753284) = 1.9815282$. Therefore the equation of this tangent line is:

(10)

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:

(11)

We thus obtain the point $(0.4, 1.5734812)$ as an approximation of $\phi(0.4)$. The slope of the tangent line that passes through this point is $f(0.4, 1.5734812) = 2.6358431$. Therefore the equation of this tangent line is:

(12)

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

(13)

We thus obtain the point $(0.5, 1.8370655)$ as an approximation of $\phi(0.5)$.

The graph above shows the direction field of the differential equation $\frac{dy}{dt} = t^2 + y^2$ alongside the piecewise linear approximation curve (in red) creating by joining the line segments from the points $(t_0, y_0)$, $(t_1, y_1)$, …, $(t_5, y_5)$ obtained from Euler’s Method which approximates the actual solution $y = \phi(t)$ to our initial value problem.