Differential Equations: Finding Particular Solutions to Inhomogeneous ODEs
Finding Particular Solutions to Inhomogeneous ODEs
The task for today is to find particular solutions. So, let me remind you where we've gotten to. We're talking about the second-order equation with constant coefficients, which you can think of as modeling springs, or simple electrical circuits. But, what's different now is that the right-hand side is an input which is not zero. So, we are considering, I'm going to use x as your book does, keeping to a neutral letter. But, again, in the applications, and in many of the applications at any rate, it wants to be t. But, I make it x.
So, the independent variable is x, and the problem is, remember, that to find a particular solution, and the reason why we want to do that is then the general solution will be of the form y equals that particular solution plus the complementary solution, the general solution to the reduced equation, which we can write this way. So, all the work depends upon finding out what that yp is, and that's what we're going to talk about today, or rather, talk about for two weeks. But, the point is, not all functions that you could write on the right-hand side are equally interesting. There's one kind, which is far more interesting, but more important in the applications than all the others. And, that's the one out of which, in fact, as you will see later on this week and into next week, an arbitrary function can be built out of these simple functions.
So, the important function is on the right-hand side to be able to solve it when it's a simple exponential. But, if you allow me to make it a complex exponential, so, here are the important right-hand sides where we want, we want to be able to do it when it's of the form, e^(ax). In general, that will be, in most applications, a is not a growing exponential, but a decaying exponential. So, typically, a is negative. But, it doesn't have to be. I'll put it in parentheses, though, often. That's not any assumption that I'm going to make today. It's just culture. But, we want to be able to do it for sin(omega x) and cos(omega x).
In other words, when the right-hand side is a pure oscillation, that's another important type of input both for electrical circuits, think alternating current, or the spring systems. That's a pure vibration is you're imposing pure vibration on the spring-mass-dashpot system, and you want to see how it responds to that. Or, you could put them together, and make these decaying oscillations. So, we could also have something like e^(ax) sin(omega x), or times cos(omega x). Now, the point is, all of these together are really just special cases of one general thing, exponential, if you allow the exponent not to be a real number, but to be a complex number.
So, they're all special cases of e^(alpha x), well, why don't we write it (a + i omega) x, right? If omega is zero, then I've got this case. If a is zero, I got this case separating into its real and imaginary parts. And, if neither is zero, I have this case. But, I don't want to keep writing (a plus i omega) all the time. So, I'm going to write that simply as e^(alpha x). And, you understand that alpha is a complex number now. It doesn't look like a real number. Okay, so the complex number. So, the equation we are solving is which one? This pretty purple equation. And, we are trying to find a particular solution of it. And, the special functions we are going to use are these, well, this one in particular, e^(alpha x).
That's going to be our input. Now, it turns out this is amazingly easy to do because it's an exponential because I write it in exponential form. The idea is simply to use a rule which, in fact, you know already, the rule of substitution. So, I'm going to write the equation in the form, so, there it is. It's y'' + Ay' + By = f(x). But, I'm going to think of the left-hand side as the polynomial operator, AD plus B.
A and B are constants, applied to y = f(x). That's the way I write the thing. And, this part, I'm going to think of in the form. This is p of D, a polynomial in D. In fact, it's a simple quadratic polynomial. But, most of what I'm going to say today would apply equally well if we were a higher order polynomial, a polynomial of higher degree. And, just to reinforce the idea, I've given you one problem in your problem set when p is a polynomial of higher degree. I should say, the notes are written for general polynomials, not just for quadratic ones. I'm simplifying it by leaving it, today, I'll do what's in the notes, but I'll do it in the quadratic case to save a little time, and because that's the one you will be most concerned with in the problems.
All right, so p(D) y = f(x). And now, there are just a couple of basic formulas that we're going to use all the time. The first is that if you apply p(D) to a complex exponential, or a real one, it doesn't matter, the answer is you get just what you started with, with D substituted by alpha. So, it's p of alpha. In other words, put an alpha wherever you saw a D in the polynomial.
And, what is this? Well, this is now just an ordinary complex number, and multiply that by what you started with, e^(alpha x). So, that's a basic formula. It's called in the notes the substitution rule because the heart of it is, you substitute for the D, you substitute alpha. Now, this hardly requires proof. But, let's prove it just so you see, to reinforce things and make things go a little more slowly to make sure you are on board all the time. How would I prove that? Well, just calculate it out, what in fact is D^2 + AD + B)e^(alpha x). Well, it's D^2*e^(alpha x) + AD*e^(alpha x) + B*e^(alpha x).
Well, what are these? What's the derivative of e^(alpha x)? It's just alpha e^(alpha x). What's a second derivative? Well, if you remember from the exam, you can do tenth derivatives now. So, the second derivative is easy. It's alpha^2 e^(alpha x). In other words, this law, what I'm saying really is that this law is obviously, quote unquote, "true".
Okay, I'm not even going to put it in quotes. It's obviously true for the operator, D, and the operator D^2. In other words, D(e^(alpha x)) = alpha*e^(alpha x). D^2(e^(alpha x)) = alpha^2*e^(alpha x). And, therefore, it's true for linear combinations of these as well by linearity. So, therefore, also true for p(D). And, in fact, so if you calculate it out, what is it? This is alpha^2 e^(alpha x) + alpha e^(alpha x) times the coefficient plus b e^(alpha x).
So, it's in fact exactly this. It's e^(alpha x) (alpha^2 + A alpha + B). Now, how are we going to use this? Well, the idea is very simple. Remember, we're trying to solve this, I should have some consistent notation for these equations. Purple, I think, will be the right thing here. You are solving purple equations. The formulas which will solve them will be orange formulas, and we will see what we need as we go along. So, I would like to just formulate it, this solution, the particular solution now. I'm going to call it a theorem. It's really too simple to be a theorem. On the other hand, it's too important not to be a theorem.
So, let's call it, as I called it in the notes, the exponential input theorem, which says it all. Theorem says it's important. Exponential input means it's taking f(x) to be an exponential. It's an exponential input, and the theorem tells you what the response is. So, for that equation, I'm not going to recopy the equation for the purple equation, adequately indicated this way. There. Now try to take notes. For the purple equation, a solution is e^(alpha x).
Somewhere I neglected to say that f(x) = e^(alpha x), how about that? That equation, y'' + ay' + by = e^(alpha x). So, here's the exponential input. The solution is e^(alpha x) / p(alpha). Now, that's a very useful formula. In fact, Haynes Miller, who also teaches this course, in his notes calls of the most important theorem in the course. Well, I don't have to totally agree with him, but it's certainly important. It's probably the most important theorem for these two weeks, anyway. But, you will have others as well. Okay, so that's a theorem. The theorem is going green. You can tell what they are by their color code.
Well, in other words, what I've done is simply write down the solution for you, write down the particular solution. But let's verify it in general. So, the proof would be what? Well, I have to substitute it into the equation. So, the equation is p of D applied to y is equal to alpha x. And, I want to know, when I substitute that expression in, is it the case that when I plug it in, that the right-hand side, I calculate it out, apply p(D) to it. Is it the case that I get e^(alpha x) on the right? Well, all you have to do is do it. What is p(D) e^(alpha x) / (p(x))?
Well, p(D) e^(alpha x) = p(alpha) e^(alpha x). That's the substitution rule. What about this guy? This guy is a constant, so it just gets dragged along because this operator is linear. If this applied to that is this, then if I apply it to one half that, I get one half the answer, and so on. So, the p(alpha) is a constant and just gets dragged along. And now, they cancel each other, and the answer is, indeed, e^(alpha x).
That's not much of a proof. I hope that to at least half this class, you're wondering, yes, but what if Peter had not caught the wolf? I mean, what if? What if? I'm looking stern. Okay, we will take care of it in the simplest possible way. We will assume that p of alpha is not zero. The case p(alpha) = 0 is, in fact, an extremely important case, one that makes the world go 'round, one that contributes to all sorts of catastrophes, and they occur first here in the solution of differential equations, and that's what controls all the catastrophes.
But, there's a good side to it, too. It also makes a lot of good things happen. So, there are no moral judgments in mathematics. For the time being, let's assume p of alpha is not zero. And, that proof is okay because the p of alpha, being in the denominator, it's okay to be in the denominator if you're not zero. Okay, let's work in a simple example. Well, I'm picking the most complicated example I can think of.
Simple examples, I'll leave for your practice and for the recitations, can start off with simple examples if you are confused by this. But, let's solve an equation, find a particular solution. So, y'' - y' + 2y = 10 e^(-x) sin(x). Gulp. Okay, so, the input is this function, 10 e^(-x), it's a decaying oscillation. You're seeing those already on the computer screen if you started your homework, if you've done problem one on your homework. It's a decaying exponential, and I want to find a particular solution. Well, let's find a particular and the general solution. Find the general solution.
Well, the main part of the work is finding the particular solution, but let's quickly, the general solution, let's find first the complementary part of it, in other words, the solution to the homogeneous equation. That's D^2 - D + 2. No, let's not. I don't want to solve messy quadratics. Okay, we're going to find a particular solution. I thought it was going to come out easy, and then I realized it wasn't because I picked the wrong signs. Okay, so if you don't like, just change the problem. I can do that, but you cannot. Don't forget that. So, we want a particular solution in our equation. It is this equals that. Now, let's complexify it to make this part of a complex exponential.
So, the complex exponential that's relevant is 10 e^((-1 + i)x). What is this? This is the imaginary part of this complex exponential. So, this is imaginary part of that guy, e^(-x)*e^(ix), and the imaginary part of e^(ix) is sin(x). The ten, of course, just comes along for the ride. Okay, well, now, since this is a complex equation, I shouldn't call this y anymore by my notation. I like to call it y tilde to indicate that the solution we get to this is not going to be the original solution to the original problem, but you will have to take the imaginary part of it to get it.
So, we are looking, now, for the complex solution to this complexified equation. Okay, what is it? Well, the complex particular solution I can write down immediately. It is ten, that, of course, just gets dragged along by linearity, 10 e^((-1 + i)x). And, it's over this polynomial evaluated at this alpha. So, just write it down with, have faith. So, what do I get? The alpha is -1 + i. I. square that, because I'm substituting this alpha into that polynomial. The reason I'm doing that is because the formula tells me to do it. That's going to be that solution. Okay, so it's (-1 + i)^2 - (-1 + i) + 2. All I've done is substitute -1 + i for D in that polynomial, the quadratic polynomial.
And now, all I want is the imaginary part of this. The imaginary part of this will be the solution to the original problem because this was the right hand side with the imaginary part of the complexified right hand side. Okay, now, let's make it look a little better, yp tilde. Clearly, what we have to do something nice to the denominator. So, I'll copy the numerator. That's e^((-1 + i)x), and how about the denominator? Well, again, don't expand things out because it's already this long. And, what's the point of making it this long? You want to make it as long, right? Okay, then there is room here for one real number, and another real number times i, there's no more room. Okay, what's the real number?
Okay, we're looking for the real part of this expression. So, just put it in and keep it mentally. So, minus one squared: that's one, plus i squared, that's minus one. One minus one is zero. I can forget about that term. The term gives me plus one for the real part, plus two. The answer is that the real part is three. How about the imaginary part? Well, from here, there's negative 2i, negative 2i.
I'm expanding that out by the binomial theorem, or whatever you like to call that, -2i - i = -3i. Is that right? Minus 2i, minus i, minus 3i. So, it is ten thirds, and now in the denominator I have one minus i. I'll put that in the numerator, make it one plus i, but I have to divide by the product of one minus i and its complex conjugate. In other words, I'm multiplying both top and bottom by one plus i. And so, that makes here one squared plus one squared is two. And now, what's left is e^(-x)cos(x) + i sin(x).
Now, of that, what we want is just the imaginary part. Well, let's see. Two goes into ten makes five, so that's five thirds. So, we're practically at our solution. The solution, then, finally, is going to be yp is the imaginary part of yp tilde. And, what's that? Well, what's the coefficient out front, first of all? It's five thirds, so let's pull out to five thirds before we forget it. And, we'll pull out the e to the negative x before we forget that. And then, the rest is simply a question of seeing what's left. Well, it's one. I want the imaginary part. So, the imaginary part is going to be one times cos(x), and then the other imaginary part comes from these two pieces, which is one times sin(x).
And, that should be the particular solution. Notice that most of the work is not getting this thing. It's turning it into something human that you can take the real and imaginary parts of. If we don't like this form, you can put it in the other form, which many engineers would do almost automatically, make it five thirds, e to the negative x, and what will that be? Well, you can use the general formula if you want. Remember, cosine, the two coefficients are one and one, so it's one and one. So, this is the square root of two. So, it is times, this part makes the square root of two times cosine of x minus pi over the angle.
This is a phi. So, that's pi over four, minus pi over four. Okay, all right, now let's address the case which is going to occupy a lot of the rest of today, and in a certain sense, all of next time. What happens when p(alpha) = 0? Well, in order to be able to handle this decently, it's necessary to have one more formula, which is very slightly more complicated than the substitution rule.
But, it's the same kind of rule. I'm going to call this, or it is called the exponential. So, I'm going to first prove a formula, which is the analog of that, and then I will prove a green formula, which is what to do here if p(alpha) = 0. But, in order to be able to prove that, we're going to be the analog of the orange formula. And, the analogue of the orange formula, that tells you how to apply p(D) to a simple exponential.
I need a formula which applies p(D) to that simple exponential times another function. Now, I found I got into trouble by continuing to call that alpha. So, I'm now going to change the name of alpha to change alpha's name to a. But, it's still complex. I don't mean it's guaranteed to be complex. I mean it's allowed to be complex. So, a is now allowed to be a complex number. I'm thinking of it, in general, as a complex number, okay? I hope this doesn't upset you too much, but you know, you change x to t's, and y's to x's. This is no worse. All right, what we going to do? Well, I'm going to use this exponential shift rule, I'll call it, exponential shift rule or formula or law.
That's the substitution rule for me. So, this is going to be exponential shift law. And, to apply, it tells you how to apply the polynomial to not D, not just the exponential, but the exponential times some function of x. What's that? And now, the rule is very simple. See, you can understand the difficulty. If you try to start differentiating, you're going to have to calculate second derivatives of the stuff, and God forbid, higher order equations. You would have to calculate fourth derivatives, fifth derivatives. You barely even want to calculate the first derivative. That's okay. But, second derivative, do I have to? No, not if you know the exponential shift rule, which says you can get rid of the e to the ax, make it pass to the left of the operator where it's not in any position to do any harm any longer, or upset the differentiation.
And, all you have to do is, when it passes over that operator, it changes D --> D + a. So, the answer is, e^(ax). There, it's passed over. But, when it did so, it changed D to D plus a. And, what about the u? Well, the u just stayed there. Nothing happened to it. Okay, there's our orange formula. I guess we better put the thing around the whole business. Should I prove that, or the proof is quite easy. So, let's do it just again to give you a chance to try to see, now, if somebody gives you a formula like that, you first stare at it. You might try a couple of special cases, try it on a function and see if it works, but already, you probably don't want to do that.
I mean, even if you took a function like x here, you'd have to do a certain amount of differentiating, and some quadratic thing here. You'd calculate and calculate away for a little while, and then if you did it correctly, the two would in fact turn out to be equal. But, you would not necessarily feel any the wiser. A better procedure in trying to understand something like this is say, well, let's keep the u general.
Suppose we make D simple. For example, well, if D is a constant, of course there's nothing to happen because if this is just a constant, both sides of these are the same. This doesn't make any sense if p doesn't really have a D in it. Well, what's the simplest polynomial which would have a D in it? Well, D itself. So, let's take a special case. p(D) = D, and check the formula in that case; see if it works.
So, the formula is asking us, what is D, D e^(ax) u? I'm not going to put in the variable here because it's just a waste of chalk. Well, what is that? I know how to calculate that. I'll use the product rule. So, it's the derivative. I'll tell you what; let's do the other order first. So, it's e^(ax) Du + a e^(ax) u.
Do you follow that? This is the product rule. It's e to the ax times the derivative of u plus the derivative of e^(ax) Du + a e^(ax) u. Now, is that right? I want to make it look like that. Well, to make it look like that I should first factor e^(ax) out. And now, what's left? Well, if I factor e to the ax out, what's left is Du plus au, which is exactly (D + a)u, Du + au. Well, hey, that's just what the formula said it should be. If you make e to the x pass over D, it changes D --> D + a.
Okay, now here's the main thing I want to show you. All right, now, well let's try, if this is true, also works out for D^2, then the formula is clearly true by linearity because an arbitrary p(D) is just a linear combination with constant coefficients of D, D squared, and that constant thing, which we agreed there was nothing to prove about. Now, hack, you're a hack if you take D squared and start calculating the second derivative of this.
Okay, it's question about hacks. I mean, it's just, you haven't learned the right thing to do. Okay, that will work, but it's not what you want to do. Instead, you bootstrap your way up. I have already a formula telling me how to handle this. And, you can be anything. Look at this not as D squared all by itself. Calculate, instead, D^2 (e^(ax) u). Think of that as D(D(e^(ax) u)). In other words, we will do it one step at a time. But you see now immediately the advantage of this. What's D(e^(ax) u)? Well, I just calculated that. Now, don't go back to the beginning. Don't go back to here. Use the formula.
After all, you worked to calculate it, or I did. So, it's D of, and what's this inside? It's e^(ax) (D + a) u. Well, that looks like a mess, but it isn't because I'm taking D of e to the ax times something. And I already know how to take D of e to the ax times something. It doesn't matter what that something is. Here, the something was u. Here, the something is D plus (a times u) operating on u. But, the principle is the same, and the answer is what? Well, to take D of e to the ax times something, you pass the e to the ax over the D. That changes D --> D + a. And, you apply that to the other guy, which is (D plus a) applied to u.
What's the answer? e^(ax) (D + a)^2 u. It's just what you would have gotten if you had taken e^x, pass it over, and then changed D --> D + a. Now, another advantage to doing it this way is you can see that this argument is going to generalize to D^3. In other words, you would continue on in the same way by the process of mathematical, one word, mathematical, begins with an I, induction. By induction, you would prove the same formula for the nth derivative. If you don't know what mathematical induction is, shame on you. But it's okay. A lot of you will be able to go through life without ever having to learn what it is.
And, the rest of you will be computer scientists. Okay, so that's the idea of this rule. Now, we can use it to calculate something. Let's see, I'm going to need green for this, I guess, for our better formula. The formula, now, that tells you what to do if p(alpha) = 0. So, we're trying to solve the equation, D^2 + AD, we are trying to find a particular solution, e^(ax), let's say. Remember, a is complex. a could be complex. It doesn't have to be real.
But, the problem is that p(alpha) = 0. How do I get a particular solution? Well, I will write it down for you. So, this is part of that exponential input theorem. I think that's the way it is in the notes. I gave all the cases together, but I thought pedagogically it's probably a little better to do the simplest case first, and then build up on the complexity. So, what's yp? The answer is yp = e^(ax), except now you have to multiply it by x out front. Where have you done something like that before? Yes, don't tell me. I know you know. But, what should go in the denominator? Clearly not p(alpha). What goes in the denominator is the derivative.
Okay, but what if p'(alpha) = 0? Couldn't that happen? Yes, it could happen. So, we better make cases. This case is, the case where this is okay corresponds to the case where we're going to assume that alpha is a simple root, is a simple root of the polynomial, p. I don't know what to call the variable, p of D is okay. A simple zero, in other words, it's not double. Well, suppose is double. One of the consequences you will see just in a second, if it's a simple zero, that means this derivative is not going to be zero. That's automatic. Yeah, well, suppose it's not as simple. Well, suppose is a double root. How did a-- How did that get changed to, argh!
[LAUGHTER] That's not an alpha. Oh, well, yes it is, obviously. Change! All of you, I want you to change. They should have something like in a search key where 147 occurrences of alpha have been changed to a with a stroke of a, just your thumb. They don't have that for the blackboard, unfortunately. Well, too bad, for the future. Correctable blackboards. Well, what if a is double root? It can't be more than a double root because you've only got a quadratic polynomial. Quadratic polynomials only have two roots.
So, the worst that can happen is that both of them are a. All right, in that case the formula should be yp is equal to, you are now going to need x^2 e^(ax), and in the denominator what you are going to need is the second derivative of, evaluated at a. Now, you can guess the way this going to go on. For higher degree things, if you've got a triple root, you will need here x^3, and here, p''' , except you're going to need a factorial there, too.
So, don't worry about it. It's in the notes, but I'm not going to give you that for higher roots. I don't even know if I will give it to you for double root. Yes, I already did, so it's too late. It's too late. Okay, so we will make this two formulas according to whether a is a single or a double root. Okay, let's prove one of these, and all of that will be good enough for my conscience. Let's prove the first one. Mostly, it's an exercise in using the first exponential shift rule. Okay, this will be a first example actually seeing a work in practice as opposed to proving it.
Okay, so what does that thing look like? So, what does the polynomial look like, which has a as a simple root? So, we're going to try to prove the simple root case. So, I'm just going to calculate what those guys actually look like. What does p(D) look like if a is a simple root? Well, if it's a simple root, that means it has a factor. When it factors, it factors into the product of (D minus a) times something which isn't, D minus some other root. And, the point is that b is not equal to A. The roots are really distinct. Okay, what's, then, p', I'm going to have to calculate p'(a). What is that?
Well, let's calculate p'(D) first. It is, well, by the ordinary product rule, it's the derivative of this times, which is one times (D minus a) plus, that's one thing plus the same thing on the other side, the derivative of this, which is one times (D minus b). So, that's p prime. And therefore, what's p'(a)? It's nothing but, this part is zero, and that's a minus b.
Of course, this is not zero because it's a simple root. And, that's the proof for you if you want, that if the root is simple, that p'(a) is guaranteed not to be zero. And, you can see, it's going to be zero exactly when b equals a, and that root occurs twice. But, I'm assuming that didn't happen. Okay, then all the rest we have to do is calculate, do the calculation. So, what I want to prove now is that with this p(D), what I'm trying to calculate that p(D) x e^(ax), except I'm going to write it as e^(ax) x / p'(a).
This is my proposed particular solution. So, what I have to do is calculate it, and see that it turns out to be, what do I hope it turns out to be? What the right hand side of the equation, the input? The input is e^(ax). If this is true, then yp, a particular solution, indeed, nothing will be a particular solution. Of course, there could be others, but in this game, I only have to find one particular solution, and that certainly by far is the simple as one you could possibly find. So, I have to calculate this. And now, you see why I did the exponential shift rule because this is begging to be differentiated by something simpler than hack.
Okay, you can also see why I violated the natural order of things and put the e^(ax) on the left in order that it pass over more easily. So, the answer on the left-hand side is e to the ax times p of (D plus a). Now, what is (p of D) plus a? Write it in this form. It's going to be a - b. So, p(D + a) is, change D --> D + a. So, the first factor is going to be D + a - b. And, what's the second factor? Change D --> D + a. It turns into D. All this is the result of taking that p(D), and changing D to D plus a. And now, this is to be applied to what? Well, e^(ax) is already passed over. So, what's left is x.
And, that's to be divided by the constant, p'(a). Now, what does this all come out to be? e^(ax), what's D applied to x? One, right? And now, what's this thing applied to the constant one? Well, the D kills it, so it has no effect. It makes it zero. The rest just multiplies it by a - b. So, the answer to the top is (a minus b) times one. And, the answer to the bottom is p'(a), which I showed you by just explicit calculation is a minus b. And so the answer is, e^(ax) comes out right.
Now, the other one, the other formula comes out the same way. I'll leave that as an exercise. Also, I don't dare do it because it's much too close to the problem I asked you to do for homework. So, let's by way of conclusion, I'll do one more simple example, okay? And then, you can feel you understand something. I'm sort of bothered that I haven't done any examples of this more complicated case. So, I'll pick an easy version instead of the one that you have in your notes, which is the one you have for homework, which is even easier.
So, this one's epsilon less easy. y'' - 3y' + 2y = e^x. Okay, notice that one is a simple root. The one I'm talking about is the a here, which is one. One is a simple root of the polynomial D^2 - 3D + 2, isn't it? It's a zero. Put D equal one and you get 1 - 3 + 2 = 0. It's a simple root because anybody can see that one is not a double root because you know from critical damping, if one were a double root, you know just what the polynomial would look like, and it wouldn't look like that at all. It would not look like D^2 - 3D + 2. It would look differently. Therefore, that proves that one is a simple root. Okay, what's the particular solution, therefore?
The particular solution is x times e to the x divided by the derivative, the derivative evaluated at the point, so, what's p prime of D? It is 2D minus three. If I evaluate it at the point, one, it is negative one. So, if this is to be divided by negative one, in other words, it's minus x e to the X. And, if you don't believe it, you could plug it in and check it out. Okay, I'm letting you out one minute early. Remember that. I'm trying to pay off the accumulated debt.