 Okay, so last time we thought we started talking about differential equations, which is our third big section of the class. And what I did last time is I showed you some examples of some various differential equations. And so just to remind you differential equation is just so in a differential equation we have an unknown function described in terms of its derivatives. So I mean a really almost, so usually this is written, the function is called y but it doesn't have to be sometimes it's x and so on. And in some sense some of the integration problems that we did are really kind of differential equations like when I write the integral of x dx is some y. Well this is the same as saying that the derivative of y is x. We're looking for a function whose derivative is x. So this is a very easy differential equation. We can easily see that, so that means that y, well from here we know that y is x squared over 2 plus the constant. But of course we can have more complicated things where we can't just integrate one side together. We have to work harder to find the formula. And a lot of differential equations just like a lot of integrals, you can't write down the formula directly. So just as in a number of integrals that we saw like the integral of I don't know, sine x over x, there is no formula for that function. Similarly here there's a nice formula that we can write down differential equations for which there's no nice formula. That doesn't mean the equation doesn't have a solution. It just means we can't describe it in a nice way. But we can still understand it even if we can't write down the formula. So even if you can't write a formula you can still understand what's going on. So one of the examples that we looked at last time towards the end was this differential equation where the derivative of some function p o. Let me point out one thing. One thing that we often do here is we suppress the fact that this is a function. In some sense I should really be saying f prime of x equals x. And that makes it clearer that it's a function. But usually you just call it y and you say the derivative of y is x and it's implied that y is a function of x. Or t or whatever it is. And there may not even appear an x in the equation. So for example here if we write that the derivative of p is some constant times p times 1 minus p. And here it should be implied that p is a function of some unknown variable which we can call t or we can call x. It's our choice. Here p is standard for population so you're probably using the variable t as the independent variable. And p is the dependent variable but whatever. Now when we write an equation like this you can still sort of understand, without being able to solve it, maybe you can solve it. We'll solve this one later because it is a nice formula that tells us what it is. You can still sort of understand how the solutions are going to behave just by looking at the equation. So for example if we know that p of t is 0 at some t. Let's just say t equals 0. Let's just pick it up. If I know that the time is 0 and p of 0 is 0. What do I know about p? Okay so if I tell you that at some moment, let's put this in here. So find out that the population in 2005 is 0. So was 0. And the population follows this equation. Given that the population in 2005 was 0. What's the population now? 0. Because why? Because the derivative is 2 times p times 1 minus p. And the derivative at 2009, 2005, was q times 0 times 1 which is 0. So that means that this tells us that p of t is a constant. Because the only functions whose derivatives are 0 are constant functions. So it was a constant at 2005 so the population 2006 is the same as 2005 so it was a constant. And it's always the same. And it was 0 once so it's always 0. So this is called, well and then let's take another example. Same example but another choice. If the population in 2005 was 1 this is measured in, I don't know, so the population in 2005 was 1. What's the population in 2009? In 2005 is 2 times p in 2005 which is a number we don't know. Times 1 minus p in 2005. But I said this was 1. This is 1. So this is 2 times 1 times 1 minus 1 which is 0. So again the derivative is 0. So the derivative, so the function is another constant. This time the constant is 1. So again the population doesn't change. What if, instead of that, I tell you the population in 2005 is a half. What do I know? I won't know the population in 2009 without a lot more work. But, well let's not make it be a half. Let's make it be a 10. So what do I know about p in 2009? It's 1 10. Why would it be 1 10? Because p prime in 2005 is twice a tenth times 1 minus a tenth which is, I don't know, 9 tenths times 100 is 18 over 100. It's bigger than a tenth. So this is bigger than 0 and in fact if you just look all of the populations between 0 and 1, if the population is between 0 and 1 p prime is bigger than 0. So that means that the population will grow but that's about all we know because the p is an increasing function for values between 0 and 1 tenth but that's about all we know. Let me come back to this notion. So these kinds of solutions are called equilibrium solutions. So if you know that your derivative, you know that the derivative is sometimes 0 then the solution is a constant and this is called an equilibrium solution or sometimes it's called a constant. So I mean if you're doing chemistry a lot of times you have a solution so if you have two solutions you mix and some stuff happens and concentrations of one thing change and then eventually the solution becomes an equilibrium. That's saying that the differential equation that governs the reaction of the solutions is tending towards some steady state where the derivative is 0, the change of stuff. There's no change of stuff. Same thing in physics. We're describing the motion of something and eventually it gives to an equilibrium that doesn't move anymore the derivative is 0. So finding places where the derivative is 0 is useful but not the whole story. So we will focus on that a little bit. We can tell some things from that. Now we can also do some other things without knowing a lot. So for example if I tell you, so let's take another example. If I have a function y double prime is, I don't know, minus 9y. So there's some function and I tell you that y of x is, so what do I want here? I want, this one works right? Three times the sign of x. Well there's some constant, I'm sorry, the sign is 3x. Some constant is the sign of 3x. So I'm telling you this. I can just check. The derivative here is 3a cosine of 3x and the second derivative is 9a minus sign of 3x. So yes that is indeed a solution. Now I can tell you how to figure out that it was the sign. I just said it looks like that. But a is some constant. Now if I give you a little more information, for example, well since this is the sign I know that y of 0 has to be 0, p is 0, y of 0 has to be 0. But I can give you another piece of information. So if I tell you also, so I could ask, so for what values of a is it true that when time is 0 I have 0, but also when time is 0 the derivative is 1? This is called an initial condition. If I have, I guess I shouldn't create a rightful condition. This is a second order equation. There are actually two initial conditions that will be fully nailed down. Equation but I'm telling you how it starts out. So if I don't tell you this part, if I don't tell you this initial condition then any function, any sign function with any amplitude satisfies the equation. This is half of a sine 3x for three different values of a. Let's make it four different values of a. They all look like this, but I have several different ones. But when I give you an initial condition I'm asking you to pick one of them out. If this is describing the motion of a pendulum, I guess it's oscillating here, this is the motion of a pendulum. I'm telling you when I looked at it the pendulum was hanging straight down but it was moving with velocity 1. This is the velocity, this is the position. And I'm telling you up front is described by a times the sine 3x by some magic formula. But now I want to describe it completely and want to pick out a solution. So what do I do? I told you this information in that information. How can I figure out what a is? I'm just plugging it in with ions and I get an equation for a. This is not hard stuff. I told you the class needs a line. This is not hard, you just have to think about what's going on. Well I know that y of 0 is supposed to be 1 and that's a times the sine of 3 times 0 which is 0 so that didn't give me any information. But I also know from here that y prime of 0 is supposed to be 1 and this is 3a times the cosine of 3 times 0. Cosine of 0 is 1 so that's 3a so that tells me a is a third. I know this function exactly so let's just check that this actually works. That a equals 1 third works. It's minus 9 times y. And let's check a is a third. It works. So that means that y 1 third sine of 3x, y prime of x is 1 times the cosine of 3x. Y double prime is 3 times the sine of 3x but it's negative. But this is negative 9 times 1 third the sine which is y. So it's good. But it doesn't work for any value of a because here I just said a is some number. I don't know it. Let's check that it works. Sure nothing works. So because I chose 1 it looks a little suspicious that this 3 is not an i. But this 3 is 1 third of an i. So given an initial condition this will nail down if the initial condition is appropriate it will nail down the solution. Really when we solve the differential equation just like when we do any definite integral there is a constant or some constants floating around that we need to figure out. So the solution to a differential equation usually depends on some unknown constants. What if 1 is sum? 1 is sum. We can figure out that means that the solution is not one function but lots of functions. So for example if I say that the derivative of y is equal to y we know that e to the x works. But any constant times e to the x works for any choice of k. The derivative depends on maybe my table should not be k. So from any choice of this constant this solves the equation. So there's not just one solution there's a whole bunch of them for various values of k. And in fact so there's a whole bunch of them that depend on k. And we can nail down which one if we have initial conditions. Is there a question? You can pick out which one depending on initial conditions. And so just like when you learn to do integrals there's this plus c that a lot of people forget and then they lose a point because they forget the plus c and blah, blah, blah. But it's important because the integral of a function is not a function it's a whole bunch of functions. And the c tells you which specific one. So the constant of integration and this is the same as the constant of integration. In fact the verb that you use to solve a differential equation is sometimes you can use the verb that you're integrating into a differential equation. Even if you're not just writing down an integral. And the word integrate has another meaning in English. It doesn't just mean to find an anti-derivative it means to take disparate things and put them together. And that's what we're doing when we solve a differential equation and I want to sort of elaborate down that a little bit. So suppose we have no knowledge of how to come up with a solution. So far all of our solutions are just look at it and guess and see what it is. So far all I did is I said well I told you the answer is this. Does it work? Look at that. What do you think the answer might be? I think it gets. Does it work? Look at that. And we go from there. And we'll develop some techniques but before that you can still do some stuff to understand what the differential equation looks like. What the solution looks like. So I want to go over some of that stuff which is analogous to what I just did here that I'm erasing. We can understand this differential equation and what it's telling us by thinking about it and we can think about it. Pictures are helpful sometimes in thinking about these things. So say I have a differential equation like that and I don't know how to solve this well I do know how to solve it but I don't know how to come up with a formula. It says the growth rate of the thing how much you have plus the time. It grows faster as time increases but it also grows proportional to how much is there. It prefers to have using x I can use t. It doesn't matter. So this differential equation how can we possibly understand what this does without solving. So we can make a picture where I put x is here and I put y is here and I'm not going to graph the solution instead I'm going to graph the slope. So I can make a direction field or a vector field which tells me something about the solutions. So if I think about so what does this mean? So what I'm going to do is I'm going to put a bunch of lines on the chart board which are the slopes to the solution. So for example if I know that at x equals zero y equals zero what's the derivative when x equals zero and y equals zero? Zero. So right here the derivative is zero. That one's a bad one to do because it's a little hard to see. But let's say if x equals one and y equals zero then the slope is plus one. So at one zero the slope is one and at two zero the slope is two. So and for negative values of x when x is negative one and y is zero the slope is one and when x is minus two and y is zero the slope is minus two and so on. Now let's move up a little bit. When y is one and x is zero the slope here is one and when y is two and x is zero the slope here is two and so on. This is a very tedious process but we can go through and sort of draw a line of lines that tell us something about how the solutions behave. This is kind of not a very good picture so we'll turn this on and forth. Instead of doing this by hand well I'll just talk about it while the word's up. So I already know some stuff about the solution. What do I know about the solution? But they go a lot if I start here. Will the solution decrease in its x increases? Does the y value go up or down? I heard wall wall, I heard down, I heard up. So how many people think the solution stays constant? How many people think the solution will decrease? How many people have no clue what the hell's going on? One on, two. So soon if I set it up before class there we go. So here's a better version of what I said. I'm going to start here then the solution will come down and go back up and if I start here the solution will come down and go back up. If I start over here it looks like the solution will go down and get steeper. So depending on where I start I will get different kinds of solutions. So now this is for the vector field x that directs the differential equation y times equals x plus y. I can of course fix moderately clear what I'm saying here. So we can tell just by looking at this how the solutions will go. If instead of, let's go back to the same, if I go one tenth in x what will be the y value? A value. It will still be minus one. But why is it minus one? It's minus one because the derivative is zero at x zero. And this is my step size h. Then I do it again. Now I have two things. My next x, well I'm just going to go up by another tenth. So at point two my y value will be my old y value. So I'm just, I'm here and I said go this way for a tenth. The arrow tells me not to do anything but go this way. So I land there at one tenth. But now there's a little arrow pointing slightly down. So I'm going to take where I was before and I'm going to add on what the derivative tells me to do at the new place. So in this case this is minus one plus one tenth. I picked a very messy one. It should have been an easier one. So this is minus one plus one tenth. And the derivative here at one tenth is not zero. It is, what's my function? One tenth, that's x times the sign of minus, of a tenth times minus one. So this is a horrible number. This is a bad example. This is one one hundredth. The sign of minus a tenth is slightly less than zero. I continue in this way. It doesn't seem to change much for a little while but then suddenly it will get very steep down. Over here it will get very steep down. So let me write this again in a more formula way. And then maybe go through an easier example. This example is nasty to do by hand but it makes a nice picture. Let's do the x plus y one which is easy to do by hand and makes a boring picture. So let me write those methods again. So let me point out also there's a new web sign up or what? Which is do on the Wednesday that we don't have class just before Thanksgiving so that people work while you're getting ready to go for Thanksgiving. So what are those methods that says to follow? I take a step five which I'm calling h. It's always called h. Which is usually a small number. And then my initial condition, so I have an initial condition which are my initial condition let that be my initial condition. And then I set x one to be the previous x plus h. And my y one is so I have a differential equation here y five equals f of x y. So y one is going to be the previous y plus h times whatever I get when I plug the previous x and the previous y into the differential equation. That gives me an x one and a y one. Then I repeat x two is x one plus h y two is y one plus whatever the slope is and I just keep going. So I do this for a long time in general x n plus one the next x is the previous x plus h and y n plus one is the previous y plus h times the function at the previous time. So this example that I did was horrible so let's do an easier example like x plus y. No I don't have time. So let me point out that if I don't make any progress I won't be able to do the homework which is already ticked. But so let's do it very quickly to spend one minute on the differential equation y prime equals x plus y with the initial condition let's say y zero equals y zero equals negative one. And let's take the step size just to make things easy let's take h equal to half. So that means that x naught is zero y naught is negative one x one is zero plus a half y naught is negative one plus a half of x plus y here so negative one equals negative is negative three half x two is one because it's a half plus a half oops that's a one y two is y one plus a half of x naught plus y naught plus y one which is minus three half plus a half and then here I have minus three half plus one half is minus one which is minus four half which is x three is three half which is one plus a half y three is previous y here which is minus two plus a half of previous x which is minus oh I think they're really stupid value oh well which is minus two and a half which is minus three which is five and so on. Now this one is really stupid because I actually happen to choose something that lives on the line and the one that I'm constructing here doesn't do anything interesting what are you talking about?