Differential-Equations ยท Unit 2 ยท Video 1 ยท Interactive Practice

One Line Element at a Time: Euler's Method and Its Three Equations

IKey Formulas

FormulaNameWhat you need
yโ€ฒ=f(x,y),y(x0)=y0y' = f(x, y), \qquad y(x_0) = y_0Initial value problem (IVP)An equation and a starting point
An=f(xn,yn)A_n = f(x_n, y_n)Slope of the line element where you standThe right-hand side, evaluated at (xn,yn)(x_n, y_n)
xn+1=xn+hx_{n+1} = x_n + hAdvance xxOne step size hh, the same at every step
yn+1=yn+hAny_{n+1} = y_n + h A_nAdvance yy along the line elementThe current yny_n and the current slope AnA_n

Key Insight: The three equations are one right triangle. Its run is hh, its hypotenuse lies along the line element and so has slope AnA_n, and therefore its rise must be hAnh A_n. Read backwards, that is the difference quotient yn+1โˆ’ynh=An\dfrac{y_{n+1} - y_n}{h} = A_n: a slope computed from two points standing in for the derivative.

IIVisualization 1 โ€” One Step Is a Triangle

Run hh, hypotenuse of slope AnA_n โ€” so the rise can only be hAnh A_n.

IIIVisualization 2 โ€” Five Steps, and the Gap They Open

Every slope after the first is measured at a point the true solution never visits.

Step 1 โ€” from (0,ย 1)(0,\ 1)
A0=f(0,1)=0โˆ’1=โˆ’1A_0 = f(0, 1) = 0 - 1 = -1
y1=1+0.5(โˆ’1)=0.5y_1 = 1 + 0.5(-1) = 0.5 at x1=0.5x_1 = 0.5

๐Ÿ’ก A program stores only these six points; the smooth curve a screen shows you is drawn through them afterwards, for display alone.

IVVisualization 3 โ€” What the Step Size Costs

The step size hh is yours to choose, and the gap at x=2x = 2 is what the choice buys.

๐Ÿ’ก Each step starts where the previous one ended, so its error is inherited: the gap at x=2x = 2 is the accumulation of all NN steps, not the error of the last one.

VQuiz Questions

Problem 1 ยท One Step of the Recursion

Given: the IVP yโ€ฒ=xโˆ’yy' = x - y with y(0)=1y(0) = 1, and step size h=0.5h = 0.5 โ€” find the point (x1,y1)(x_1, y_1) produced by the first Euler step.

โœ… Correct! A0=f(0,1)=โˆ’1A_0 = f(0,1) = -1, so the step falls: y1=1+0.5(โˆ’1)=0.5y_1 = 1 + 0.5(-1) = 0.5 at x1=0.5x_1 = 0.5.
โŒ Check the sign. The right-hand side is xโˆ’yx - y, so f(0,1)=0โˆ’1=โˆ’1f(0,1) = 0 - 1 = -1. The line element at (0,1)(0,1) points downhill, and the step must follow it down.
โŒ Close, but the slope is not the rise. The vertical side of the step triangle is hAnh A_n, not AnA_n: 0.5ร—(โˆ’1)=โˆ’0.50.5 \times (-1) = -0.5, so y1=1โˆ’0.5=0.5y_1 = 1 - 0.5 = 0.5.
โŒ Check x1x_1. The first equation is xn+1=xn+hx_{n+1} = x_n + h, and h=0.5h = 0.5, not 11 โ€” you moved a full unit along the xx-axis.
โŒ Not quite. Compute A0=f(x0,y0)A_0 = f(x_0, y_0) first, then apply x1=x0+hx_1 = x_0 + h and y1=y0+hA0y_1 = y_0 + h A_0.
Show solution

Take the three equations in the order the computer takes them โ€” slope first, because the line for yy uses it:

A0=f(x0,y0)=0โˆ’1=โˆ’1A_0 = f(x_0, y_0) = 0 - 1 = -1 x1=x0+h=0+0.5=0.5x_1 = x_0 + h = 0 + 0.5 = 0.5 y1=y0+hA0=1+0.5(โˆ’1)=0.5y_1 = y_0 + h A_0 = 1 + 0.5(-1) = 0.5

The new point is (0.5,ย 0.5)(0.5,\ 0.5). Geometrically this is the step triangle: run 0.50.5, hypotenuse of slope โˆ’1-1, so the rise is 0.5ร—(โˆ’1)=โˆ’0.50.5 \times (-1) = -0.5.

Problem 2 ยท Where the Next Slope Is Measured

Given: the same walk โ€” yโ€ฒ=xโˆ’yy' = x - y, h=0.5h = 0.5 โ€” has reached (x1,y1)=(0.5,ย 0.5)(x_1, y_1) = (0.5,\ 0.5). Find the next point (x2,y2)(x_2, y_2).

โœ… Correct! A1=f(0.5,0.5)=0A_1 = f(0.5, 0.5) = 0, a horizontal line element, so the second step runs flat: y2=y1=0.5y_2 = y_1 = 0.5.
โŒ That is the old slope. AnA_n is recomputed at every step: A1=f(0.5,0.5)=0A_1 = f(0.5, 0.5) = 0, not the A0=โˆ’1A_0 = -1 used before.
โŒ The slope is measured before the step, not after. A1=f(x1,y1)=f(0.5,0.5)A_1 = f(x_1, y_1) = f(0.5, 0.5), not f(x2,y1)=f(1,0.5)f(x_2, y_1) = f(1, 0.5) โ€” the line element belongs to the point you are standing on.
โŒ That is the exact solution. y=xโˆ’1+2eโˆ’xy = x - 1 + 2e^{-x} gives y(1)=2eโˆ’1โ‰ˆ0.736y(1) = 2e^{-1} \approx 0.736, but the broken line left the true curve at the end of step 1 and never returns to it.
โŒ Not quite. Evaluate ff at the point you have reached, (0.5,ย 0.5)(0.5,\ 0.5), then step.
Show solution

Recompute the slope where the last step landed:

A1=f(x1,y1)=0.5โˆ’0.5=0A_1 = f(x_1, y_1) = 0.5 - 0.5 = 0 x2=0.5+0.5=1,y2=0.5+0.5(0)=0.5x_2 = 0.5 + 0.5 = 1, \qquad y_2 = 0.5 + 0.5(0) = 0.5

So (x2,y2)=(1,ย 0.5)(x_2, y_2) = (1,\ 0.5): the second step is horizontal, because the line element at (0.5,ย 0.5)(0.5,\ 0.5) is horizontal.

Notice what has happened. The exact solution through (0,1)(0,1) is y=xโˆ’1+2eโˆ’xy = x - 1 + 2e^{-x}, which passes through (0.5,ย 0.713)(0.5,\ 0.713) โ€” so (0.5,ย 0.5)(0.5,\ 0.5) is not on it. The slope A1=0A_1 = 0 is the field's honest slope, but at a point the true solution never visits.

Problem 3 ยท Reading the Difference Quotient Backwards

Given: one step of Euler's method carried a computation from (1.2,ย 3)(1.2,\ 3) to (1.5,ย 3.6)(1.5,\ 3.6) โ€” find the step size hh and the slope AnA_n that step used.

โœ… Correct! hh is the run, 1.5โˆ’1.2=0.31.5 - 1.2 = 0.3, and AnA_n is the difference quotient 0.6/0.3=20.6 / 0.3 = 2.
โŒ That is the rise, not the slope. The vertical side is hAn=0.6h A_n = 0.6; divide by h=0.3h = 0.3 to recover AnA_n.
โŒ Check which coordinate gives hh. The step size is the horizontal advance xn+1โˆ’xnx_{n+1} - x_n; 0.60.6 is the vertical advance.
โŒ The quotient is upside down. Slope is rise over run: yn+1โˆ’ynh\dfrac{y_{n+1} - y_n}{h}, not hyn+1โˆ’yn\dfrac{h}{y_{n+1} - y_n}.
โŒ Not quite. Use xn+1=xn+hx_{n+1} = x_n + h for hh, then yn+1โˆ’ynh=An\dfrac{y_{n+1} - y_n}{h} = A_n.
Show solution

The first equation gives the step size directly:

h=xn+1โˆ’xn=1.5โˆ’1.2=0.3h = x_{n+1} - x_n = 1.5 - 1.2 = 0.3

The second equation, written as a difference quotient, gives the slope:

yn+1โˆ’ynh=AnโŸนAn=3.6โˆ’30.3=0.60.3=2\frac{y_{n+1} - y_n}{h} = A_n \quad \Longrightarrow \quad A_n = \frac{3.6 - 3}{0.3} = \frac{0.6}{0.3} = 2

Check it forwards: yn+1=yn+hAn=3+0.3(2)=3.6ย โœ“y_{n+1} = y_n + h A_n = 3 + 0.3(2) = 3.6\ \checkmark. The vertical side 0.60.6 is hAnh A_n, never AnA_n itself.

Problem 4 ยท Whose Slope Is the Second Slope?

Given: for yโ€ฒ=xโˆ’yy' = x - y with h=0.5h = 0.5, Euler's method steps from (0,ย 1)(0,\ 1) to (0.5,ย 0.5)(0.5,\ 0.5), while the exact solution through (0,1)(0,1) has y(0.5)โ‰ˆ0.713y(0.5) \approx 0.713. The second step therefore uses A1=f(0.5,ย 0.5)=0A_1 = f(0.5,\ 0.5) = 0. Which statement about that slope is correct?

โœ… Correct! A1A_1 is computed honestly from ff โ€” but at (0.5,ย 0.5)(0.5,\ 0.5), a point off the true curve, so it is the correct direction for a different integral curve.
โŒ ff does depend on yy here. On the exact solution, f(0.5,ย 0.713)=0.5โˆ’0.713=โˆ’0.213f(0.5,\ 0.713) = 0.5 - 0.713 = -0.213, not 00 โ€” two different yy values at the same xx give two different line elements.
โŒ The slope belongs to the point you stand on. An=f(xn,yn)A_n = f(x_n, y_n) is evaluated before the step; using f(1,ย 0.5)f(1,\ 0.5) would need a point not yet computed.
โŒ Only the first corner sits on the true solution. The broken line is tangent to the direction field at every corner, but after step 1 those corners are no longer on the original integral curve.
โŒ Not quite. Ask where A1A_1 was measured, and whether the exact solution passes through that point.
Show solution

The first step is the only one that begins on the true solution. It ends at (0.5,ย 0.5)(0.5,\ 0.5), while the exact solution y=xโˆ’1+2eโˆ’xy = x - 1 + 2e^{-x} is at

y(0.5)=0.5โˆ’1+2eโˆ’0.5โ‰ˆ0.713y(0.5) = 0.5 - 1 + 2e^{-0.5} \approx 0.713

so the broken line is already 0.2130.213 below the curve. The method then does the only thing it can: it reads the line element where it actually is,

A1=f(0.5,ย 0.5)=0.5โˆ’0.5=0A_1 = f(0.5,\ 0.5) = 0.5 - 0.5 = 0

That number is not an error in arithmetic โ€” it is the exact slope of the integral curve through (0.5,ย 0.5)(0.5,\ 0.5), which is a different solution of the same equation. Euler's method is exact in direction at every corner and correct as a solution only at the very first one.

Solved: 0 / 4