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

Second Order Nonhomogeneous Linear Differential Equations

  1. Jan 24, 2004 #1

    I am having trouble understanding how to solve second order nonhomogeneous linear differential equations. I know how to solve second order homogeneous linear differential equations. But I am not following in the lecture and in the text the method of variation of parameters to solve second order nonhomogeneous linear differential equations.

    For one's information I am using the text Calculus, 4th edition by James Stewart and the chapter is 18 and the section is 2. The page is 1170 for anyone familiar with this text.

    Any help with this method would be appreciated. Thankyou.
  2. jcsd
  3. Jan 25, 2004 #2
    Give us some doubts/pro u are facing we will explain u via the Ex
  4. Jan 25, 2004 #3
    Right. Here is an example from the text:

    Solve the equation

    y'' + y = tan x, 0 < x < pi/2

    Now I know how to find the auxiliary equation

    r^2 + 1 = 0

    with roots

    +i and - i.

    So the solution of

    y'' + y = 0 is

    c1 sin x + c2 cos x.

    This is my general solution for the homogeneous equation. I know that finding the general solution of a nonhomogeneous linear differential equation of second order contains a particular solution ysubp of the nonhomogeneous equation and the general solution of the homogeneous equation (the complementry equation ysubc).

    So the next step is to find the particular solution of the nonhomogeneous linear differential equation of second order.
    Using variation of parameters, I seek a solution of the form

    ysubp(x) = usub1(x)sinx + usub2(x)cosx.

    I then take the derivative of ysubp to get

    y'subp = (u'sub1 sinx + u'sub2 cosx) + (usub1 cosx - usub2 sin x)

    I then set

    (u'sub1 sinx + u'sub2 cosx)= 0 ( I am not entirely clear why I do that)

    then take the derivative of y'subp (second derivative). And get

    y''subp = u'sub1'cosx - u'sub2 sinx - usub1 sinx - usub2 cosx

    For ysubp to be a solution we must have

    y''subp + ysubp = u'sub1 cosx - u'sub2 sinx = tan x.

    This is achieved by subbing into the equation to be solve ysubp and y''subp.

    From here I am not sure what to do. The text says to solve the previous equations

    (u'sub1 sinx + u'sub2 cosx)= 0


    y''subp + ysubp = u'sub1 cosx - u'sub2 sinx = tan x.

    But I am not sure how to do that and I am not sure why I am doing that. I am having trouble following the text because it skips a few "elementry steps" (which would of course make things clearer for me). And the theory before it is brief and not entirely clear.

    Would this be sufficient for now? I can elaborate some more. Detailed explanations would be appreciated. No elementry steps should be assumed or skipped. Sometimes it is the elementry steps that cause me trouble.

    As said before this is in the above text if anyone has it available to them.

    Any help is appreciated. Thankyou.
  5. Jan 25, 2004 #4
    it's been ten years since i've done this but i'll give it a shot.

    first of all, i think you are free to set (u'sub1 sinx + u'sub2 cosx) equal to anything, as it is an asumption, i think, and a useful assumption that leads to solutions. not sure about the deeper reasons behind this assumption yet; it probably has to do with linear algebra and "linear independence" so you can't know much more than "it works" yet. but it gives you two equations and two unknowns: u1 and u2. it's a system of first order differential equations, a reduction from a second order. though now there are two equations.

    let's look at it this way, and i'm going to assume you did all the derivatives right because i didn't check those:
    u1' sinx + u2' cosx=0
    u1' cosx - u2' sinx=tanx.

    same idea in a system of linear equations: pick an equation and solve for a variable and then substitute it back. our approach will be the same except that we'll solve for u1' and u2' first and then integrate. then the final step is to say that y=u1sinx+u2cosx is a particular solution.

    the first equation lets you solve for u1' in terms of u2':
    u1' sinx=-u2'cosx, then divide by sinx to get
    u1'=-u2' cotx. (cot=cos/sin)

    now sub into the equation u1' cosx - u2' sinx=tanx to get:
    (-u2' cotx) cosx - u2' sinx=tanx
    -u2' cotx cosx - u2' sinx=tanx. now what do we have to do?

    solve for u2'.

    let's get rid of - and factor out u2':
    u2' (cotx cosx + sinx)=-tanx
    so u2'=-tanx/(cotx cosx + sinx).

    you may have the feeling that we should simplify it.

    one thing that often works for trig is changing everything to sine and cosine:
    u2'=-(sinx/cosx)/((cosx/sinx) cosx + sinx)

    there are a number of ways you can handle this but what smells best to me is to multiply by sinx/sinx:
    u2'=-(sin2x/cosx)/((cosx) cosx + sin2x).

    now (cosx) cosx + sin2x=1 by trig identity so we have:

    remember that u1'= -u2' cotx, so
    u1'=-(-(sin2x/cosx)) cotx. since cot=cos/sin, we get

    at this point, we must solve for u1 and u2 by integrating. u1=-cosx but u2 is harder. i'm going to let you look that one up (you may want to convert to -sinx tanx). assuming you get an integral for u2, let's just call it u2 and use u1=-cosx.

    yp=-cosx sinx+u2 cosx is a particular solution. then the general solution is y=yp+c1 sinx +c2 cosx.

    i'm suspecting since that integral is not nice that a calculation is wrong somewhere in what you did but if it's all correct, this is the solution i get with mathematica's dsolve command which took about 0.01 seconds.

    let F(y)=y''+y. the ultimate goal is to find a y such that F(y)=tanx. but let's look at our solution which has the form yp + c1 sinx + c2 cosx. F distributes over addition, so
    F(yp + c1 sinx + c2 cosx)=F(yp)+F(c1 sinx + c2 cosx)=tanx+0. this can be generalized to whenever the F distributes over addition: find a particular solution and add that to the homogeneous solution "space." that looks like a coset to me which means there's some kind of modular spaces involved unless i'm off my rocker.
    Last edited: Jan 25, 2004
  6. Jan 25, 2004 #5


    User Avatar
    Science Advisor

    Remember that there are an infinite number of solutions to the entire equation and you are seeking only one of them. You are free to put restrictions on your "search" as you please. That's why you can do it. You want to do it because it removes all first derivatives from the equation so when you differentiate again, to get the second derivative, your formula has only first derivatives in it.

    Because you cleverly chose to use solutions to the homogeneous equation as coefficients when you substitute into the original equation, all terms that do not involve the derivative of u1 or u2, will give 0 (think about that: not differentiating them, they might as well be constants and constants times solutions to the homogeneous equation will give 0).

    The point is that you now have two equations:
    u'1 sinx + u'2 cosx= 0 and
    u'1 cosx - u'2 sinx = tan x to solve for u'1 and u'2.
    The why should be obvious! Because if you know them you will be able to substitute into your formula for the solution to the equation! The how is also (relatively) easy. Although these are dervatives, since the equation involve only first derivatives you can treat them as two (linear) algebraic equations. Solve them exactly the way you would any pair of linear equations.
    For example, multiply the first equation by sin(x) and the second equation by cos(x) and add and the u'2 terms cancel out leaving u'1= sin(x). Now integrate: u1(x)= -cos(x). That was easy!
    If you multiply the first equation by cos(x) and the second by sin(x) and subtract, the u'1 terms cancel out leaving u'2= -tan(x)sin(x)= -sin2(x)/cos(x).

    That's a little harder to integrate but still possible. Once you have found u1 and u2 (since your are seeking only a single solution, you can ignore the constants of integration), put them back into y(x)= u1sin(x)+u2cos(x) to get the specific solution you need to add to the solution to the homogeneous equation.
  7. Jan 27, 2004 #6
    Many thanks go out to pheonixtoth and HallsofIvy for their replies.

    Thanks to pheonixtoth for showing the step by step procedure. I tried to get fancy and solve the system of two equations by using matrix calculations and got into trouble. I then tried to solve it the conventional way but I was making tiny mistakes still which prevented me from solving for usub1 and usub2. As a result I couldn't follow the example in the text since I wasn't performing the correct steps. pheonix's step by step procedure allowed me to see where I was making my mistake.

    Thanks again pheonix.

    Thanks go out to HallsofIvy for explaining the "whys" of each step. I followed once again the example in the text while carefully reading HallsofIvy's explanations and was able to follow the text more closely this time. Some of the explanations cleared up some questions that I had but could not articulate while other explanations allowed me to catch some explanations in the text that I kept on missing. HallsofIvy's explanations coupled with pheonix's calculations enabled me to see why and how things were being done in the text.

    Thanks again HallsofIvy.

    Sometimes it takes me time to get back to my post. This is because I have other homework to do and other class to attend. But I always appreciate the efforts of others here in the physics forums to take the time and explain things to me, however simple they might be.

    Cheers pheonix and HallsofIvy. You both saved me a lot of frustration.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook