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: Difference equation

  1. Oct 21, 2005 #1
    I am currently struggling to solve Difference equations (especially the first order ones). Here is a 'simple' one which I cannot get the correct answer to despite trying many times. Here is what I think is my most decent attempt.
    [tex]
    2y_{n + 1} = y_n + 2
    [/tex]
    Rearranging gives [tex]y_{n + 1} = \frac{1}{2}y_n + 1[/tex].
    Iterating: [tex]y_1 = \frac{1}{2}y_0 + 1,y_2 = \frac{1}{2}y_1 + 1 = \left( {\frac{1}{2}} \right)^2 y_0 + 1 + \frac{1}{2}[/tex]
    [tex]
    \Rightarrow y_n = \left( {\frac{1}{2}} \right)^n y_0 + \sum\limits_{i = 0}^{n - 1} {\left( {\frac{1}{2}} \right)} ^i
    [/tex]
    [tex]
    = \left( {\frac{1}{2}} \right)^n y_0 + \sum\limits_{i = 0}^n {\left( {\frac{1}{2}} \right)} ^i - \left( {\frac{1}{2}} \right)^n
    [/tex]
    [tex]
    = \left( {\frac{1}{2}} \right)^n y_0 + \frac{{1 - \left( {\frac{1}{2}} \right)^{n + 1} }}{{1 - \frac{1}{2}}} - \left( {\frac{1}{2}} \right)^n
    [/tex]
    [tex]
    = \left( {\frac{1}{2}} \right)^n y_0 + 2 - \left( {\frac{1}{2}} \right)^n - \left( {\frac{1}{2}} \right)^n
    [/tex]
    The answer is what I obtained except without the two subtracted (1/2)^n terms at the end. By the way is there a way to solve first order difference equations without using an iterative approach like the one I used? Any help would be good thanks.

    Edit: Hmm I just realised that I could've the substitution y_n = lambda^n to find the solution to homogeneous equation and then set y_n = constant to find particular solution. However I would still like to know how to do it through the summation method I used. Any help or suggestions for alternative solutions would be good thanks.
     
    Last edited: Oct 21, 2005
  2. jcsd
  3. Oct 21, 2005 #2

    HallsofIvy

    User Avatar
    Science Advisor

    No, that's wrong. If
    [tex] y_n = \left( {\frac{1}{2}} \right)^n y_0 + \sum\limits_{i = 0}^{n - 1} {\left( {\frac{1}{2}} \right)} ^i
    [/tex][tex]y_1 = \frac{1}{2}y_0 + 1[/tex]
    alright but then [tex]y_2= \frac{1}{2}y_1+ 1= \frac{1/2}\frac{1}{2}y_0+ \frac{1/2}+ 1= \left(\frac{1}{2}\right)^2y_0+ \frac{3}{2}[/tex]
     
    Last edited by a moderator: Oct 21, 2005
  4. Oct 21, 2005 #3

    Tide

    User Avatar
    Science Advisor
    Homework Helper

    Try setting [itex]y_n = z_n + 2[/itex].

    (EDIT: Corrected constant.)
     
    Last edited: Oct 22, 2005
  5. Oct 21, 2005 #4
    I don't understand which part you are saying is wrong. I know that my initial answer is incorrect but it seems to fit in with what I'm getting.

    [tex]
    y_1 \equiv \left( {\frac{1}{2}} \right)y_0 + 1
    [/tex] from y_(n+1) = (1/2)y_(n) + 1

    [tex]
    y_2 \equiv \left( {\frac{1}{2}} \right)y_1 + 1 = \left( {\frac{1}{2}} \right)\left[ {\left( {\frac{1}{2}} \right)y_0 + 1} \right] + 1 = \left( {\frac{1}{2}} \right)^2 y_0 + 1 + \frac{1}{2}
    [/tex]

    If [tex]y_n = \left( {\frac{1}{2}} \right)^n y_0 + \sum\limits_{i = 0}^{n - 1} {\left( {\frac{1}{2}} \right)^i } [/tex] then:

    [tex]
    y_1 = \left( {\frac{1}{2}} \right)y_0 + \sum\limits_{i = 0}^{1 - 1} {\left( {\frac{1}{2}} \right)^i } = \left( {\frac{1}{2}} \right)y_0 + 1
    [/tex]

    Ok that seems right. Set n = 2 and what happens?

    [tex]
    y_2 = \left( {\frac{1}{2}} \right)^2 y_0 + \sum\limits_{i = 0}^{2 - 1} {\left( {\frac{1}{2}} \right)^i } = \left( {\frac{1}{2}} \right)^2 y_0 + \sum\limits_{i = 0}^1 {\left( {\frac{1}{2}} \right)^i } = \left( {\frac{1}{2}} \right)^2 y_0 + 1 + \frac{1}{2}
    [/tex]

    As before.

    So if instead of using my formula and I simply interated I would get the same answer.

    It is absolutely incorrect to 'replace' y_0 by y_1 in the first formula that I found. I know what the my formula is not correct but I don't see how it doesn't fit in with what I found.

    Tide - Thanks for the help but if possible could you please explain the motivation behind that substitution?
     
  6. Oct 22, 2005 #5

    Tide

    User Avatar
    Science Advisor
    Homework Helper

    Benny,

    Quite simple but I did type in the wrong number in my original post - which I'll edit. (The correct substitution is [itex]y_n = z_n + 2[/itex])

    If you didn't have that +1 on the right side of your original equation then you would have a difference equation for a simple geometric series. Is there a way of eliminating the +1? Yes, try [itex]y_n = z_n + A[/itex] and find out whether there is any value of A that gets rid of the +1.

    Making the substitution gives [itex]z_n + A = \frac {1}{2}z_n + \frac{1}{2} A + 1[/itex]. Therefore, if [itex]A = 2[/itex] we have [itex]z_{n+1} = \frac{1}{2}z_n[/itex] which is very easily solved. Don't forget to replace [itex]z_n[/itex] with [itex]y_n - 2[/itex] to find the required solution.
     
    Last edited: Oct 22, 2005
  7. Oct 22, 2005 #6
    Oh ok, I see what you did now. It seems kind of like setting y_n = C and then solving for C.
     
  8. Oct 22, 2005 #7

    Tide

    User Avatar
    Science Advisor
    Homework Helper

    Benny,

    My typing fingers aren't working right today! This is the equation you get after making the substitution:

    [tex]z_{n+1} = \frac{1}{2}z_n[/tex]

    I had mistyped n instead of n+1 for the index on the left side.
     
  9. Oct 22, 2005 #8
    Thanks, I figured that it's what you meant to type before.
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook