# Differential Equations and Linear Algebra, 2.6b: An Example of Method of Undetermined Coefficients

From the series: Differential Equations and Linear Algebra

OK. So can I begin with a few words about the big picture of solving differential equations? So if that was a nonlinear equation, we would go to computer solutions. And Cleve Moler is making a parallel video series about the Matlab suite of codes for solving differential equations.

Then when that equation is linear, as it is here, with constant coefficients, as like the 1, minus 3, and the 2, we can always get a formula for the answer. Involves an integral. There's still one integral to do involving the impulse response. And you'll see that.

But there are few, the most beautiful, the most simple equations when the right-hand side has a special form. And that's one possibility-- t, or t squared we could deal with, or e to the t. We'll see all those. Then we know what the solution looks like.

For example-- first of all, we know the null solutions, of course. That's when this is 0. And then I just wrote for e to the st, and I find s could be 1 or s could be 2. Those are two solutions with right side 0. So we can match initial conditions. But we need a particular solution.

And that's where this one is especially simple. So the idea is to try the form we know the solution will have. So I'm going to try a particular solution. When I see a t there, I'll want a t in the particular solution. But I also need the constant term. So I'll try a plus bt.

What I mean by try is put that into the equation, match the left side and the right side, and we have a solution. And I'll just go ahead and do that. So there's several-- this video is mostly about the list of possible nice functions. And that's one of them.

OK. So if I put that into the equation, the second derivative is 0 for that. So I have minus 3. The first derivative is just b. Then I have plus 2 times y itself, which is a plus bt. So the left side of the equation is just this much. And it has to equal 4t.

And that we can make happen. I see 2bt and 4t here, so I want b equal to 2. And so when b is 2, then I have 4t matching 4t. And then I have minus 3b plus 2a should be 0. Minus 3b plus 2a, the constant part there we don't want, so that should be 0. We already know b is 2, so that's minus 6 plus 2a. a is 3. a is 3.

Now, that's perfectly satisfied by b equal 2a equal 3, and that's the answer. Correct answer is b was 2, a was 3, and we don't have to say try anymore. We got it. Done.

One other right-hand side. Once you get a nice one like this, you look for more. If it was t squared, we would assume-- what would we assume if it was a 4t squared there? We would assume a plus bt plus ct squared. We want to match the right-hand side.

Now, a different type of right-hand side we know already. What if this was e to the-- say, e to the 3t? Or e to the st. Let me put any exponent there for the moment. So now we have a different right-hand side. A very nice function. The best function of differential equations.

And now what we will try with this right-hand side, e to the st. We've seen it before. The particular solution is just y e to the st. The undetermined coefficients were a and b in the first time. Here the undetermined coefficient is capital Y. I'm just going to plug that into the equation and match the left side and right side. And I'll determine this coefficient, capital Y.

So what happens when I put that into the equation? I get second derivative brings down an s squared, and first derivative, we have a minus 3. The first derivative brings down an s, and I have plus 2. All that is Y e to the st, right? I put in Y e to the st. The derivatives brought down this familiar polynomial. And it's all supposed to match e to the st.

We can do that. That's a perfect match. The left side has the same form as the right side. I can cancel the e to the st's, and I discover that Y is 1 over s squared minus 3s plus 2. Good. That's the coefficient, 1 over that.

Let's see. I have to make two comments. One comment is that s-- we're totally golden if that s is imaginary. If s is i omega, well, minus i omega, or both, both possibilities, those will give us sine and cosine. So we'll add those to the nice function.

So the nice functions are t, polynomials. E to the st, exponentials. Sines and cosines. And you see this worked perfectly. Well, perfectly except we have to be sure that we don't have 1/0.

When would we have 1/0? If s is 1, this would be 1 minus 3 plus 2, that would be 1/0. I can't deal with s equal 1 with that assumption. Doesn't work. Also, s equal 2. What's special about s equal 1 and s equal 2? Those make that 0. They give the null solutions.

And I know that if this happened to be e to the t, and a null solution was also e to the t, I have to fix the particular solution by giving it an extra factor t. Let me do that at the end of the lecture. That's the resonance idea, where my null solution is the same as what I hope for the particular solution. So I have to change that particular solution with an extra factor t.

Let me keep going here to be sure we get all the possibilities. Again, we're getting a very small set of nice functions. But fortunately, they appear quite often in applications. Constants, linear like 4t, exponentials like e to the 5t, oscillation like e to the i omega t. So let me make a list.

So polynomials, like the forcing function could be t, could be 1. Constant, that would be like a ramp. That would be like a step function. They could be 3 to the st, but not s equals 1 and 2 in this problem. They could be e to the i omega t, and e to the minus i omega t, which leads me directly to cosine of omega t and sine of omega t.

I'm creating here a list of the nice functions-- polynomials, exponentials, cosine and sine, because those come from exponentials, and finally, I can multiply these. I could have, for example, t e to the st. I could allow that. And now, all I have to do is tell you, what form do I try to plug-in?

The form will have undetermined coefficients. I'll substitute in the equation, and I'll determine the coefficients. So here we saw a plus bt. That was good. That was the Y. Here we saw Y e to the st. That was good.

Here, what will I have? If I have cosine, I need the sine there also. So I'll have to allow a combination of those. Say M on this plus N of that. If I tried to do cosines alone, I would be in danger of taking the derivative, getting a sine, and having nothing to match. So I'll take that.

Now, final question, or next question is, if I multiply two of these, the product rule is still going to tell me that derivatives of that have the same form as that. Derivatives of this t e to the st have the same-- they also involve t or e to the st, with factors s, from the product rule.

So what do I assume here? Well, when I see t there, I have to include, as I did up there, also constants. And if I saw a t squared, I would go up to t squared. I'd have three coefficients. Now, that e to the st, I can keep.

So what I've put on the right-hand side is the right form to assume. It's just like good advice. Put that into the differential equation when this is the right-hand side. Match left side with the right side. That will tell you a and b. And you have the answer. You have the particular solution. You have a particular solution, and that's what you wanted.

OK. And if I had t cosine omega t, do you want to see in the whole business? If I had t cosine omega t-- oh dear, it's getting a little messy. I'd need an a plus bt to deal with the t. And I'd need a cosine to deal with the cosine.

And then, just to make the problem a little messier, can't be helped, I'd need the sine. So I need a sine omega t. And I'm going to need a c plus dt there. OK. I'm up to four coefficients to determine by plugging in. It uses more ink, but it doesn't use more thinking. You just put it in, match all terms, and you discover A, B, C, and D.

Finally, I have to say that word about resonance that I mentioned earlier. The possibility that if s happened to be 1 or 2 on the right-hand side, that's also a null solution. This method would give me 1/0, infinite answer, no good. And we know what to do.

We know how to deal with resonance. So with resonance-- so could I just finally complete the whole story. Resonance. In this example, s equal 1 or 2. What would I do with f of t equals e to the t? If that was the right-hand side, that would give me resonance.

It's got the exponent s equal 1, which is also in the null solution, e to the t. So what do I try? So I try-- everybody knows what happens when there's resonance. When you have this doubling up. You need an extra factor t to rescue. So you would try y of t. y, this is the particular solution I'm looking for.

You would try t e to the t, with a Y. And you would plug that in. You would find the right number for capital Y. And you'd have the particular solution. Only, I think, doing a few examples of this, you get the knack of assume the right form, put it into the equation, match left side with right side, and that reveals the undetermined coefficients. It tells you what a and b and capital Y and c and d, tells you what they all have to be.

So this is a really good method that applies to really nice right-hand sides. Good. Thanks.