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
Current time:0:00Total duration:10:08
FUN‑7 (EU)
FUN‑7.C (LO)
FUN‑7.C.4 (EK)

Video transcript

we've already seen that if we were to start with a differential equation the derivative of Y with respect to X is equal to Y and we had the initial condition that Y of 0 is equal to 1 that the particular solution to this given this initial conditions is y of X is equal to e to the X or I guess we could just say Y is equal to e to the X if we didn't want to write it with the function notation and that's all fair and well and this works out well this is a separable differential equation and we can integrate things quite easily but as you will see is you go further in the world of differential equations most differential equations are not so easy to solve in fact many of them are impossible to solve using analytic methods and so given that what do you do you've nicely described some phenomena models some phenomena using in differential equations but if you can't solve it analytically do you just give up and the answer that question is no you do not just give up because we now have computers and computers are really good at numerical methods numerical methods for approximating and giving us a sense of what the solution to a differential equation might look like and so how do we do that well in this video we could explore one of the most straightforward numerical methods for approximating a particular solution so what we do is so let me draw a little table here so a little table here and so actually let me give myself some I'm gonna do it over here on the left-hand side so a little table so X and then Y with X Y and then dy/dx and you could set up a table like this to create a slope field you could just pick all the you could sample X's and Y's in the cart in the in the XY plane and then figure out for a first-order differential equation like this what is the slope going to be at that point you could construct a slope field and we're going to do something kind of related but instead of trying to construct a slope field we're going to start with this initial condition we know that Y of 0 is equal to 1 we know that the particular solution of this differential equation contains this point so we're going to start with that point so we're going to start with X is equal to zero and let me do this in a different color we're going to start with X is equal to zero Y is equal to one which is that point right over there and we're going to say well okay what is the what is the derivative at that point well we know the derivative at any point that's or any solution to this differential equation the derivative is going to be equal to the Y value so in this case the derivative is going to be equal to Y it's going to be equal to one and in general if the derivative just like what we saw in the case of slope fields as long as the derivative is expressed as a function of X is and y of X is then you can figure out what the what the slope of the tangent line will be at that point and so you say okay there's a slope of one at that point so I can depict it like that and instead of just keep doing that at a bunch of points you'll say okay well it's just like we know that the slope is changing or it's probably changing from for most cases let's just assume it's fixed until our next X and then use that assumption to estimate what the next Y would be so what am I talking about here so when I talk about the next x we're talking about well let's just step let's say say for the sake of simplicity we're going to have a delta X of one a change in X of 1 so we're going to step from x equals zero now we're going to now step from that to X is equal to one so we're now going to go to actually oh me not use that I use that yellow color already for the actual graph or for the actually DX so now let's say X is equal to one so we've our Delta X is one so we've just added one here and what we can do in our in our little approximation scheme here is let's just assume that that slope was constant over over that interval so where does that get us to well if Y was it 1 and if I have a slope of 1 for one more for one increase in X I'm going to increase by Y by one so then Y is going to increase by 1 and is going to get to 2 and we see that point right over there and you already might see where this is going now if this were actually a point on the curve on the solution and if it was satisfying this what would then the derivative be well the derivative is equal to Y the slope of the tangent line is going to be equal to Y so in this case the slope of the tangent line is now going to be equal to two and we could depict that let me depict that in magenta here so it is going to be it is going to be two so it's going to look the slope of the tangent line there is going to be two and so what does that tell us well if we step if we step by our Delta X one more so now our X is equal to two what should the corresponding what should the corresponding Y be well let's see now for every one that we increase in the X in the X direction we should increase two in the Y direction because the slope is two so the very next one should be for Y is equal to four so we could imagine we have now kind of cat a constant slope and we get to that point right over there and now we can do the same thing well if we assume dy DX based on the differential equation has to be equal to Y we say okay the slope of the tangent line there is going to be the same thing as Y it's going to be four and so if we step our X up by one if we increment our X by one again once again we just decided to increment by one we could have incremented by ten we could have incremented by point zero one and you could guess which one's going to give you a more accurate result but if we step up by one now and our slope is 4 well we're going to increase by if we increased X by one we're going to increase Y by four so we are going to get we are going to get to eight and so we are at the point 3 comma eight which is right over here and so for this next stretch the next stretch is going is going to look like that and as you can see just by doing this we have been able to approximate what the particular solution looks like and you might say hey Sal we know that's not so good of an approximation and I reply to you as well yeah I mean depends on what your goals are but I did this by hand I didn't even do this using a computer and because I wanted to do it by hand I took fairly large delta-x steps if I wanted a better approximation I could have lowered the Delta X and let's do that so let's take another scenario so let's do another scenario where instead of Delta X equal 1 let's say Delta X equals 1/2 so once again X Y and the derivative of Y with respect to X so now let's say I want to take so we know this first point they've given it we're given this initial condition when x is 0 Y is 1 and so the slope of the tangent line is going to be 1 but then if we're incrementing by 1/2 so that when X is I'll just write it as 0.5 0.5 what is our new what is our new Y going to be what we're going to assume that our slope from this to this is this slope right over here so our slope is 1 so if we increase X by 0.5 we're going to increase Y by 0.5 and we're going to get to 1.5 so we're going to get 0.5 1.5 we get to that point right over there actually you're having trouble seeing that this stuff right over here is this point right over here and now our new slope is going to be 1.5 which is going to look which is going to look like which is going to look like actually not quite that steep I don't want to overstate how good of an approximation is and it starting to get a little bit messy but it's going to look something like that and what you would see if you kept doing this process so if your slope is now 1.5 when you increment X by another 0.5 where you get to 1 so now if you increment by if you increment by 0.5 and your slope is 1.5 your Y is going to increment by half of that by 0.75 and so you're going to get to 2.25 so now you get to 12.25 which is this point right over here and once again this is a better approximation remember in the original one Y of 1 you know it should be equal to e Y of 1 and the actual solution should be equal to e 2.7 on and on and on and on and on now in this one Y of Y of Y of 1 - - in this one why of one got us to 2.25 once again closer to the actual reality closer to e instead of stepping by 0.5 if we stepped by 0.1 we would get even closer if we stepped by if we stepped by point zero zero zero one we would get even closer and closer and closer so there's a bunch of interesting things here this is actually how most differential equations or or techniques that are derived from this or that are based on numerical methods similar to this or how most differential equations gets altered even it's not the exact same solution or the same method that the idea that most differential equations are actually solved or I guess you could say simulated with a numerical method because most of them actually cannot be solved in analytical form now you might be saying hey well what method is this one right over here called well this right over here is called Euler's Euler's method after the famous Leonhard Euler Euler's Euler's method and not only is actually is this one a good way of approximating what the solution to this or any differential equation is but actually for this differential equation in particular you casually even use this to find to find e with more and more and more precision anyway hopefully you found that exciting