Main content

## Differential equations

### Course: Differential equations > Unit 2

Lesson 3: Method of undetermined coefficients# Undetermined coefficients 3

Another example where the nonhomogeneous part is a polynomial. Created by Sal Khan.

## Want to join the conversation?

- It might sound a little silly, but what happens when when you don't have 0 or f(t) on the right side, but a constant c? Do you treat c like an undetermined coeeficient, which would be then y=A, y'=1, y''=0 => A+1=c => A=1-c, if the D.E. was y''+y'+y-c=0?(14 votes)
- If you have just a constant on the right side, you can just move it to the other side and include it in your homogeneous portion.(12 votes)

- Did you half-drop a negative in substituting back in the original equation for y prime? I believe it should be +6Ax-3B(7 votes)
- No, I think it is correct as is. The "=" in the y prime equation just kind of looks like subtraction in the video. So substituting 2Ax + B into the -3y' part gives -6Ax - 3B.(11 votes)

- What if the right hand side is just x or 4x? Is it Ax+B then for the particular?(4 votes)
- Yes. The particular solution follows the form of a polynomial with degree one. Ax + B(6 votes)

- m so confused how would i guess for particular sol.?(2 votes)
- For a particular solution, you guess with the same function given on the Right Hand Side with an unknown coefficient in front.

For example, as in this one, Sal uses the base function of x^2, which is really x^2 + 0x + 0 and puts an unknown coefficient in front of each variable. Therefore, Ax^2 + Bx + C is his guess.

In past examples, if the Right Hand Side was 4e^(3x), we would guess Ae^(3x) If the Right Hand Side was sin(5x), we would guess Asin(5x) + B cos(5x)...Hope this helps!(5 votes)

- How do we solve a nonhomogeneous equation of this such. y''+4y'+4y=2cos^2x(2 votes)
- What would I do if I have to solve for Y(0)= 1.6 and Y'(0)=4. Do I apply this to the particular solution, or to the general for the homogenous or both?(2 votes)
- You would apply this to both. ( in this video, Sal starts writing "y=" at6:15. This is "the solution") You have the "y=" as your first equation, then take the derivative of that "y'=" for your second equation.

All that is left is to plug 'n' chug.

Set the first equation "y=" to 1.6, and set the second equation "y'=" to 4.

Plug in 0 for your independent variable in "y=" equation and also the "y'=" equation.

You know have 2 equations and two unknown variables, Solve for one, plug into the other equation, solve for the second, Viola!(3 votes)

- Does anyone know what skill level these problems are? Would these be basic first year uni questions?(1 vote)
- yeah , m 101% sure these videos would help and they obviously have skill level.... m studying at UET Pakistan which is of course engineering uni ... and m watching these videos for basic things and i have to say more for logics ..... bcz our maths Sir does not bother to tell us logic behind question and we are sitting like puppets ,(3 votes)

- Is it compulsory to add the general solution of homogeneous eqn in the final answer? Because the examples in the previous videos, doesn't have one.(1 vote)
- Yes, the most general solution is always the sum of the homogenous solution plus the particular solution. If you limit the answer to only the particular solution, then you are ignoring a whole family of functions that are also solutions, and when the times comes to evaluate initial conditions, you won't be able to satisfy them.(2 votes)

- Hey, what should I use as my guess for solving the equation equal to xe^2x?(1 vote)
- If the non-homogenous differential equation is equal to x*e^(2x), I would start by guessing A*x*e^(2x). Of course, if c*x*e^(2x) is already a term in the homogenous solution, then you should guess A*x^2*e^(2x).(1 vote)

- Why choose Ax^2 instead of Ax^2 + Bx + C to be the particular solution?(1 vote)

## Video transcript

