If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Undetermined coefficients 4

Putting it all together! Created by Sal Khan.

Want to join the conversation?

  • leaf green style avatar for user Rodrigo Braz
    Hello! I'm an engineering student and had an exam with an undetermined coefficients exercise I couldn't solve using this method. Can you help me noticing where I went wrong?

    Problem was: y'' + 4y = sin(2x)

    I went ahead and predicted the solution in the form of Asin(2x) + Bcos(2x). I figured the 1st and 2nd derivative, and replaced them in the equation:

    (-4Asin(2x) - 4Bcos(2x)) + 4(Asin(2x)+Bsin(2x)) = 1sin(2x) + 0cos(2x)

    Since all the A's and B's even out, I can't get past this. Thanks!
    (12 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user jhibdon
      Always start by solving the homogeneous equation of the differential equation;y'' + 4y = 0 which has solutions of y_h = c_1cos(2x) + c_2 sin(2x)

      Then start by assuming the particular solution as you mentioned:
      y_p = Asin(2x) + Bcos(2x),
      however this will not work because both predicted solutions are homogeneous solution. Similar to when you have repeated roots you need to multiply each function by x, so the predicted solution should be
      y_p = Axsin(2x) + Bxcos(2x)
      (26 votes)
  • male robot hal style avatar for user gabriel savage
    How about the topic of variation of parameters?
    (23 votes)
    Default Khan Academy avatar avatar for user
  • female robot grace style avatar for user Rohit Bisht
    what if we had (e^2x)*(sin2x)*(4x^2) on RHS?
    (10 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Laila Tribelhorn
    Hi I am a first year Applied Mathematics student. This is really helpful so thanks so much for that. I was really wondering what you would do if you had xsinx on the right hand side as opposed to simply some constant multiplied by the sinx? Thanks so much. This is coming from South Africa
    (4 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user ifeaworanti
      In that case the easiest way to go about it is:
      Realize that x is a polynomial like X^2
      So the solution for a differential equation for it will be X+C
      and for sin x you know its= Asinx+BcosX so multiply the two.
      you get a function that might work . Am not sure.
      On second thought
      The best way to generalize it is that When you have a non-homogeneous equation the particular solution is usually A constant times the function + another Constant times the function's derivative+another other constant times the next derivative until you reach a constant-0- or until you stop getting new euaton forms like in trig. functions then combine like terms and turn any constant you might get to letters. This is the general form of the particular equation And if you look back that rule works.
      so for Y=xsinx
      Y'=sinx-xcosx
      y''=cosx-cosx+xsinx
      you can keep deriving for fun, combine the like terms and you will see that the particular solution is of the form : Axsinx+Bxcosx+Dsinx+Ecosx
      Hopefully that works. i should go try it out and get back....
      LONG WINDED! SORRY!
      (10 votes)
  • old spice man green style avatar for user Bruno Morais
    Where can I find the "next video" with another method for solving nonhomogenous d.e. mentioned in ?
    (6 votes)
    Default Khan Academy avatar avatar for user
  • purple pi purple style avatar for user sarga95
    how we can integrate e^x/1+e^2x
    (1 vote)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Yamanqui García Rosales
      You need to use trigonometric substitution, to know what trigonometric substitution to use you need some practice, since this integral has the form a + x^2, we need to use the following substitution:
      e^x = tan(θ)
      And we need to get the differential of this substitution, so we derivate both sides:
      e^x dx = sec^2(θ) dθ
      And now we substitute this into the integral:
      ⌠     e^x         ⌠   sec^2(θ)        ⌠ sec^2(θ)
      | ―――――――――― dx = | ―――――――――――― dθ = | ―――――――― dθ = ∫dθ = θ + C
      ⌡ 1 + e^(2x) ⌡ 1 + tan^2(θ) ⌡ sec^2(θ)

      After using the trigonometric identity 1 + tan^2(θ) = sec^2(θ) the integral simplifies a lot, and we get our first result θ + C.
      Now we need to go back to our original substitution and solve for θ.
      e^x = tan(θ)
      arctan(e^x) = arctan(tan(θ))
      arctan(e^x) = θ

      And with this we get the final solution:
      ⌠     e^x
      | ―――――――――― dx = arctan(e^x) + C
      ⌡ 1 + e^(2x)
      (5 votes)
  • blobby green style avatar for user Skyler Newcomb
    What if we were to go simple, such as: y''-10y'+25y=30x+3?? I end up with three variables and i do not know of a way to solve it.
    (1 vote)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user Miguel Moitinho
      General solution is:
      Yg = C1*e^(5x)

      Consider that the particular is a polynomial of the form:
      Yp = Ax + B
      Yp' = A
      Yp" = 0

      0 - 10A + 25(Ax+B) = 30x + 3
      25Ax -10A+25B = 30x + 3
      Therefore you get two equations with two variables:
      | 25A = 30
      | -10A+25B = 3
      solved is...
      | A = 30/25 = 6/5
      | B = 3/5

      So the particular solution is...
      Yp = (6/5)x + 3/5
      (5 votes)
  • blobby green style avatar for user Emily McNeil
    So after watching the whole series on undetermined coefficients, I'm still stumped by (and this may be silly) the special case where g(x) is equal to a constant (not a constant function, just a constant). What form does the particular solution take when the equation looks like y'' - 3y' -4y = 6?

    I have a feeling the answer is very simple, but I can't find a concrete answer. Thank you in advance!
    (2 votes)
    Default Khan Academy avatar avatar for user
    • leaf red style avatar for user Rahul Paleja
      Your particular solution would just take the form A. So then y' = 0 and y''=0. Then, plugging in y'', y', and y into y''-3y'-4y, we get -4A = 6. Thus A= -3/2 or -1.5. Your general solution would come be y(t) = c1 * e^(-t) + c2* e^(4t). Putting both solutions together, we get y(t) = c1 * e^(-t) + c2* e^(4t) - 1.5.

      Hope this helps.
      (2 votes)
  • purple pi purple style avatar for user sarga95
    how we can solve D(D-1)y+Dy+y=Sin(logx^2)
    (1 vote)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user lada.kuletskaya
    Hi! What if g(x)=tan(k*x)? Seems not so easy to predict 'cause of the form of the derivative of tan(kx)
    (2 votes)
    Default Khan Academy avatar avatar for user

Video transcript

Before we move on past the method of undetermined coefficients, I want to make and interesting and actually a useful point. Let's say that I had the following nonhomogeneous differential equation: the second derivative of y minus 3 times the first derivative minus 4y is equal to-- now this is where gets interesting-- 3e to the 2x plus 2 sine of x plus-- let me make sure that I'm doing the same problems that I've already worked on-- plus 4x squared. So you might say, wow, this is a tremendously complicated problem. I have the 3 types of functions I've been exposed to, I would have so many undetermined coefficients, it would get really unwieldy. And this is where you need to make a simplifying realization. We know the three particular solutions to the following differential equations. We know the solution to the second derivative minus 3 times the first derivative minus 4y. Well, this is this the homogeneous, right? And we know that the solution to the homogeneous equation-- we did this a bunch of times-- is C1e to the 4x plus C2e to the minus x. We know the solution to-- and I'll switch colors, just for a variety-- y prime prime minus 3y prime minus 4y is equal to just this alone: 3e to the 2x. And we saw that that particular solution there, y particular, was minus 1/2 e to the 2x. And we did this using undetermined coefficients. We did that a couple of videos ago. And then let me just write this out a couple of times. We know the solution to this one, as well. This was another particular solution we found. I think it was two videos ago. And we found that the particular solution in this case-- and this was a fairly hairy problem-- was minus 5/17 x plus 3/17. Sorry. The particular solution was minus 5/17 sine of x plus 3/17 cosine of x. And then finally this last polynomial, we could call it. We know the solution when that was just the right-hand side. That was this equation. And there we figured out-- and this was in the last video. We figured out that the particular solution in this case was minus x squared plus 3/2 x minus 13/8. So we know the particular solution when 0's on the right-hand side. We know it when just 3e to the 2x is on the right-hand side. We know it just when 2 sine of x is on the right-hand side. And we know it just when 4x squared is on the right-hand side. First of all, the particular solution to this nonhomogeneous equation, we could just take the sum of the three particular solutions. And that makes sense, right? Because one of the particular solutions, like this one when you put it on the left-hand side, it will just equal this term. This particular solution, when you put it in the left-hand side, will equal this term. And finally, this particular solution, when you put it on the left-hand side, will equal the 4x squared. And then you could add the homogeneous solution to that. You put it in this side and you'll get 0. So it won't change the right-hand side. And then you will have the most general solution because you have these two constants that you can solve for depending on your initial condition. So the solution to this seemingly hairy differential equation is really just the sum of these four solutions. Let me clean up some space because I want everything to be on the board at the same time. So the solution is going to be-- well, I want that to be deleted. I'll do it in baby blue. Is going to be the solution to the homogeneous C1e to the 4x plus C2e to the minus x minus 1/2 e the to 2x. And I'll continue this line. Minus 5/17 sine of x plus 3/17 cosine of x minus x squared plus 3/2 x minus 13/8. And it seems daunting. When you saw this, it probably looked daunting. This solution, if I told you this was a solution and you didn't know how to do undetermined coefficients, you're like, oh, I would never be able to figure out something like that. But the important realization is that you just have to find the particular solutions for each of these terms and then sum them up. And then add them to the general solution for the homogeneous equation, if this was a 0 on the right-hand side. And then you get the general solution for this fairly intimidating-looking second order linear nonhomogeneous differential equation with constant coefficients. See you in the next video, where we'll start learning another method for solving nonhomogeneous equations.