Main content

### Course: Differential equations > Unit 2

Lesson 3: Method of undetermined coefficients# Undetermined coefficients 1

Using the method of undetermined coefficients to solve nonhomogeneous linear differential equations. Created by Sal Khan.

## Want to join the conversation?

- Where might I find a video on the Annihilator Approach? I understand that the complete solution is the sum of the homogeneous solution and the particular solution, but I would like to better understand how to use the annihilator method to find solutions.(29 votes)
- I really don't quite get why we need to go about finding a general solution to a nonhomogeneous equation, when I already have an answer that works in the particular solution. I think this needs to be explained or at least talked about, and I'm not just referring to this site but rather ALL texts I have read on DE (and that is a LOT). Why would I want extra parameters to map out all possible solutions when I am solving a specific DE? Can someone provide an example of how and when this would be helpful, i.e. when a particular solution is not enough?(6 votes)
- The particular solution is a solution but it's not the only solution.

So in addition y = -1/2 e^2x being a solution you also could have a solution like:

y = 3 e^4x + 2 e^-x - 1/2 e^2x

(and you can verify that's a solution)

So in order to express all solutions you need to include the homogeneous solution with the arbitrary constants. It's similar to integral calculus where you need to include the "+ C" on the end of your solution to express all possible solutions. The particular solution is not like an initial value problem where you are finding the one and only answer.(7 votes)

- How do we know that there are not any other general (edited) solutions to this differential equation?(6 votes)
- Differential equations in general have a whole class of solutions, each making the equality true. In the inhomogeneous linear case every solution may be expressed as a sum of an arbitrary solution to the inhomogeneous equation plus a solution to the associated homogeneous equation.

You may find a proof that such sums cover all the possible solutions in the 12th lecture of the 18.03 course: http://ocw.mit.edu/courses/mathematics/18-03sc-differential-equations-fall-2011/unit-ii-second-order-constant-coefficient-linear-equations/undetermined-coefficients/. The part of the video from 17' to 28' also includes a bit more general demonstration of what Sal shows in his video -- that such sums actually are solutions -- as well as an explanation of the "particular solution" language.

When looking for a particular solution (solution to the original, inhomogeneous equation) it's enough to find one, no matter which one. In the example we could have guessed e^(-x) - 1/2 e^(2x), checked that this is in fact a solution, and used that to write all solutions (by adding the same parametrized homogeneous solution). Nevertheless, finding even one solution doesn't always turn up to be as easy as it may sound.(3 votes)

- Anyone know where I can get a good tutorial explaining what "homogeneous" is?(2 votes)
- The formal definition is:
*f(x)*is homogeneous if*f(x.t) = t^k . f(x)*, where k is a real number. It means that a function is homogeneous if, by changing its variable, it results in a new function proportional to the original. By this definition,*f(x) = 0*and*f(x) = constant*are homogeneous, though not the only ones.(5 votes)

- What if in the original equation, instead of =g(x) I have =5 (or any other constant)?

I'd really appreciate any answer.(3 votes)- This is, in fact, still of the form g(x) where g(x) = 5 + 0*x.(3 votes)

- In case a member of the family of derivatives of the function is featured in the solution to the homogenous equation, we multiply by x till we get rid of that problem. Could someone explain why we do so?(2 votes)
- What if g(x) is a constant B. I know you can solve it using the perticular solution and homogenous solution, but when you solve it without doing that you get:

e^ax(a^2 + ba + (c-B)) = 0. Is it possible to solve it this way, and if it isn't why not?(2 votes)- If g(x) is a constant then your particular solution should be a constant. y'' and y' will be 0 so you're just solving the equation c*y = B(1 vote)

- what is Yp for D^2(y)+ 2Dy = 8x + e^(-2x);(1 vote)
- Fundamental set: {1, e^-2x}

We guess Yp1: Ax + B, but this contains an element already in the fundamental set, so we multiply by x, and then the correct form of Yp1 is Ax^2 + Bx.

We guess Yp2: Ce^-2x. but this is already contained in the fundamental set, so we multiply by x, so the correct guess for Yp2 is Cx*e^-x.

So the form of Yp: Yp=Ax^2 + Bx + Cx*e^-2x. after taking derivatives, and equating coefficients, you will find A = 2, B = -2, C = -1/2(3 votes)

- @8:38ish, what happens when the left side all adds up to 0?

ex: y''(x)-6y'(x)+9y(x)=5e^3x is the equation and my guess would be Ae^3x

i'd end up with coefficients of 9-18+9=5e^3x(2 votes)- In that case, you've proved your guess wrong by contradiction. That means you must change your guess accordingly. For example, I would change y(x) = Ae^3x to y(x) = Ae^Bx instead.

This gives y(x) = Ae^Bx, y'(x) = ABe^Bx and y''(x) = AB^2e^3x

y''(x) - 6y'(x) + 9y(x) = AB^2e^3x - 6ABe^3x + 9Ae^3x = 5e^3x

Therefore, AB^2 - 6AB + 9A = 5.

Solving for A, we have A = 5/(B - 3)^2; B =/= 3

That's it. Hope that helps!(1 vote)

- can we have multiple answer for the same solution base on different guess ?(2 votes)
- When Sal says that we have to "guess" for a particular solution, he means that there is no stablished procedure to obtain the proposed solution, other than practice and experience.

If for example you have guessed that the solution would be a linear equation, then when you tried to substitute and the equal your solution into the differential equation, you would notice that it's impossible to make that solution work, so you would have to go back to the beginning, mark that "guess" as a wrong guess, and try again with a different one.

The "guess" that Sal presented is the only correct one for this particular differential equation.(1 vote)

## 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.