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

Homework Help: ODEs - 2questions

  1. Dec 31, 2005 #1
    :tongue2: Hi all,

    I'm new here and was wondering whether anyone could give me a hint on the following two problems about ODEs (oh...and also, can anyone tell me where can I find this formula editor?):

    Problem 1

    find the solution for
    dy/dx + y = y^2 (cosx - sinx)

    try substitution: f = y^n
    so: dy/dx = 1/(n*y^(n-1)) * df/dx

    so ODE becomes

    df/dx + ny = ny^(n+1)(cosx - sinx)

    let n = (-1)

    df/dx - y = sinx - cosx

    Integrating factor

    k(x) = e^(-x)

    y = Integral (k(x) * P(x)) / k(x) , where P(x) = sinx -cosx

    y = [Integral (e^(-x) (sinx - cos))] / e^(-x)

    here I got stuck, as I dont know how to integrate this

    Problem 2

    (lny - x) dy/dx - ylny =0

    try : z = lny

    giving: d*dz/dx = dy/dx

    substituting in ODE:

    (z-x)y*dz/dx - yz = 0

    where y = e^z (>=0)

    don't know how to go on from here!

  2. jcsd
  3. Dec 31, 2005 #2


    User Avatar
    Gold Member

    The way to do this is with integration by parts, but there is a trick. I'll take the first part of the integral:
    [tex]\int e^{-x}\sin{x}dx=-e^{-x}\sin{x}-\int -e^{-x}\cos{x}dx[/tex]
    [tex]=-e^{-x}\sin{x}+(-e^{-x}\cos{x} - \int (-e^x)(-\sin{x})dx)[/tex]
    [tex]=-e^{-x}\sin{x} - e^{-x}\cos{x} -\int e^{-x}\sin{x}dx[/tex]
    So it looks like we're back where we started, but notice the minus sign in front of the integral. This allows us to add the integral to both sides of the equation:
    [tex]\int e^{-x}\sin{x}dx=-e^{-x}\sin{x} - e^{-x}\cos{x} -\int e^x\sin{x}dx[/tex]
    [tex]2\int e^{-x}\sin{x}dx=-e^{-x}\sin{x} - e^{-x}\cos{x}[/tex]
    [tex]\int e^{-x}\sin{x}dx=\frac{-1}{2}[e^{-x}\sin{x} + e^{-x}\cos{x}][/tex]
    Just type (tex)formula(/tex) to get your formula to appear. Just replace ( and ) with [ and ]. To see how to write the formulas just click on any formula you see and a window will pop up showing what code was used to generate it. I will look at the rest of the problems in a minute.
  4. Dec 31, 2005 #3


    User Avatar
    Science Advisor

    No, it doesn't! It becomes
    dy/dx+ ny^n= ny^(n+1)(cosx- sinx)
    Taking n= -1 gives
    dy/dx+ n/y= sinx- cosx which is still non-linear.

    Now that's correct! Rewrite that last equation as
    (z-x)dz- zdx= 0. that's an exact equation.
  5. Dec 31, 2005 #4


    User Avatar
    Gold Member

    Oops, didn't catch that. What about the substitution y=ef
  6. Dec 31, 2005 #5
    hmmm...that's what I've come up with before. My problem here: How can I solve it as it is not separable?
  7. Dec 31, 2005 #6


    User Avatar
    Gold Member

    It is an exact equation. Suppose you have a function f(z,x). Then by the chain rule [tex]df=\frac{\partial f}{\partial z}dz+\frac{\partial f}{\partial x}dx[/tex]. Then suppose you have a diff eq of the form M(x,z)dz+N(x,z)dx=0. If you can find a function f(z,x) such that [tex]\frac{\partial f}{\partial z}=M(x,z)[/tex] and [tex]\frac{\partial f}{\partial x}=N(x,z)[/tex], then you have that df=0, or f=constant as the solution to your equation.
  8. Dec 31, 2005 #7


    User Avatar
    Science Advisor
    Homework Helper

    Well it's exact. Same dif:




    or by rearranging:



    That then is just:


    Now turn the crank (integrate it). Tell you what, after that, solve:

    [tex](ln(y)-x)y^{'}-yln(y)=0,\quad y(0)=2[/tex]

    obtain an explicit expression for y(x) and then plot it from 0 to 2 (just a suggestion):smile:
  9. Jan 1, 2006 #8
    Thanks for this.

    If you integrate [tex](z-x)y' - yz = 0[/tex]

    I don't understand how you obtain

    [tex](lny - x)y' - ylny =0[/tex]

    and from there how to find y
  10. Jan 1, 2006 #9


    User Avatar
    Gold Member

    You don't, that was the original equation. He's saying you should integrate
    to find the solution to this. Once you integrate, just sub in lny for z to solve for y. Then use the initial condition to solve for the unknown constant of integration.
  11. Jan 1, 2006 #10


    User Avatar
    Science Advisor
    Homework Helper

    Know what, maybe you're a bit confussed.

    [tex](lny - x)y' - ylny =0[/tex]

    is the differential equation. Solving it we obtain a function y(x). Now, if you take the derivative of y(x), substitute y(x), it's derivative, ln(y(x)) into the ODE, then the LHS will equal zero. That means y(x) satisfied the ODE. Integrating:


    or rather:


    is just an intermediate step. It's

    [tex]\int d(xz)=\int zd(z)[/tex]

    which is just:



    So since I did that one, you integrate this one:


    Same dif right just a bit more intimidating looking but I bet you can do it.:smile:
  12. Jan 2, 2006 #11


    User Avatar
    Science Advisor
    Homework Helper

    Hey Alice, just in case you're stumped on this:


    is really just:




    [tex]\int wdw=-2\int u^2du[/tex]



    See, same dif so the one with all the derivatives is just:


    Don't get discouraged if you didn't see this. I see problems in here all the time I can't solve.

    Oh yea, for the IVP above I got:

    Last edited: Jan 2, 2006
  13. Jan 3, 2006 #12
    Thanks everyone! Part a, btw worked by substituting y= z^(-1)
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook