# Undetermined coefficients 1

## Video transcript

We're now ready to solve non-homogeneous second-order linear differential equations with constant coefficients. So what does all that mean? Well, it means an equation that looks like this. A times the second derivative plus B times the first derivative plus C times the function is equal to g of x. Before I show you an actual example, I want to show you something interesting. That the general solution of this non-homogeneous equation is actually the general solution of the homogeneous equation plus a particular solution. I'll explain what that means in a second. So let's say that h is a solution of the homogeneous equation. And that worked out well, because, h for homogeneous. h is solution for homogeneous. There should be some shorthand notation for homogeneous. So what does that mean? That means that A times the second derivative of h plus B times h prime plus C times h is equal to 0. That's what I mean when I say that h is a solution-- and actually, let's just say that h is the general solution for this homogeneous equation. And we know how to solve that. Take the characteristic equation depending on how many roots it has and whether they're real or complex. You can figure out a general solution. And then if you have initial conditions, you can substitute them and get the values of the constants. Fair enough. Now let's say that I were to say that g is a solution. Well no, I already used g up here. Well, I don't like using vowels. Let's say j. Let's say j is a particular solution to this differential equation. So what does that mean? That means that A times j prime prime plus B times j prime plus C times j is equal to g of x. Right? So we're just defining j of x to be a particular solution. Now what I want to show you is that j of x plus h of x is also going to be a solution to this original equation. And that it's the general solution for this non-homogeneous equation. And before I just do it mathematically, what's the intuition? Well, when you substitute h here, you get 0. When you substitute j here, you get g of x. So when you add them together, you're going to get 0 plus g of x here. So you're going to get g of x here. And I'll show you that right now. So let's say I wanted to substitute h plus j here. And I'll do it in a different color. A-- so the second derivative of the sum of those two functions is going to be the second derivative of both of them summed up-- plus B times the first derivative of the sum plus C times the sum of the functions. And my goal is to show that this is equal to g of x. So what is this simplified to? Well if we take all the h terms, we get Ah prime prime plus Bh prime plus Ch plus, let's do all the j terms. Aj prime prime plus Bj prime plus Cj. Well by definition of how we defined h and j, what is this equal to? We said that h is a solution for the homogeneous equation, or that this expression is equal to 0. So that equals 0. And by our definition for j, what does this equal? We said j is a particular solution for the non-homogeneous equation, or that this expression is equal to g of x. So when you substitute h plus j into this differential equation on the left-hand side. On the right-hand side, true enough, you get g of x. So we've just shown that if you define h and j this way, that the function, we'll call it k of x is equal to h of x plus j of x. I'm running out of space. That is the general solution. I haven't proven that is the most general solution, but I think you have the intuition, right? Because the general solution on the homogeneous one that was the most general solution, and now we're adding a particular solution that gets you the g of x on the right-hand side. That might be very confusing to you, so let's actually try to do it with some real numbers. And I think it'll make a lot more sense. Let's say we have the differential equations-- and I'm going to teach you a technique now for figuring out that j in that last example. So how do you figure out that particular solution? Let's say I have the differential equation the second derivative of y minus 3 times the first derivative minus 4 times y is equal to 3e to the 2x. So, the first step is we want the general solution of the homogeneous equation. And in that example I just did, that would have been our h of x. So we want the solution of y prime prime minus 3y prime minus 4y is equal to 0. Take the characteristic equation. This 4 is equal to 0. r minus 4 times r plus 1 is equal to 0. 2 roots, r could be 4 or negative 1. And so our general solution-- I'll call that h. Well, let's call that y general. y sub g. So our general solution is equal to-- and we've done this many times-- C1 e to the 4x plus C2 e to the minus 1x, or minus x. Fair enough. So we solved the homogeneous equation. So how do we get, in that last example, a j of x that will give us a particular solution, so on the right-hand side we get this. Well here we just have to think a little bit. And this method is called The Method of Undetermined Coefficients. And you have to say, well, if I want some function where I take a second derivative and add that or subtracted some multiple of its first derivative minus some multiple of the function, I get e to the 2x. That function and its derivatives and its second derivatives must be something of the form, something times e to the 2x. So essentially we take a guess. We say well what does it look like when we take the various derivatives and the functions and we multiply multiples of it plus each other? And all of that. We would get e the to 2x or some multiple of e to the 2x. Well, a good guess could just be that j-- well I'll call it y particular. Our particular solution here could be that-- and particular solution I'm using a little different than the particular solution when we had initial conditions. Here we can view this as a particular solution. A solution that gives us this on the right-hand side. So let's say that the one I pick is some constant A times e to the 2x. If that's my guess, then the derivative of that is equal to 2Ae the to 2x. And the second derivative of that, of my particular solution, is equal to 4Ae to the 2x. And now I can substitute in here, and let's see if I can solve for A, and then I'll have my particular solution. So the second derivitive, that's this. So I get 4Ae to the 2x minus 3 times the first derivitive. So minus 3 times this. So that's minus 6Ae to the 2x minus 4 times the function. So minus 4Ae to the 2x, and all of that is going to be equal to 3e to the 2x. Well we know e to the 2x equal 0, so we can divide both sides by that. Just factor it out, really. Get rid of all of the e's to the 2x. On the left-hand side, we have 4A and a minus 4A. Well, those cancel out. And then lo and behold, we have minus 6A is equal to 3. Divide both sides by 6 and get A is equal to minus 1/2. So there. We have our particular solution. It is equal to minus 1/2 e to the 2x. And now, like I just showed you before I cleared the screen, our general solution of this non-homogeneous equation is going to be our particular solution plus the general solution to the homogeneous equation. So we can call this the most general solution-- I don't know. I'll just call it y. It is our general solution C1e to the 4x plus C2e to the minus x plus our particular solution we found. So that's minus 1/2e to the 2x. Pretty neat. Anyway, I'll do a couple more examples of this. And I think you'll get the hang of it. In the next examples, we'll do something other than an e to the 2x or an e function here. We'll try to do stuff with polynomials and trig functions as well. I'll see you in the next video.