If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Worked example: Euler's method

FUN‑7 (EU)
FUN‑7.C (LO)
FUN‑7.C.4 (EK)
Finding the initial condition based on the result of approximating with Euler's method.

Video transcript

- [Voiceover] Now that we are familiar with Euler's method, let's do an exercise that tests our mathematical understanding of it, or at least the process of using it. So, it says consider the differential equation: the derivative of y with respect to x is equal to three x minus two y. Let y is equal to g of x be a solution to the differential equation with the initial condition g of zero is equal to k where k is constant. Euler's method starting at x equals zero with the a step size of one gives the approximation that g of two is approximately 4.5. Find the value of k. So once again, this is saying hey, look, we're gonna start with this initial condition when x is equal to zero, y is equal to k, we're going to use Euler's method with a step size of one. So, we're essentially going to use, we're going to step once from zero to one, and then again from one to two. And then that approximation is going to give us 4.5. And so, given that we started at k, we should be able to figure out what k was to get us to g of two being approximated as 4.5. So with that, I encourage you to pause the video, and try to figure this out on your own. I am assuming you have tried to figure this out on your own. Now we can do it together. And I'll do the same thing that we did in the first video on Euler's method. I'll make a little table here so let me make a little table. I can draw a straighter line than that. That's only marginally straighter, but it will get the job done. So let's make this column x, I'm going to give myself some space for y, I might do some calculation here, y, and then dy/dx. Now, we can start at our initial condition. When x is equal to zero, y is equal to k. When x is equal to zero, y is equal to k. And so, what's our derivative going to be at that point? Well, dy/dx is equal to three x minus two y. So in this case, it's three times zero minus two times k, which is just equal to negative two k. And so now we can increment one more step. We have a step size of one, so at each step we're going to increment x by one, and so we're now going to be at one. Now what's our new y going to be? Well, if we increment x by one, and our slope is negative two k, that means we're going to increment y by negative two k times one, or just negative two k. So, negative two k. So k plus negative two k is negative k. So, our approximation using Euler's method gets us the point one negative k, and then what is going to be our slope starting at that point? So one negative k, our slope is going to be three times our x, which is one, minus two times our y, which is negative k now, and this is equal to three plus two k. And now we'll do another step of one, because that's our step size. Another, whoops, I'm going to get to two. Now this is the one that we care about right? Because we're trying to approximate g of two. So we have to say, what does our approximation give us for y when x is equal to two? And we're going to have something expressed in k, but they're saying that's going to be 4.5, and then we can use that to solve for k. So what's this going to be? So if we increment by one in x, we should increment our y by one times three plus two k. So we're going to increment by three plus two k, or negative k plus three plus two k is just going to be three plus k. And they're telling us that our approximation gets that to be 4.5. So three plus k is equal to 4.5. So the k that we started with must have been, if we just subtract three from both sides, this is a decimal here, it must have been k must be equal to 1.5, and you can verify that. If this initial condition right over here, if g of zero is equal to 1.5, then you put 1.5 over here. Then over here you would get 4.5, and we're done.