You are on page 1of 3

Eulers Method: A Numerical Method for Solving Differential Equations

dy
= f ( x, y) and an initial condition
dx
( x0 , y0 ) , we would like to a find function y = f ( x) that satisfies the D.E. and passes through the
Given a differential equation (D.E.) of the form

point ( x0 , y0 ) . In some cases, one can identify the general solution to the D.E. by inspection or
using methods such as separation of variables and integration. But sometimes, either we dont
have the analytic tools in our tool bag to solve the D.E. or an analytic solution is not possible.
Thats when we need a numerical method for solving the D.E. One such method is Eulers
Method. It is based on using tangent lines to piece together an approximation to the particular
solution to the D.E.

dy
. We can write the equation of the
dx
tangent line to the solution curve at the point ( x0 , y0 ) as follows:
Given a starting point ( x0 , y0 ) and a derivative

y y0 = m ( x x0 ) , where m is the slope of the tangent line, given by

dy
.
dx ( x0 , y0 )

If we solve for y, we get

y = y0 + m ( x x0 ) , where m =

dy
.
dx ( x0 , y0 )

(1)

Lets consider using this linear approximation for a small interval on the x-axis, say
some x . Now consider the linear approximation at this new x-value, x1 , x1 = x0 + x . To find
the y-value, y1 , at x1 , we substitute into equation (1), and we have
y1 = y0 +

dy
( x1 x0 )
dx ( x0 , y0 )

Now we have a new point ( x1 , y1 ) . With this point we can write an equation for the line
through the point ( x1 , y1 ) with the slope
y y1 =

dy
at ( x1 , y1 ) , and we get
dx

dy
( x x1 )
dx ( x1 , y1 )

(2)

And we can find our new y-value, by substituting x2 , where x2 = x1 + x , into equation (2).
y2 = y1 +

dy
( x2 x1 ) . Replacing x2 x1 with x , we have
dx ( x1 , y1 )

y2 = y1 +

dy
x
dx ( x1 , y1 )

Continuing this process we can see that


y3 = y2 +

dy
x and
dx ( x2 , y2 )

in general
xn = xn 1 + x
yn = yn 1 +

dy
x
dx ( xn1 , yn1 )

We have a recursive set of equations that will generate a set of points that approximates
the particular solution to the D.E.
From the recursive equation for generating the y-values, you can see that we get our new
y-value by taking the old y value and adding to it the change in y times delta x. Heres an
example of how we can use the method to generate numerical Eulers Method values:
Given the D.E.

dy
x
= , with initial condition (1, 4 ) and a given x = 0.5 , we have
dx
y

x1 = 1 + 0.5
x2 = 1.5 + 0.5 = 2

and

x3 = 2 + 0.5 = 2.5
y1 = 4 +

dy
1
(0.5) = 4 ( 0.5 ) = 4 + 0.125 = 3.875
dx (1,4)
4

y2 = 3.875 +
= 3.875

dy
(0.5)
dx (1.5,3.875)

1.5
( 0.5 ) 3.681
3.875

y3 = 3.681 +
= 3.681

dy
(0.5)
dx ( 2,3.681)

2
( 0.5 ) 3.410
3.681

So if we are interested in an approximation for the solution at x = 3.5 , we would use this
recursive set of equations and iterate 5 times to find y5 .
Of course our solution is more accurate if we use a smaller x .
Please refer to the Excel file euler_intro.xls. We can see that the approximation for the
solution at x = 3.5 is 2.5503 for x = 0.5 and 2.2687 for x = 0.1 . The analytic solution yields a
value of 17 3.52 2.18 at x = 3.5 .

You might also like