Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Y + y = sin(x)

  1. Feb 19, 2012 #1
    y" + y = sin(x)

    1. The problem statement, all variables and given/known data
    Solve y" + y = sin(x) for y=y(x) using the method of undetermined coefficients

    2. Relevant equations

    3. The attempt at a solution
    The homogeneous solution Yh = Asin(x) + Bcos(x)

    The particular solution Yp = Csin(x).

    Y''p = -Csin(x)
    Y''p + Yp = -Csin(x) + Csin(x) = 0

    No C exists to make Y''p + Yp = sin(x) for all x

    What am I doing wrong?
  2. jcsd
  3. Feb 19, 2012 #2
    Re: y" + y = sin(x)

    because the sin(x) gives an undetermined coefficient set {sin(x), cos(x)} and a member of this set (in this case both) satisfies the homogeneous solution Yh = Asin(x) + Bcos(x), you must multiply every member of the UC set by x. So now your UC set is {xsinx, xcosx}

    Does that make sense? I tried to follow your notation pattern, mine is slightly different.
  4. Feb 19, 2012 #3
    Re: y" + y = sin(x)

    Thanks for the help. I thought it might be something along those lines but I still get a trivial answer:

    Yp = Csin(x) + Dcos(x)
    y''p = -Csin(x) - Dcos(x)

    y''p + Yp = (C-C)sin(x) + (D-D)cos(x) = 0

    Wait, I just read what you wrote a little more carefully and noticed the extra "x" in the set {xsin(x), xcos(x)}

    a) Where does this "x" come from?
    b) Does this mean I chose a particular solution of the form C(x)sin(x) + D(x)cos(x)?
  5. Feb 19, 2012 #4
    Re: y" + y = sin(x)

    Perhaps my biggest downfall is not really understanding what I am doing, just doing it. Aka, I'm an algorithm applier. So, I cannot tell you where the x comes from, only that you need to multiply every term in the UC set by x if one member of the UC set will satisfy the "complementary" part of the solution. Lets level on notation and terms first so we are sure to be talking about the same things here, especially with the terms being similar in multiple parts.
    Your solution will be of the form [itex] y=y_c+y_p [/itex] where [itex] y_c [/itex] is the "complementary" part and [itex] y_p [/itex] is the "particular" part. I am using the method of undetermined coefficients from section 4.6 in my book, but they are presented in 4.5 as well, where 4.5 uses a more elementary technique. I never did section 4.5, so hopefully you and I are on the "same page" lol...

    For my notation, I would first say [itex] y_c=C_1\cos{x} +C_2\sin{x} [/itex]
    Then, the sinx in the original problem gives a UC set of {sinx, cosx}. Since I see those terms in my [itex] y_c [/itex] equation, I must multiply the set by x, getting {xsinx, xcosx}.
    Now, I will find [itex] y_p [/itex]
    [itex] y_p=Ax\sin{x} +Bx\cos{x} [/itex]
    and then you do [itex] Ax\sin{x} +Bx\cos{x} = \sin{x} [/itex] and solve all that jazz for A and B

    EDIT: Err, I mean you take the derivative two times and do all that jazz to find A and B, you know what I mean?

    So, does that help clarify everything? Sorry I cant tell you why, just what and how.
    Last edited: Feb 19, 2012
  6. Feb 19, 2012 #5


    Staff: Mentor

    Re: y" + y = sin(x)

    The explanation is on the longish side. It has to do with how you deal with repeated roots of the characteristic equation.

    Here is the short version. If the characteristic equation of the DE has a factor (x - r), then the associated solution set of the homogeneous equation contains erx. If the characteristic equation has a repeated factor (x - r)2, then the associated solution set of the homogeneous equation contains erx and xerx.

    Similarly, if there is a repeated factor (x - r)3, the solution set contains erx, xerx, and x2erx.

    This pattern continues in the same way.
    No, if your notation is what I think it is. I am interpreting C(x) and D(x) as functions of x. What you want is Cxsin(x) + Dxcos(x) for your particular solution.
  7. Feb 19, 2012 #6
    Re: y" + y = sin(x)

    Yes, what you are saying makes sense. I don't expect a full answer to "why" in the thorough sense, but what you're saying is that because Yp happens to be the same as Yh (or Yc in your notation) in that it is some linear combination of sin(x) and cos(x), you have to multiply the x through Yp to get some new expression to work with.

    Unfortunately, I'm still not getting the right answer. This approach reduces to:
    Y''p + Yp = (A+B)cos(x) + (A-B)sin(x) = sin(x)
    This tells me that A+B=0 and A-B=1? That can't be.
  8. Feb 19, 2012 #7
    Re: y" + y = sin(x)

    If I understand you correctly, this is an explanation of the methods for finding Yh. There are 3 cases:
    #1: roots m and n are real and distinct --> y=Ae^mx + Be^nx
    #2: roots are real and equal m --> y=e^mx(A+Bx)
    #3: roots are complex a+bi and a-bi --> y=e^ax[Acos(bx)+Bsin(bx)]

    This is an example of case 3 but I'm not having trouble with the homogeneous solution (Yh or Yc). I'm having trouble with the particular solution Yp.

    And yes, my notation was off in the expression "C(x)sin(x) + D(x)cos(x)" I meant a constant C or D times x, not functions of x; C(x) and D(x)
  9. Feb 19, 2012 #8
    Re: y" + y = sin(x)

    I got A=0 and B=-1/2
    Maybe you did a derivative wrong?
    What did you have for y''p?
  10. Feb 19, 2012 #9
    Re: y" + y = sin(x)

    Something wrong (see attached)

    Attached Files:

  11. Feb 19, 2012 #10
    Re: y" + y = sin(x)

    your yp' is okay but you make a couple mistakes getting to yp''
  12. Feb 19, 2012 #11
    Re: y" + y = sin(x)

    I got it now. I forgot to differentiate the 3rd and 6th term in the step from Yp' to Y''p.

    Thanks for your help!
  13. Feb 19, 2012 #12
    Re: y" + y = sin(x)

    glad to procrastinate from my own diffy-q :)
  14. Feb 19, 2012 #13


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    Re: y" + y = sin(x)

    In terms of the derivative operator D, your differential equation can be written as $$(D^2+1)y = \sin x.$$ If you apply (D2+1) one more time, you get
    $$(D^2+1)(D^2+1)y = (D^2+1)\sin x = 0.$$ Why would you want to do this? Because (D2+1) annihilates the forcing function sin x, leaving you with a homogeneous equation, y'''' + 2 y'' + y = 0, which you know how to solve. The characteristic equation has repeated roots, so you'll find that y has the form
    $$y(x) = Ax\sin x+Bx\cos x+C\sin x + D\cos x.$$ The last two terms correspond to the homogeneous solution of the original differential equation; the first two terms, to the particular solution.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook