what is euler’s method? in this post we review this technique for approximating solutions to certain kinds of differential equations and work out a few examples based on what you may see on the ap calculus bc exam.
euler’s method
euler’s method is a step-based method for approximating the solution to an initial value problem of the following type.
the given time t0 is the initial time, and the corresponding y0 is the initial value.
first, you must choose a small step size h (which is almost always given in the problem statement on the ap exam).
then the solution at later times t1, t2, t3, … can be found using the following algorithm.
why does it work?
it’s helpful to understand a little of the theory behind euler’s method. in fact, a good grasp of the theory helps you in other areas of calculus as well.
the key is that the y ‘ always measures the rate of change of the function y. so even if you don’t know what y is, if you can tell how fast it’s changing, then that info can help you to build up the values of y.
now if y changes from y0 to y1 in the time interval from t0 to t1, then we can express this fact using the derivative:
letting the difference in time be h = t1 – t0, then the formula becomes:
the final piece of the puzzle is to use the given information that y ‘ = f(t, y).
that means that you can replace y ‘ by its current value as determined by the function f. if you’re only going from t0 to t1 (a single step), then you get:
on the other hand, why stop at just one step? once you know the value of y1, then you can use that value in a similar way to find out y2. then use y2 to find y3, etc.
when should i use euler’s method?
it’s important to realize that this method does not give exact answers — just good estimates.
unless the directions specify to use euler’s method, do not use it!
instead, if you have to solve a differential equation or initial value problem, then try using methods like separation of variables or in the simplest cases, integration (for a refresher, take a look at: ap calculus exam review: integrals).
examples
ok enough theory. let’s get to the examples!
example 1 — getting the basics down
use euler’s method with h = 0.25 to estimate y(1) if y ‘ = 3y – 1 and y(0) = 1.
solution
the first clue is in the given information. the equation y(0) = 1 means that the initial time is x0 = 0 and initial value is y0 = 1.
note, here we are using x instead of t because sometimes the ap calculus question will be in terms of x and y rather than t and y.
because the step size is 0.25, we use xn = x0 + nh to get:
now remember, the derivative is given you you: y ‘ = 3y – 1. use this to fill out the table.
n | xn | yn | yn' |
---|---|---|---|
0 | 0 | 1 | 3(1) – 1 = 2 |
1 | 0.25 | 1 + 0.25(2) = 1.5 | 3(1.5) – 1 = 3.5 |
2 | 0.5 | 1.5 + 0.25(3.5) = 2.375 | 3(2.375) – 1 = 6.125 |
3 | 0.75 | 2.375 + 0.25(6.125) = 3.906 | 3(3.906) – 1 = 10.718 |
4 | 1 | 3.906 + 0.25(10.718) = 6.586 |
finally, we see that our final answer is: y(1) = y4 = 6.586.
example 2 — slightly more challenging
let y = f(t) be a function satisfying . use euler’s method with step size 0.5 to estimate the value of f(1).
solution
here, the step size is h = 0.5, so there will only be two new time values before landing on the goal time t = 1:
t1 = 0 + 1(0.5) = 0.5, and t2 = 0 + 2(0.5) = 1.
also, the given derivative function looks messy. just substitute y for f(t) to make it easier to work with.
so we can rephrase the question with y ‘ = t(2 – y). notice this time the formula involves both variables, t and y in this case.
the initial value is y0 = 8.
n | tn | yn | yn' |
---|---|---|---|
0 | 0 | 8 | 0(2 – 8) = 0 |
1 | 0.5 | 8 + 0.5(0) = 8 | 0.5(2 – 8) = -3 |
2 | 1 | 8 + 0.5(-3) = 6.5 |
the final answer is 6.5.
example 3 — one more for the road
find y(2) by euler’s method with step size 0.2 if y(1) = 4 and y ‘ = y.
solution
this time, with step size h = 0.2, there will be five new t-values to worry about.
n | tn | yn | yn' |
---|---|---|---|
0 | 1 | 4 | 4 |
1 | 1.2 | 4 + 0.2(4) = 4.8 | 4.8 |
2 | 1.4 | 4.8 + 0.2(4.8) = 5.76 | 5.76 |
3 | 1.6 | 5.76 + 0.2(5.76) = 6.912 | 6.912 |
4 | 1.8 | 6.912 + 0.2(6.912) = 8.294 | 8.294 |
5 | 2 | 8.294 + 0.2(8.294) = 9.953 |
the final answer is 9.953.
checking your answer
the preceding problem can be done by exact means as well. this will serve as a good verification that our method actually works.
if y ‘ = dy/dt = y, then by separation of variables, we have: (1/y) dy = dt.
integrating both sides, we get: ln |y| = t + c.
now because the initial value 4 is positive, we can safely ignore the absolute value bars in this problem. the use your algebra skills and the given initial values to solve for y.
you can check on your own that plugging in t = 1 results in a value very close to 4. but what we’re really interested in is t = 2.
1.4715e2 = 10.873.
even though our estimate of 9.953 seems off the mark compared to the actual result of 10.873, it’s actually not bad. in fact, better estimates could have been produced by decreasing the step size. at any rate, our estimate is in the same ballpark, which is all that can be hoped for when using euler’s method.
final thoughts
while euler’s method may at first seem alien, it’s actually easy to use. you just have to plug the right numbers into a certain formula multiple times until you arrive at the desired result.
conceptually, the method is not much different than tracing a path through a slope field. at each point, the direction of your path is determined by the direction of the arrows in the field just as the given function y ‘ = f(t, y) determines the values of y for later times t.
for a guide to understanding this and other topics on the ap calculus bc test, start here: what to expect on the ap calculus bc test.
leave a reply