Let's do another example of
solving a nonhomogeneous linear differential equation
with a constant coefficient. And the left-hand side is going
to be the same one that we've been doing. The second derivative of y
minus 3 times the first derivative minus 4 times y is
equal to-- and now instead of having an exponential function
or a trigonometric functional, we'll just have a simple--
well, it just looks an x squared term, but it's
a polynomial. Right? And you know how to solve the
general solution of the homogeneous equation
if this were 0. So we're going to focus just
now on the particular solution, then we can later
add that to the general solution of a nonhomogeneous
equation, to get the solution. So what's a good guess for
a particular solution? Well, when we had exponentials,
we guessed that our solution would be
an exponential. When we had trigonometric
functions, we guessed that our solution would be
trigonomretric. So since we have a polynomial
here that makes this differential equation
nonhomogeneous, let's guess that a particular solution
is a polynomial. And that makes sense. If you take a second-degree
polynomial, take its derivatives and add and
subtract, you should hopefully get another second-degree
polynomial. So let's guess that it is Ax
squared plus Bx plus C. And what would be a
second derivative? Well a second derivative
would be 2Ax plus B. Sorry, this is the
first derivitive. The second derivative
would be 2A. And now we can substitute back
into the original equation. We get the second derivitive,
2A minus 3 times the first derivitive. So minus 3A-- oh no, sorry. Minus 3 times this. So minus 6Ax minus 3B minus 4
times the function itself. So minus 4Ax squared
minus 4Bx minus 4C. That's just 4 times
all of that. That's going to equal
4x squared. And I'll just group our x
squared, our x and our constant terms, and then we
could try to solve for the coeficients. So let's see. I have one x squared
term here. So it's minus 4Ax squared. And then what are my x terms? I have minus 6Ax minus 4Bx. So then say plus minus
6A minus 4B times x. I just added the coefficients. And then finally we get
our constant terms. 2A minus 3B minus 4C. And all of that will
equal 4x squared. Now how do we solve
for A, B, and C? Well, whatever the x squared
coefficients add up on this side, it should equal 4. Whatever the x coefficients add
up on this side, it should be equal to 0, right? Because you can view this
as plus 0x, right? And then you could say plus
0 constant as well. So the constants should
also add up to 0. So let's do that. So first let's do the
x squared term. So minus 4A should
be equal to 4. And then that tells us that
A is equal to minus 1. Fair enough. Now the x terms. Minus
6A, minus 4B, that should be equal to 0. Right? So let's write that down. We know what A is, so
let's substitute. So minus 6 times A, so minus
6 times minus 1. So that's 6 minus 4B
is equal to 0. So we get 4B-- I'm just putting
4B on this side and then switching. 4B is equal to 6. And B is equal to-- 6
divided by 4 is 3/2. And then finally the constant
term should also equal 0, so let's solve for those. 2 times A, that's minus 2. Minus 3 times B. Well, that's minus
3 times this. So minus 9/2 minus
4C is equal to 0. So let's see. I don't want to make
a careless mistake. So this is minus 4
minus 9/2, right? That's minus 4/2 minus 9/2-- and
we could take the 4C and put it on that side--
it's equal to 4C. What's minus 4 minus 9? That's minus 13/2. Minus 13/2 is equal to 4C. 4C, divide both sides by 4, and
then you get C is equal to minus 13/8. And I think I haven't made
a careless mistake. So if I haven't, then
our particular solution, we now know. Well, let me write the
whole solution. So. And this is a nice stretch of
horizontal real estate. So let's write our solution. Our solution is going to be
equal to the particular solution, which is Ax squared,
so that's minus 1x squared. Ax squared plus Bx plus 3/2x
plus C minus 13/8. So this is the particular
solution. We solved for A, B, and C. We determined the undetermined
coefficient. And now if we want the general
solution, we add to that the general solution of the
homogeneous equation. What was that? y prime
minus 3y prime minus 4y is equal to 0. And we've solved this
multiple times. We know that the general
solution to the homogeneous equation is C1e to the 4x plus
C2e to the minus x, right? You just take the characteristic
equation r squared minus 3r minus 4. What did you get? You get r minus 4 times r plus
1, and then that's how you get minus 1 and 4. Anyway. So if this is the general
solution to the homogeneous equation, this a particular
solution to the nonhomogeneous equation. The general solution to the
nonhomogeneous equation is going to be the sum
of the two. So let's add that. So plus C1e to the 4x plus
C2e to the minus x. So there you. I don't think that
was too painful. The most painful part was just
making sure that you don't make a careless mistake
with the algebra. But using a fairly
straightforward, really algebraic technique, we were
able to get a fairly fancy solution to this second order
linear nonhomogeneous differential equation with
constant coefficients. See you in the next video.