← Return to lessonClass materials · 7.5
Approximating Solutions Using Euler's Method
Lecture transcript
0:00Here's a differential equation: d y d x is two y minus two x, and y of zero is one. Try separating the variables, the way we did back in the AB lesson, seven point six. Two y minus two x is a difference, not a product, so the x's and the y's won't split apart. So there's no formula for y at all. And the question is, can we still say what y of one is? We can, approximately.
0:31By the end, you'll stand at a point, read its slope, take a short step, and repeat it as often as you need. Call the solution y equals f of x. Remember what f prime means, from unit two: the limit, as delta x goes to zero, of f of x plus delta x, minus f of x, all over delta x. We can't take that limit without a formula for f. So keep delta x small and drop the limit. Now it's not equal, just close.
1:04Multiply by delta x, and move f of x over. The value one step later is about the value now, plus delta x times the slope now. That's exactly the tangent line. Now mark points along the x-axis: x sub zero, x sub one, x sub two, and so on, each delta x apart. Stand at any one of them, x sub n. One step later is the next point.
1:31So f at the next point is about f at x sub n, plus delta x times the slope at x sub n. That's the rule we'll use over and over. Now our equation. We start at x sub zero, which is zero, where f is one. The equation gives the slope there: two times one, minus two times zero, which is two. Ride the tangent line at x sub zero all the way to x equals one: one, plus one times two, which is three. That's a tangent-line approximation.
2:08Here's the real solution curve, drawn by a computer. It bends up, and the tangent line falls far below it. Look at that gap. So use a smaller step: delta x equals one half puts x sub one at one half, and x sub two at one. Use the rule with n equal to zero. f of x sub one is about f of x sub zero, plus delta x times the slope at x sub zero: the tangent at x sub zero, ridden only as far as x sub one.
2:42That's one, plus one half times two, which is two. Now stand on the new point, one half, two. Ask the equation for a new slope: two times two, minus two times one half, which is three. We stand on our estimate, not on the real curve, because the real curve is the very thing we don't know. Then use the rule again, with n equal to one, and a new line. f of x sub two is about f of x sub one, plus delta x times the new slope.
3:17That's two, plus one half times three, which is three point five. Back at x equals one, the gap is smaller than before. Stand, read the slope, step, and repeat. That's Euler's method. It's pronounced oiler, like the hockey team. Cut the step again.
3:38Delta x equals one fourth gives four steps: x sub zero, one, two, three, and x sub four, which is one. Use the same rule four times. Each new point gets a new slope and a new line. We land at about four point zero three. Compare at x equals one: three, then three point five, then four point zero three. The real value is about five point one nine.
4:06Smaller steps read a fresh slope more often, so they hug the curve, and the gap shrinks. And look which side we miss on. The curve is concave up, so each tangent line sits below it, and every estimate lands low. So Euler under-estimates. Now a curve that bends the other way: d y d x equals two minus x, and f of zero is one. First, take one big tangent step.
4:36The slope at zero is two minus zero, which is two, so f of one is about one, plus one times two, which is three. Now take two steps of one half. So f of one half is about one, plus one half times two, which is two. At one half, the slope is two minus one half, which is three halves. So f of one is about two, plus one half times three halves: two point seven five. This one we can solve: f of x is one, plus two x, minus x squared over two.
5:14So the real f of one is two point five. Both estimates land above it. The curve is concave down, so each tangent line sits above it, and Euler over-estimates. The smaller step still has the smaller gap. So when it's concave up, Euler lands under. When it's concave down, it lands over, as long as the curve keeps bending the same way along the steps.
5:43On paper, find the step size first: the end, minus the start, over the number of steps. For example, from zero to one in two steps, it's one minus zero, over two: one half. Going backward, from two to one in two steps, it's one minus two, over two: negative one half. Going backward, the step is negative. Then draw a table, one row per step, one column for each: x, y, the slope at that point, and the change in y, which is the step size times the slope. Our first row: x is zero, y is one, the slope is two, so y changes by one half times two, which is one.
6:31The next y is one plus one, or two. In the second row, x is one half, y is two, and the slope is three, so the change is one half times three, or one point five. The next y is two plus one point five, which is three point five. In the last row, x is one and y is three point five. We've reached x equals one, so stop. There's no slope and no more steps.
7:00The slope always comes from the x and y in the same row: where you stand, never the next x. On the exam, a table or one line per step both earn the points. Show each step's slope. If you use a table, label the columns: the labels still earn the first point if a number goes wrong. Example one, free response style. y equals f of x solves d y d x equals one plus x y, with f of one equal to one.
7:33Use Euler's method, starting at x equals one, with two steps of equal size, to approximate f of two. The plan: step size first, then one row per step. From one to two in two steps: two minus one, over two, is one half. This line earns the point. At one, one, the slope is one plus one times one, which is two. y changes by one half times two, so f of one point five is about two.
8:06Now stand at one point five, two, our estimate. The slope is one plus one point five times two, which is four. So f of two is about two, plus one half times four, which is four. Now it's your turn, with the same idea. Here it is. Use the same equation with f of zero equal to two, and take two steps to f of one. Watch the two slips that cost points on the exam.
8:38Here's how it goes wrong. The new x goes into the slope before you get there, or the step size gets dropped, and the whole distance is taken on every step. Here's the fix. Use the point you're standing on, and multiply the slope by the step size, every row, all the way down. Example two, shaped like a recent A. P. free response. f of zero is two, and the table gives values of f prime. Use Euler's method, starting at x equals zero, with two steps of equal size, to approximate f of four.
9:15The plan: step size first, then read the slopes from the table, only at the x's we land on. From zero to four in two steps, the step size is two. So we stand only at zero and two, and land on four. The columns at one and three are just there to tempt you. This line earns the point. At zero, the table gives a slope of three.
9:42So f of two is about two, plus two times three, which is eight. At two, the slope is negative one. So f of four is about eight, plus two times negative one. That's eight minus two, which is six. Notice the slope came straight from the table, at the x we stood on. With only values of f prime, no y goes into the slope.
10:09Example three, multiple choice. d y d x is x minus y, and f of two is one. Euler's method with two steps of equal size, starting at x equals two, gives which approximation for f of one? The plan: we go from two to one, to the left, so the step is negative. One minus two, over two: the step size is negative one half. At two, one, the slope is two minus one, which is one.
10:42y changes by negative one half times one, so f of one point five is about one half. At one point five, one half, the slope is one point five minus one half, which is one again. So f of one is about one half, minus one half. It's zero, so the answer is B. A positive step would walk the wrong way, toward choice D. Before you move on, here's one for you.
11:11Use the same equation, with f of two equal to one, and take two steps the other way, to f of three. So, back to the question. With no formula, can we still say what y of one is? Yes, approximately. Read the slope at your estimate, where you stand, because the real curve is unknown. On paper, find the step size first, negative when you go backward, and use one row per step.
11:41And with only values of f prime, read the slope at each x you stand on. Which step tripped you up? Tell me in the comments. The next BC lesson: seven point nine, logistic models.