# Euler's Method for Approximating Solutions to Differential Equations Examples 2

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} = ty^2 - 1$ 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.5, 1, 1.5, 2, 2.5$ with the step size $h=0.5$.**

Let $f(t, y) = ty^2 - 1$.

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

(4)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:

(5)We thus obtain the point $(0.5, 0.5)$. The slope of the tangent line that passes through the point $(0.5, 0.5)$ has slope $f(0.5, 0.5) = 0.125 - 1 = -0.875$. Therefore the equation of the tangent line is:

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

(7)We thus obtain the point $(1, 0.0625)$. The slope of the tangent line that passes through the point $(1, 0.0625)$ has slope $f(1, 0.0625) = (1)(0.0625)^2 - 1 = -0.996...$. Therefore the equation of the tangent line is:

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

(9)We thus obtain the point $(1.5, -0.4355)$. The slope of the tangent line that passes through the point $(1.5, -0.4355)$ has slope $f(1.5, -0.4355) = (1.5)(-0.4355)^2 - 1 = -0.7155$. Therefore the equation of the tangent line is:

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

(11)We thus obtain the point $(2, -0.79325)$. The slope of the tangent line that passes through the point $(2, -0.79325)$ has slope $f(2, -0.79325) = (2)(-0.79325)^2 - 1 = 0.2585...$. Therefore the equation of the tangent line is:

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

(13)We thus obtain the point $(2.5, -0.664)$.

The graph of the approximation on the interval $[0, 2.5]$ by Euler's method is given below. Notice that the general shape is somewhat close, but inaccurate largely due to the relatively large step size of $0.5$.