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: First Order ODE Question

  1. Dec 2, 2008 #1
    1. The problem statement, all variables and given/known data

    [tex]y' = -y + sin(t)[/tex]

    2. Relevant equations

    [tex]y' = \dfrac{dy}{dt} = f(t,y)[/tex]

    3. The attempt at a solution

    The solution should be, according to my text book, as follows,
    [tex]y(t)= \dfrac{3}{2}e^{-t}+\dfrac{1}{2}\left({sin(t)-cos(t)}\right)[/tex]

    I have looked at the various 'typical' forms of ODEs and cannot seem to find one for this particular case. My problem here is in recognising the ODE form, even if I put it as:

    [tex]\dfrac{dy}{dt}+y= sin(t)[/tex]

    would I have to use something like,


    I am quite rusty with ODEs and would greatly appreciate anyone willing to walk me through this one.

    This question was also posted https://www.physicsforums.com/showthread.php?t=276427", but I thought I'd shift it to the right place, especially since I am quite stuck on this one.

    Last edited by a moderator: Apr 24, 2017
  2. jcsd
  3. Dec 2, 2008 #2
    Try writing sin(t) in its exponential form...ie Sin(t)= [e^(it) - e(-it)]/2i
  4. Dec 2, 2008 #3

    Should I use an Integrating Factor to solve the Linear ODE?, i.e.


    and use an integrating factor [tex]\mu(t)=e^{\int{p(t)dt}}[/tex]




    ...and divide through by [tex]\mu(t)[/tex] ???

    Going back to the beginning,

    In this case, [tex]p(t)=1[/tex] and [tex]q(t)=sin(t)[/tex],

    Therefore, [tex]\mu(t)=e^t[/tex]


    [tex]e^ty=\int{e^tsin^tdt+C}[/tex] would be the solution? [tex]sin(t)[/tex] can be further substituted with it's exponential form if needed?
    Last edited: Dec 2, 2008
  5. Dec 2, 2008 #4


    User Avatar
    Science Advisor
    Homework Helper

    That's one way to do it. The other way is to solve the homogeneous problem dy/dt+y=0 and note that the solutions are C*exp(-t). You now want a solution to the inhomogeneous problem (a particular solution). Substitute a trial solution of A(t)*exp(-t) into the ODE and integrate the result to find A(t). This is called variation of parameters. But you'll get an expression much like the one you've already got. You are actually almost done. Now you just have to integrate e^t*sin(t).
  6. Dec 2, 2008 #5
    Thanks Dick :) I take it this would be a simple matter of integration by parts, i.e.

    I seem to be getting a run away expansion going on here:

    [tex]\begin{cases} u=g(t) = sin(t)\\

    [tex]\begin{cases} du=g'(t) = cos(t)\\

    [tex]\int{e^tsin(t)\,dt}=e^tsin(t)-\int{e^tcos(t)\,dt} + C[/tex]

    The second integral goes onto become,
    [tex]\int{e^tcos(t)\,dt}=e^tcos(t)+\int{e^tsin(t)\,dt} + C[/tex]

    Any ideas?
    Last edited: Dec 2, 2008
  7. Dec 2, 2008 #6


    User Avatar
    Science Advisor
    Homework Helper

    Sure! Substitute the second expression for the integral of e^t*cos(t) into the first. Now you have two integrals of e^t*sin(t). Move them to the same side of the equation and solve.
  8. Dec 2, 2008 #7
    This is the second integral (as obtained previously),
    [tex]\int{e^tcos(t)\,dt}=e^tcos(t)+\int{e^tsin(t)\,dt} + C[/tex]

    Substitute it into the first integral obtained by the integration by parts, for
    [tex]\int{e^tsin(t)\,dt}=e^tsin(t)-\left[e^tcos(t)+\int{e^tsin(t)\,dt} + C\right] + C[/tex]

    Further simplification yields,

    Substituting back, gives,

    Last edited: Dec 2, 2008
  9. Dec 2, 2008 #8


    User Avatar
    Science Advisor
    Homework Helper

    The correct general solution is y(t)=(1/2)*(sin(t)-cos(t))+C*e^(-t). That's what happens to the C in your solution. If they gave an answer where C=(3/2) then they must have given you an initial value.
  10. Dec 2, 2008 #9
    Dick, I just figured it out!! Am updating my tex solutions to include Ce^(-t)...thanks!!!
  11. Dec 2, 2008 #10

    The initial value is y(0) = 1, therefore,



    Hence, we finally arrive at the solution,
  12. Dec 2, 2008 #11


    User Avatar
    Science Advisor
    Homework Helper

    Well done.
  13. Dec 2, 2008 #12
    Thanks a lot Dick. I have completed my Masters (technically), although I was ill for about two months as I contracted an inner ear infection. Short version: I was granted a replacement exam for one that was missed in January ~ Adv. Numerical Methods.

    This question was really good practice for 'remembering' to solve ODEs analytically rather than completely being 'spoilt' by MATLAB/SIMULINK.

    All the best,
  14. Dec 2, 2008 #13


    User Avatar
    Science Advisor
    Homework Helper

    Good luck. I think you'll have it. You are actually pretty good at this stuff.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook