# Video: Finding Approximate Solutions to Differential Equation Using Euler’s Method

Consider the initial value problem 𝑦′ = 𝑦 + 1, 𝑦(0) = 0. Use Euler’s method with 𝑛 = 5 steps on the interval [0, 1] to find 𝑦(1).

05:40

### Video Transcript

Consider the initial value problem 𝑦 prime is equal to 𝑦 plus one where 𝑦 at 𝑥 is equal to zero is zero. Use Euler’s method with 𝑛 equal to five steps on the interval zero, one to find 𝑦 at 𝑥 is equal to one.

We’ve been given a first-order differential equation, 𝑦 prime is equal to 𝑦 plus one. In other words, the derivative of 𝑦 with respect to 𝑥 is equal to 𝑦 plus one. We have an initial value 𝑦 at 𝑥 is equal to zero is equal to zero so that our starting point 𝑥 zero, 𝑦 zero is the point zero, zero. We’re asked to find 𝑦 at 𝑥 is equal to one using Euler’s method.

Euler’s method is a way of numerically integrating the first-order differential equation. How this works is that from a given starting point over a range of 𝑥-values — in our case, the closed interval zero, one — we use Euler’s formula to calculate successive approximate 𝑦-values for the range of 𝑥-values. To do this, we split our 𝑥-interval into equal-size steps. In our case, we have 𝑛 equal to five steps. So, we need to split our interval zero, one into five steps.

And to find the step size ℎ, we divide the interval width by the number of steps. Since our maximum 𝑥 is one and the minimum is zero, our interval width is one minus zero, which we divide by the number of steps, five, so that our step size is one over five, which is 0.2. In our interval then, if zero is 𝑥 zero with a step size of 0.2, 𝑥 one is equal to 0.2, 𝑥 two is equal to 0.4, 𝑥 three is 0.6, 𝑥 four is 0.8, and 𝑥 five is one.

Remember, we’re asked to find the value of 𝑦 when 𝑥 is equal to one. So, we’re looking for 𝑦 at 𝑥 is equal to 𝑥 five, which we’ll call 𝑦 five. In order to reach 𝑦 five, we need to calculate 𝑦 one, which is 𝑦 of 𝑥 one. We use that to calculate 𝑦 two, which is 𝑦 of 𝑥 two. We use that to calculate 𝑦 three, which is 𝑦 of 𝑥 three, and so on until we get to 𝑦 five, which is 𝑦 of 𝑥 five.

Looking at our formula, to calculate 𝑦 𝑛, we need 𝑦 𝑛 minus one, ℎ, and a function 𝑓. We know that ℎ is 0.2 and a function 𝑓 is actually our derivative. In our case, this is a function of 𝑦. So, we have 𝑓 of 𝑦 is equal to 𝑦 plus one. Since this function doesn’t depend on 𝑥, we can eliminate the 𝑥 term from our equation. So, we have 𝑦 𝑛 is equal to 𝑦 𝑛 minus one plus ℎ times 𝑓 of 𝑦 𝑛 minus one. We now have everything we need to start calculating our values.

Our starting point is 𝑦 zero is equal to zero. We use this in our formula to calculate 𝑦 one. If 𝑛 is equal to one in our formula, then 𝑛 minus one is equal to zero. And we have 𝑦 one is equal to 𝑦 zero plus ℎ times 𝑓 of 𝑦 zero. 𝑦 zero is equal to zero. ℎ is equal to 0.2. And 𝑓 of 𝑦 zero is 𝑦 zero plus one. That’s equal to zero plus one, which is one, so that 𝑦 one is equal to zero plus 0.2 times one, which is 0.2.

Our next step is to calculate 𝑦 two using 𝑦 one. And in our formula, 𝑦 two is equal to 𝑦 one plus ℎ times 𝑓 of 𝑦 one. That is 0.2 plus 0.2 times 𝑓 of 𝑦 one. And 𝑓 of 𝑦 one is 𝑦 one plus one, which is 0.2 plus one, which is 1.2. So that 𝑦 two is equal to 0.2 plus 0.2 times 1.2. And that’s equal to 0.44. 𝑦 two is, therefore, 0.44. We use this to calculate 𝑦 three. So, 𝑦 three is 𝑦 two plus ℎ times 𝑓 of 𝑦 two. And that’s equal to 0.44 plus ℎ, which is 0.2 times 𝑓 of 𝑦 two. 𝑓 of 𝑦 two is 𝑦 two plus one, which is 0.44 plus one. And that’s 1.44 so that 𝑦 three is equal to 0.44 plus 0.2 times 1.44. And that’s equal to 0.728.

And we use this to calculate 𝑦 four. And 𝑦 four is 𝑦 three plus ℎ times 𝑓 of 𝑦 three. And that’s 0.728 plus 0.2 times 𝑓 of 𝑦 three. 𝑓 of 𝑦 three is 𝑦 three plus one, which is 0.728 plus one, which is 1.728. We, therefore, have 𝑦 four is equal to 0.728 plus 0.2 times 1.728. That’s equal to 1.0736 so that 𝑦 four is equal to 1.0736.

Finally, we can use 𝑦 four to calculate 𝑦 five, which is equal to 𝑦 four plus ℎ times 𝑓 of 𝑦 four. And that’s equal to 1.0736 plus 0.2 times 𝑓 of 𝑦 four. 𝑓 of 𝑦 four is 𝑦 four plus one, which is 1.0736 plus one, which is equal to 2.0736. So that 𝑦 five is equal to 1.0736 plus 0.2 times 2.0736 which is equal to 1.48832. 𝑦 five is, therefore, 1.48832. And remember that 𝑦 five is 𝑦 of 𝑥 five, which is equal to 𝑦 of one. So 𝑦 of one is equal to 1.48832.

The graph shown is a computer-generated solution to a differential equation. We found the 𝑦-values for the five steps within our interval. And if we plot these points on our graph, we can see that our solution curve is not too far away from the computer-generated solution. The computer-generated solution would have had a much smaller step size and so would be closer to the true solution. This demonstrates that the smaller the step size, the more accurate the approximation.