Differential Equations: Introduction to First-Order Systems of ODEs
Introduction to First-Order Systems of ODEs
For the rest of the term, we are going to be studying not just one differential equation at a time, but rather what are called systems of differential equations. Those are like systems of linear equations. They have to be solved simultaneously, in other words, not just one at a time. So, how does a system look when you write it down? Well, since we are going to be talking about systems of ordinary differential equations, there still will be only one independent variable, but there will be several dependent variables. I am going to call, let's say two. The dependent variables are going to be, I will call them x and y, and then the first order system, something involving just first derivatives, will look like this.
On the left-hand side will be x', dx / dt, in other words. On the right-hand side will be the dependent variables and then also the independent variables. I will indicate that, I will separate it all from the others by putting a semicolon there. And the same way y', the derivative of y with respect to t, will be some other function of (x, y) and t. Let's write down explicitly that x and y are dependent variables.
And what they depend upon is the independent variable t, time. A system like this is going to be called first order. And we are going to consider basically only first-order systems for a secret reason that I will explain at the end of the period. This is a first-order system, meaning that the only kind of derivatives that are up here are first derivatives. So x' = dx / dt and so on. Now, there is still more terminology. Of course, practically all the equations after the term started, virtually all the equations we have been considering are linear equations, so it must be true that linear systems are the best kind. And, boy, they certainly are.
When are we going to call a system linear? I think in the beginning you should learn a little terminology before we launch in and actually try to start to solve these things. Well, the x and y, the dependent variables must occur linearly. In other words, it must look like this, ax + by. Now, the t can be a mess. And so I will throw in an extra function of t there. And y' will be some other linear combination of x and y, plus some other messy function of t. But even the a, b, c, and d are allowed to be functions of t. They could be 1 / t^3 or sin(t) or something like that. So I have to distinguish those cases. The case where a, b, c, and d are constants, that I will call --
Well, there are different things you can call it. We will simply call it a constant coefficient system. A system with coefficients would probably be better English. On the other hand, a, b, c, and d, this system will still be called linear if these are functions of t. Can also be functions of t. So it would be a perfectly good linear system to have x' = tx + sin(t) y + e^(-t^2). You would never see something like that but it is okay. What else do you need to know? Well, what would a homogenous system be? A homogenous system is one without these extra guys. That doesn't mean there is no t in it.
There could be t in the a, b, c and d, but these terms with no x and y in them must not occur. So, a linear homogenous. And that is the kind we are going to start studying first in the same way when we studied higher order equations. We studied first homogenous. You had to know how to solve those first, and then you could learn how to solve the more general kind. So linear homogenous means that r1 is zero and r2 is zero for all time. They are identically zero. They are not there. You don't see them. Have I left anything out? Yes, the initial conditions. Since that is quite general, let's talk about what would initial conditions look like?
Well, in a general way, the reason you have to have initial conditions is to get values for the arbitrary constants that appear in the solution. The question is, how many arbitrary constants are going to appear in the solutions of these equations? Well, I will just give you the answer. Two. The number of arbitrary constants that appear is the total order of the system. For example, if this were a second derivative and this were a first derivative, I would expect three arbitrary constants in the system --
-- because the total, the sum of two and one makes three. So you must have as many initial conditions as you have arbitrary constants in the solution. And that, of course, explains when we studied second-order equations, we had to have two initial conditions. I had to specify the initial starting point and the initial velocity. And the reason we had to have two conditions was because the general solution had two arbitrary constants in it.
The same thing happens here but the answer is it is more natural, the conditions here are more natural. I don't have to specify the velocity. Why not? Well, because an initial condition, of course, would want me to say what the starting value of x is, some number, and it will also want to know what the starting value of y is at that same point. Well, there are my two conditions. And since this is going to have two arbitrary constants in it, it is these initial conditions that will satisfy, the arbitrary constants will have to be picked so as to satisfy those initial conditions. In some sense, the giving of initial conditions for a system is a more natural activity than giving the initial conditions of a second order system.
You don't have to be the least bit cleaver about it. Anybody would give these two numbers. Whereas, somebody faced with a second order system might scratch his head. And, in fact, there are other kinds of conditions. There are boundary conditions you learned a little bit about instead of initial conditions for a second order equation. I cannot think of any more general terminology, so it sounds like we are going to actually have to get to work.
Okay, let's get to work. I want to set up a system and solve it. And since one of the things in this course is supposed to be simple modeling, it should be a system that models something. In general, the kinds of models we are going to use when we study systems are the same ones we used in studying just first-order equations. Mixing, radioactive decay, temperature, the motion of temperature. Heat, heat conduction, in other words. Diffusion. I have given you a diffusion problem for your first homework on this subject. What else did we do? That's all I can think of for the moment, but I am sure they will occur to me. When, out of those physical ideas, are we going to get a system? The answer is, whenever there are two of something that there was only one of before.
For example, if I have mixing with two tanks where the fluid goes like that. Say you want to have a big tank and a little tank here and you want to put some stuff into the little tank so that it will get mixed in the big tank without having to climb a big ladder and stop and drop the stuff in. That will require two tanks, the concentration of the substance in each tank, therefore, that will require a system of equations rather than just one.
Or, to give something closer to home, closer to this backboard, anyway, suppose you have dah, dah, dah, don't groan, at least not audibly, something that looks like that. And next to it put an EMF there. That is just a first order. That just leads to a single first order equation. But suppose it is a two loop circuit. Now I need a pair of equations. Each of these loops gives a first order differential equation, but they have to be solved simultaneously to find the current or the charges on the condensers. And if I want a system of three equations, throw in another loop. Now, suppose I put in a coil instead. What is this going to lead to? This is going to give me a system of three equations of which this will be first order, first order.
And this will be second order because it has a coil. You are up to that, right? You've had coils, inductance? Good. So the whole thing is going to count as first-order, first-order, second-order. To find out how complicated it is, you have to add up the orders. That is one and one, and two. This is really fourth-order stuff that we are talking about here. We can expect it to be a little complicated. Well, now let's take a modest little problem. I am going to return to a problem we considered earlier in the problem of heat conduction. I had forgotten whether it was on the problem set or I did it in class, but I am choosing it because it leads to something we will be able to solve. And because it illustrates how to add a little sophistication to something that was unsophisticated before.
A pot of water. External temperature Te(t). I am talking about the temperature of something. And what I am talking about the temperature of will be an egg that is cooking inside, but with a difference. This egg is not homogenous inside. Instead it has a white and it has a yolk in the middle. In other words, it is a real egg and not a phony egg. That is a small pot, or it is an ostrich egg. [LAUGHTER] That is the yoke. The yolk is contained in a little membrane inside. And there are little yucky things that hold it in position. And we are going to let the temperature of the yolk, if you can see in the back of the room, be T1. That is the temperature of the yolk. The temperature of the white, which we will assume is uniform, is going to be T2.
Oh, that's the water bath. The temperature of the white is T2, and then the temperature of the external water bath. In other words, the reason for introducing two variables instead of just the one variable for the overall temperature of the egg we had is because egg white is liquid pure protein, more or less, and the T1, the yolk has a lot of fat and cholesterol and other stuff like that which is supposed to be bad for you.
It certainly has different conducting. It is liquid, at the beginning at any rate, but it certainly has different constants of conductivity than the egg white would. And the condition of heat through the shell of the egg would be different from the conduction of heat through the membrane that keeps the yoke together. So it is quite reasonable to consider that the white and the yolk will be at different temperatures and will have different conductivity properties.
I am going to use Newton's laws but with this further refinement. In other words, introducing two temperatures. Whereas, before we only had one temperature. But let's use Newton's law. Let's see. The question is how does T1, the temperature of the yolk, vary with time? Well, the yolk is getting all its heat from the white. Therefore, Newton's law of conduction will be some constant of conductivity for the yolk times T2 - T1.
The yolk does not know anything about the external temperature of the water bath. It is completely surrounded, snug and secure within itself. But how about the temperature of the egg white? That gets heat and gives heat to two sources, from the external water and also from the internal yolk inside. So you have to take into account both of those. Its conduction of the heat through that membrane, we will use the same a, which is going to be a(T1 - T2). Remember the order in which you have to write these is governed by the yolk outside to the white. Therefore, that has to come first when I write it in order that a be a positive constant. But it is also getting heat from the water bath.
And, presumably, the conductivity through the shell is different from what it is through this membrane around the yolk. So I am going to call that by a different constant. This is the conductivity through the shell into the white. And that is going to be T, the external temperature minus the temperature of the egg white. Here I have a system of equations because I want to make two dependent variables by refining the original problem.
Now, you always have to write a system in standard form to solve it. You will see that the left-hand side will give the dependent variables in a certain order. In this case, the temperature of the yolk and then the temperature of the white. The law is that in order not to make mistakes -- And it's a very frequent source of error so learn from the beginning not to do this. You must write the variables on the right-hand side in the same order left to right in which they occur top to bottom here. In other words, this is not a good way to leave that. This is the first attempt in writing this system, but the final version should like this. T1', I won't bother writing dT / dt, is equal to --
T1 must come first, so -aT1 + aT2. And the same law for the second one. It must come in the same order. Now, the coefficient of T1, that is easy. That's a times T1. The coefficient of T2 is -a - b, so -(a + b)T2. But I am not done yet. There is still this external temperature I must put into the equation. Now, that is not a variable. This is some given function of t. And what the function of t is, of course, depends upon what the problem is. So that, for example, what might be some possibilities, well, suppose the problem was I wanted to coddle the egg.
I think there is a generation gap here. How many of you know what a coddled egg is? How many of you don't know? Well, I'm just saying my daughter didn't know. I mentioned it to her. I said I think I'm going to do a coddled egg tomorrow in class. And she said what is that? And so I said a cuddled egg? She said why would someone cuddle an egg? I said coddle. And she said, oh, you mean like a person, like what you do to somebody you like or don't like or I don't know. Whatever. I thought a while and said, yeah, more like that. [LAUGHTER] Anyway, for the enrichment of your cooking skills, to coddle an egg, it is considered to produce a better quality product than boiling an egg. That is why people do it.
You heat up the water to boiling, the egg should be at room temperature, and then you carefully lower the egg into the water. And you turn off the heat so the water bath cools exponentially while the egg inside is rising in temperature. And then you wait four minutes or six minutes or whatever and take it out. You have a perfect egg. So for coddling, spelled so, what will the external temperature be?
Well, it starts out at time zero at 100 degrees centigrade because the water is supposed to be boiling. The reason you have it boiling is for calibration so that you can know what temperature it is without having to use a thermometer, unless you're on Pike's Peak or some place. It starts out at 100 degrees. And after that, since the light is off, it cools exponential because that is another law.
You only have to know what K is for your particular pot and you will be able to solve the coddled egg problem. In other words, you will then be able to solve these equations and know how the temperature rises. I am going to solve a different problem because I don't want to have to deal with this inhomogeneous term. Let's use, as a different problem, a person cooks an egg. Coddles the egg by the first process, decides the egg is done, let's say hardboiled, and then you are supposed to drop a hardboiled egg into cold water. Not just to cool it but also because I think it prevents that dark thing from forming that looks sort of unattractive. Let's ice bath.
The only reason for dropping the egg into an ice bath is so that you could have a homogenous equation to solve. And since this a first system we are going to solve, let's make life easy for ourselves. Now, all my work in preparing this example, and it took considerably longer time than actually solving the problem, was in picking values for a and b which would make everything come out nice. It's harder than it looks. The values that we are going to use, which make no physical sense whatsoever, but a = 2 and b = 3. These are called nice numbers. What is the equation? What is the system? Can somebody read it off for me? It is T1' equals, what is it, -2T1 + 2T2. That's good.
-2T1 + 2T2. T2 prime is, what is it? I think this is 2T1. And the other one is -(a + b), so minus 5. This is a system. Now, on Wednesday I will teach you a fancy way of solving this. But, to be honest, the fancy way will take roughly about as long as the way I am going to do it now. The main reason for doing it is that it introduces new vocabulary which everyone wants you to have. And also, more important reasons, it gives more insight into the solution than this method. This method just produces the answer, but you want insight, also. And that is just as important.
But for now, let's use a method which always works and which in 40 years, after you have forgotten all other fancy methods, will still be available to you because it is method you can figure out yourself. You don't have to remember anything. The method is to eliminate one of the dependent variables. It is just the way you solve systems of linear equations in general if you aren't doing something fancy with determinants and matrices.
If you just eliminate variables. We are going to eliminate one of these variables. Let's eliminate T2. You could also eliminate T1. The main thing is eliminate one of them so you will have just one left to work with. How do I eliminate T2? Beg your pardon? Is something wrong? If somebody thinks something is wrong raise his hand. No? Why do I want to get rid of T1? Well, I can add them. But, on the left-hand side, I will have T1' + T2'. What good is that? [LAUGHTER]
I think you will want to do it my way. [APPLAUSE] Solve for T2 in terms of T1. That is going to be (T1' + 2T1) / 2. Now, take that and substitute it into the second equation. Wherever you see a T2, put that in, and what you will be left with is something just in T1. To be honest, I don't know any other good way of doing this. There is a fancy method that I think is talked about in your book, which leads to extraneous solutions and so on, but you don't want to know about that. This will work for a simple linear equation with constant coefficients, always. Substitute in. What do I do? Now, here I do not advise doing this mentally. It is just too easy to make a mistake.
Here, I will do it carefully, writing everything out just as you would. ((T1' + 2T1)/2)' = 2T1 - 5(T1' + 2T1)/2. I took that and substituted into this equation. Now, I don't like those two's. Let's get rid of them by multiplying. This will become 4. And now write this out. What is this when you look at it? This is an equation just in T1. It has constant coefficients. And what is its order? Its order is two because (T1')'. In other words, I can eliminate T2 okay, but the equation I am going to get is no longer a first-order. It becomes a second-order differential equation. And that's a basic law.
Even if you have a system of more equations, three or four or whatever, the law is that after you do the elimination successfully and end up with a single equation, normally the order of that equation will be the sum of the orders of the things you started with. So two first-order equations will always produce a second-order equation in just one dependent variable, three will produce a third order equation and so on.
So you trade one complexity for another. You trade the complexity of having to deal with two equations simultaneously instead of just one for the complexity of having to deal with a single higher order equation which is more trouble to solve. It is like all mathematical problems. Unless you are very lucky, if you push them down one way, they are really simple now, they just pop up some place else.
You say, oh, I didn't save anything after all. That is the law of conservation of mathematical difficulty. [LAUGHTER] You saw that even with the Laplace transform. In the beginning it looks great, you've got these tables, take the equation, horrible to solve. Take some transform, trivial to solve for capital Y. Now I have to find the inverse Laplace transform. And suddenly all the work is there, partial fractions, funny formulas and so on.
It is very hard in mathematics to get away with something. It happens now and then and everybody cheers. Let's write this out now in the form in which it looks like an equation we can actually solve. Just be careful. Now it is all right to use the method by which you collect terms. There is only one term involving T1 double prime. It's the one that comes from here. How about the terms in T1 prime? There is a 2.
Here, there is minus 5 T1 prime. If I put it on the other side it makes plus 5 T1 prime plus this two makes 7 T1 prime. And how many T1's are there? Well, none on the left-hand side. On the right-hand side I have 4 here minus 10. 4 minus 10 is negative 6. Negative 6 T1 put on this left-hand side the way we want to do makes plus 6 T1. There are no inhomogeneous terms, so that is equal to zero. If I had gotten a negative number for one of these coefficients, I would instantly know if I had made a mistake. Why? Why must those numbers come out to be positive?
It is because the system must be, the system must be, fill in with one word, stable. And why must this system be stable? In other words, the long-term solutions must be zero, must all go to zero, whatever they are. Why is that? Well, because you are putting the egg into an ice bath. Or, because we know it was living but after being hardboiled it is dead and, therefore, dead systems are stable.
That's not a good reason but it is, so to speak, the real one. It's clear anyway that all solutions must tend to zero physically. That's obvious. And, therefore, the differential equation must have the same property, and that means that its coefficients must be positive. All its coefficients must be positive. If this weren't there, I would get oscillating solutions, which wouldn't go to zero. That is physical impossible for this egg.
Now the rest is just solving. The characteristic equation, if you can remember way, way back in prehistoric times when we were solving these equations, is this. And what you want to do is factor it. This is where all the work was, getting those numbers so that this would factor. So it's (r + 1)(r + g). And so the solutions are, the roots are r = -1. I am just making marks on the board, but you have done this often enough, you know what I am talking about. So the characteristic roots are those two numbers. And, therefore, the solution is, I could write down immediately with its arbitrary constant as c1 e^(-t) + c2 e^(-6t).
Now, I have got to get T2. Here the first worry is T2 is going to give me two more arbitrary constants. It better not. The system is only allowed to have two arbitrary constants in its solution because that is the initial conditions we are giving it. By the way, I forgot to give initial conditions. Let's give initial conditions. Let's say the initial temperature of the yolk, when it is put in the ice bath, is 40 degrees centigrade, Celsius. And T2, let's say the white ought to be a little hotter than the yolk is always cooler than the white for a soft boiled egg, I don't know, or a hardboiled egg if it hasn't been chilled too long. Let's make this 45. Realistic numbers.
Now, the thing not to do is to say, hey, I found T1. Okay, I will find T2 by the same procedure. I will go through the whole thing. I will eliminate T1 instead. Then I will end up with an equation T2 and I will solve that and get T2 equals blah, blah, blah. That is no good, A, because you are working too hard and, B, because you are going to get two more arbitrary constants unrelated to these two.
And that is no good. Because the correct solution only has two constants in it. Not four. So that procedure is wrong. You must calculate T2 from the T1 that you found, and that is the equation which does it. That's the one we have to have. Where is the chalk? Yes. Maybe I can have a little thing so I can just carry this around with me. That is the relation between T2 and T1. Or, if you don't like it, either one of these equations will express T2 in terms of T1 for you. It doesn't matter. Whichever one you use, however you do it, that's the way you must calculate T2. So what is it? T2 is calculated from that pink box.
It is 1/2 T1' + T1. Now, if I take the derivative of this, I get minus c1 times the exponential. The coefficient is minus c1, take half of that, that is -1/2 c1 and add it to T1. -1/2 c1 + c1 = 1/2 c1. And here I take the derivative, it is minus 6 c2. Take half of that, minus 3 c2 and add this c2 to it, minus 3 plus 1 makes minus 2. That is T2. And notice it uses the same arbitrary constants that T1 uses.
So we end up with just two because we calculated T2 from that formula or from the equation which is equivalent to it, not from scratch. We haven't put in the initial conditions yet, but that is easy to do. Everybody, when working with exponentials, of course, you always want the initial conditions to be when T = 0 because that makes all the exponentials one and you don't have to worry about them. But this you know. If I put in the initial conditions, at time zero, T1 has the value 40.
So 40 = c1 + c2. And the other equation will say that 45 = 1/2 c1 - 2 c2 Now we are supposed to solve these. Well, this is called solving simultaneous linear equations. We could use Kramer's rule, inverse matrices, but why don't we just eliminate. Let me see. If I multiply by, 45, so multiply by two, you get 90 = c1 - 4 c2. Then subtract this guy from that guy. So, 40 taken from 90 makes 50.
And c1 taken from c1, because I multiplied by two, makes zero. And c2 taken from -4 c2 - c2 = -5 c2, I guess. I seem to get c2 = -10. And if c2 is negative 10, then c1 = 50. There are two ways of checking the answer. One is to plug it into the equations, and the other is to peak. Yes, that's right. [LAUGHTER]
The final answer is, in other words, you put a 50 here, 25 there, negative 10 here, and positive 20 there. That gives the answer to the problem. It tells you, in other words, how the temperature of the yolk varies with time and how the temperature of the white varies with time. As I said, we are going to learn a slick way of doing this problem, or at least a very different way of doing the same problem next time, but let's put that on ice for the moment. And instead I would like to spend the rest of the period doing for first order systems the same thing that I did for you the very first day of the term.
Remember, I walked in assuming that you knew how to separate variables the first day of the term, and I did not talk to you about how to solve fancier equations by fancier methods. I instead talked to you about the geometric significance, what the geometric meaning of a single first order equation was and how that geometric meaning enabled you to solve it numerically. And we spent a little while working on such problems because nowadays with computers it is really important that you get a feeling for what these things mean as opposed to just algorithms for solving them. As I say, most differential equations, especially systems, are likely to be solved by a computer anyway.
You have to be the guiding genius that interprets the answers and can see when mistakes are being made, stuff like that. The problem is, therefore, what is the meaning of this system? Well, you are not going to get anywhere interpreting it geometrically, unless you get rid of that t on the right-hand side. And the only way of getting rid of the t is to declare it is not there. So I hereby declare that I will only consider, for the rest of the period, that is only ten minutes, systems in which no t appears explicitly on the right-hand side.
Because I don't know what to do if it does up here. We have a word for these. Remember what the first order word was? A first order equation where there was no t explicitly on the right-hand side, we called it, anybody remember? Just curious. Autonomous, right. This is an autonomous system. It is not a linear system because these are messy functions. This could be xy or x squared minus 3y squared divided by sine of x plus y. It could be a mess. Definitely not linear. But autonomous means no t. t means the independent variable appears on the right-hand side. Of course, it is there. It is buried in the dx/dt and dy/dt.
But it is not on the right-hand side. No t appears on the right-hand side. Because no t appears on the right-hand side, I can now draw a picture of this. But, let's see, what does a solution look like? I never even talked about what a solution was, did I? Well, pretend that immediately after I talked about that, I talked about this. What is the solution? Well, the solution, maybe you took it for granted, is a pair of functions, (x(t), y(t)) if when you plug it in it satisfies the equation. And so what else is new? The solution is x = x(t), y = y(t).
If I draw a picture of that what would it look like? This is where your previous knowledge of physics above all 18.02, maybe 18.01 if you learned this in high school, what is x = x(t) and y = y(t)? How do you draw a picture of that? What does it represent? A curve. And what will be the title of the chapter of the calculus book in which that is discussed? Parametric equations. This is a parameterized curve.
So we know what the solution looks like. Our solution is a parameterized curve. And what does a parameterized curve look like? Well, it travels, and in a certain direction. Okay. That's enough. Why do I have several of those curves? Well, because I have several solutions. In fact, given any initial starting point, there is a solution that goes through it. I will put in possible starting points. And you can do this on the computer screen with a little program you will have, one of the visuals you'll have. It's being made right now.
You put down starter point, put down a click, and then it just draws the curve passing through that point. Didn't we do this early in the term? Yes. But there is a difference now which I will explain. These are various possible starting points at time zero for this solution, and then you see what happens to it afterwards. In fact, through every point in the plane will pass a solution curve, parameterized curve.
Now, what is then the representation of this? Well, what is the meaning of x'(t) and y'(t)? I am not going to worry for the moment about the right-hand side. What does this mean by itself? If this is the curve, the parameterized motion, then this represents its velocity vector. It is the velocity of the solution at time t. If I think of the solution as being a parameterized motion. All I have drawn here is the trace, the path of the motion. This hasn't indicated how fast it was going. One solution might go whoosh and another one might go rah. That is a velocity, and that velocity changes from point to point. It changes direction. Well, we know its direction at each point. That's tangent.
What I cannot tell is the speed. From this picture, I cannot tell what the speed was. Too bad. Now, what is then the meaning of the system? What the system does, it prescribes at each point the velocity vector. If you tell me what the point (x, y) is in the plane then these equations give you the velocity vector at that point. And, therefore, what I end up with, the system is what you call in physics and what you call in 18.02 a velocity field.
So at each point there is a certain vector. The vector is always tangent to the solution curve through there, but I cannot predict from just this picture what its length will be because at some points, it might be going slow. The solution might be going slowly. In other words, the plane is filled up with these guys. Stop me. Not enough here. So on and so on. We can say a system of first order equations, ODEs of first order equations, autonomous because there must be no t on the right-hand side, is equal to a velocity field.
A field of velocity. The plane covered with velocity vectors. And a solution is a parameterized curve with the right velocity everywhere. Now, there obviously must be a connection between that and the direction fields we studied at the beginning of the term. And there is. It is a very important connection. It is too important to talk about in minus one minute. When we need it, I will have to spend some time talking about it then.