Solving a nonhomogeneous linear recurrence relationHow to solve this recurrenceQuestion about a recurrenceCan I get a hint on solving this recurrence relation?Solving a linear nonhomogeneous recurrence relation with troublesome $F(n)$Can this recurrence relation be solved with generating functions?Solving a nonhomogeneous recurrence relationWhy does this method for solving recurrence relations work in some cases and not in others?Solving a particular nonhomogeneous recurrence relationSolving a nonhomogeneous recurrence relation?

how to parse json to list?

Exam design: give maximum score per question or not?

Quick Kurodoko Puzzle: Threes and Triples

Delete empty subfolders, keep parent folder

How is underwater propagation of sound possible?

How to count the number of function evaluations in NIntegrate

Is Zack Morris's 'time stop' ability in "Saved By the Bell" a supernatural ability?

SMTP banner mismatch with multiple MX records

Are lay articles good enough to be the main source of information for PhD research?

As a discovery writer, how to complete unfinished novel (which is highly diverted from original plot ) after a time-gap

Manager manipulates my leaves, what's in it for him?

Should the pagination be reset when changing the order?

The relationship of noch nicht and the passive voice

How could artificial intelligence harm us?

Is this quote, "just ten trading days represent 63 per cent of the returns of the past 50 years" true?

Who are the people reviewing far more papers than they're submitting for review?

I was cheated into a job and want to leave ASAP, what do I tell my interviewers?

Should I inform my future product owner that there is a good chance that a team member will leave the company soon?

Get the encrypted payload from an unencrypted wrapper PDF document

How should errors be reported in scientific libraries?

What's the purpose of autocorrelation?

Did slaves have slaves?

Do the villains know Batman has no superpowers?

Escape the labyrinth!



Solving a nonhomogeneous linear recurrence relation


How to solve this recurrenceQuestion about a recurrenceCan I get a hint on solving this recurrence relation?Solving a linear nonhomogeneous recurrence relation with troublesome $F(n)$Can this recurrence relation be solved with generating functions?Solving a nonhomogeneous recurrence relationWhy does this method for solving recurrence relations work in some cases and not in others?Solving a particular nonhomogeneous recurrence relationSolving a nonhomogeneous recurrence relation?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1












$begingroup$


Let's have a look at this supposedly simple relation:
$$
begincases
f(n)=2cdot f(n-1)+n \
f(1)=1
endcases
$$



After a few expansions, for $n=5$, we get



$$
beginalign
f(5)&=2(2(2(2f(1)+2)+3)+4)+5) \
&=2^4f(1)+sum_i=0^32^icdot (5-i)
endalign
$$



So, we can generalize to
$$
f(n)=2^n-1+sum_i=0^n-22^icdot (n-i)
$$



After that, I still couldn't arrive at the final solution, without any sum terms.



So, using only elementary tools (i.e without generating functions, etc.), how can one solve this relation?










share|cite|improve this question











$endgroup$













  • $begingroup$
    Hint: Compare it to $2^n+1$.
    $endgroup$
    – lulu
    8 hours ago

















1












$begingroup$


Let's have a look at this supposedly simple relation:
$$
begincases
f(n)=2cdot f(n-1)+n \
f(1)=1
endcases
$$



After a few expansions, for $n=5$, we get



$$
beginalign
f(5)&=2(2(2(2f(1)+2)+3)+4)+5) \
&=2^4f(1)+sum_i=0^32^icdot (5-i)
endalign
$$



So, we can generalize to
$$
f(n)=2^n-1+sum_i=0^n-22^icdot (n-i)
$$



After that, I still couldn't arrive at the final solution, without any sum terms.



So, using only elementary tools (i.e without generating functions, etc.), how can one solve this relation?










share|cite|improve this question











$endgroup$













  • $begingroup$
    Hint: Compare it to $2^n+1$.
    $endgroup$
    – lulu
    8 hours ago













1












1








1


1



$begingroup$


Let's have a look at this supposedly simple relation:
$$
begincases
f(n)=2cdot f(n-1)+n \
f(1)=1
endcases
$$



After a few expansions, for $n=5$, we get



$$
beginalign
f(5)&=2(2(2(2f(1)+2)+3)+4)+5) \
&=2^4f(1)+sum_i=0^32^icdot (5-i)
endalign
$$



So, we can generalize to
$$
f(n)=2^n-1+sum_i=0^n-22^icdot (n-i)
$$



After that, I still couldn't arrive at the final solution, without any sum terms.



So, using only elementary tools (i.e without generating functions, etc.), how can one solve this relation?










share|cite|improve this question











$endgroup$




Let's have a look at this supposedly simple relation:
$$
begincases
f(n)=2cdot f(n-1)+n \
f(1)=1
endcases
$$



After a few expansions, for $n=5$, we get



$$
beginalign
f(5)&=2(2(2(2f(1)+2)+3)+4)+5) \
&=2^4f(1)+sum_i=0^32^icdot (5-i)
endalign
$$



So, we can generalize to
$$
f(n)=2^n-1+sum_i=0^n-22^icdot (n-i)
$$



After that, I still couldn't arrive at the final solution, without any sum terms.



So, using only elementary tools (i.e without generating functions, etc.), how can one solve this relation?







recurrence-relations






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited 8 hours ago







matan129

















asked 8 hours ago









matan129matan129

1348 bronze badges




1348 bronze badges














  • $begingroup$
    Hint: Compare it to $2^n+1$.
    $endgroup$
    – lulu
    8 hours ago
















  • $begingroup$
    Hint: Compare it to $2^n+1$.
    $endgroup$
    – lulu
    8 hours ago















$begingroup$
Hint: Compare it to $2^n+1$.
$endgroup$
– lulu
8 hours ago




$begingroup$
Hint: Compare it to $2^n+1$.
$endgroup$
– lulu
8 hours ago










5 Answers
5






active

oldest

votes


















3














$begingroup$

Looking at homogenous equation $f(n) = 2f(n-1)$, we get $f(n) = A cdot 2^n$ for some constant $A in mathbb R$ is our general solution to that equation.



Now we want to find one solution to equation $f(n) = 2f(n-1) + n$.



Looking at the remaining $n$, we can guess it should be some sort of linear, so let's try $f_*(n) = an+b$, where by $f_*$ I denote special solution.



Then we have $an + b = 2a(n-1) + 2b + n$ which is equivalent to: $n(a+1) + b -2a = 0$



It must holds for any $n in mathbb N$, so we need $(a+1) = 0$, that means $a=-1$ and $b-2a = 0$, so $b = 2a = -2$



So our special solution is $f_*(n) = -n-2$.



Now, any solution to our system of equation is of the form : general solution + special solution.



So plugging it in, we have our solution to be $f(n) = Acdot 2^n -n - 2$.



Plugging $f(1) = 1$, to get the value of $A$, we have:



$1 = 2A - 1 - 2$, so $A=2$



And our solution is $f(n) = 2^n+1 - n - 2$






share|cite|improve this answer









$endgroup$






















    2














    $begingroup$

    $$
    beginalign
    f(n)&=2f(n-1)+ntag1\
    f(n)+(n+2)&=2(f(n-1)+(n+1))tag2\
    g(n)&=2g(n-1)tag3
    endalign
    $$

    Explanation:
    $(1)$: original recursion
    $(2)$: add $n+2$ to both sides
    $(3)$: let $g(n)=f(n)+(n+2)$



    Starting with $g(1)=f(1)+3=4$, we get
    $$
    g(n)=2^n+1tag4
    $$

    and therefore,
    $$
    f(n)=2^n+1-n-2tag5
    $$






    share|cite|improve this answer









    $endgroup$














    • $begingroup$
      Probably, this is the simplest solution. Simpler then mine.
      $endgroup$
      – Alexandre Frias
      7 hours ago






    • 1




      $begingroup$
      @AlexandreFrias: The $sum_n=2^mfracn2^n$ is nice and mechanical, but a bit daunting to encounter. I looked at this by applying the shift operator on sequences, $S$, and got $(S-2)f(n)=n+1$ and so $(S-1)^2(S-2)f(n)=0$ which turns this into a homogeneous third degree linear difference equation whose solution is of the form $f(n)=A2^n+Bn+C$. Commuting the difference equation to $(S-2)(S-1)^2f(n)=0$ gave $(S-2)(f(n)+n+2)=0$, which is where I got $g(n)=f(n)+n+2$.
      $endgroup$
      – robjohn
      7 hours ago



















    2














    $begingroup$

    Divide both parts by $2^n$ and you have a linear recurrence



    $$fracf(n)2^n=fracf(n-1)2^n-1+fracn2^n$$



    $$fracf(n)2^n-fracf(n-1)2^n-1=fracn2^n$$



    This is a telescopic term then you can apply the summation in both parts



    $$sum_n=2^mfracf(n)2^n-fracf(n-1)2^n-1=sum_n=2^mfracn2^n$$



    $$fracf(m)2^m-fracf(1)2=frac32-fracm+22^m$$



    $$f(m)=2^m+1-m-2$$






    share|cite|improve this answer











    $endgroup$






















      1














      $begingroup$

      We try to write $f(n)=g(n)+h(n)$ where$$g(n)-2g(n-1)=n$$$$h(n)-2h(n-1)=0$$



      Now $h(n)$ is easy with $h(n)=2^nh(0)$ - but we don't know what $h(0)$ is yet.



      For forms like this with a polynomial in $n$ on the right-hand side, we try a solution with $g(n)$ being a polynomial of the same degree [there are special cases where a higher degree is necessary].



      So here we want $g(n)=an+b$ to be linear.



      We call $g(n)$ a particular solution, and $h(n)$ a solution of the "homogeneous part".



      That should be enough clue for you to try to finish it yourself.



      Note: Generally the unknowns in the particular solution will be determined direct from the recurrence, while those in the homogeneous part (which represents the degrees of freedom in the solution) will be found by reference to the initial conditions.






      share|cite|improve this answer









      $endgroup$






















        1














        $begingroup$

        Your recurrence relation is linear, but not homogeneous.



        One approach is as follows: begin by solving the homogeneous recurrence relation,
        $$
        f(n) = 2 f(n - 1).
        $$

        We end up with a general solution of $f_H(n) = C2^n$. Now, it suffices to find one "particular solution" to the original non-homogeneous difference equation. Following the method of undetermined coefficients, we take the ansatz
        $$
        f(n) = an + b implies\
        f(n-1) = an + (b-a).
        $$

        Plugging this in to our recurrence relation yields
        $$
        f(n) = 2 f(n - 1) + n implies
        an + b = 2[an + (b-a)] + nimplies\
        an + b = (2a+1)n + 2b-2a implies\
        (a + 1)n + (2a-b)= 0
        $$

        So, $a = -1$, $b = -2$ will work. We can therefore take
        $
        f_P(n) = -n-2.
        $

        Thus, our general solution is
        $$
        f(n) = f_H + f_P = C ,2^n - n - 2.
        $$

        Using the initial conditions, solve for $C$.






        share|cite|improve this answer









        $endgroup$

















          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "69"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );














          draft saved

          draft discarded
















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3360144%2fsolving-a-nonhomogeneous-linear-recurrence-relation%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          $begingroup$

          Looking at homogenous equation $f(n) = 2f(n-1)$, we get $f(n) = A cdot 2^n$ for some constant $A in mathbb R$ is our general solution to that equation.



          Now we want to find one solution to equation $f(n) = 2f(n-1) + n$.



          Looking at the remaining $n$, we can guess it should be some sort of linear, so let's try $f_*(n) = an+b$, where by $f_*$ I denote special solution.



          Then we have $an + b = 2a(n-1) + 2b + n$ which is equivalent to: $n(a+1) + b -2a = 0$



          It must holds for any $n in mathbb N$, so we need $(a+1) = 0$, that means $a=-1$ and $b-2a = 0$, so $b = 2a = -2$



          So our special solution is $f_*(n) = -n-2$.



          Now, any solution to our system of equation is of the form : general solution + special solution.



          So plugging it in, we have our solution to be $f(n) = Acdot 2^n -n - 2$.



          Plugging $f(1) = 1$, to get the value of $A$, we have:



          $1 = 2A - 1 - 2$, so $A=2$



          And our solution is $f(n) = 2^n+1 - n - 2$






          share|cite|improve this answer









          $endgroup$



















            3














            $begingroup$

            Looking at homogenous equation $f(n) = 2f(n-1)$, we get $f(n) = A cdot 2^n$ for some constant $A in mathbb R$ is our general solution to that equation.



            Now we want to find one solution to equation $f(n) = 2f(n-1) + n$.



            Looking at the remaining $n$, we can guess it should be some sort of linear, so let's try $f_*(n) = an+b$, where by $f_*$ I denote special solution.



            Then we have $an + b = 2a(n-1) + 2b + n$ which is equivalent to: $n(a+1) + b -2a = 0$



            It must holds for any $n in mathbb N$, so we need $(a+1) = 0$, that means $a=-1$ and $b-2a = 0$, so $b = 2a = -2$



            So our special solution is $f_*(n) = -n-2$.



            Now, any solution to our system of equation is of the form : general solution + special solution.



            So plugging it in, we have our solution to be $f(n) = Acdot 2^n -n - 2$.



            Plugging $f(1) = 1$, to get the value of $A$, we have:



            $1 = 2A - 1 - 2$, so $A=2$



            And our solution is $f(n) = 2^n+1 - n - 2$






            share|cite|improve this answer









            $endgroup$

















              3














              3










              3







              $begingroup$

              Looking at homogenous equation $f(n) = 2f(n-1)$, we get $f(n) = A cdot 2^n$ for some constant $A in mathbb R$ is our general solution to that equation.



              Now we want to find one solution to equation $f(n) = 2f(n-1) + n$.



              Looking at the remaining $n$, we can guess it should be some sort of linear, so let's try $f_*(n) = an+b$, where by $f_*$ I denote special solution.



              Then we have $an + b = 2a(n-1) + 2b + n$ which is equivalent to: $n(a+1) + b -2a = 0$



              It must holds for any $n in mathbb N$, so we need $(a+1) = 0$, that means $a=-1$ and $b-2a = 0$, so $b = 2a = -2$



              So our special solution is $f_*(n) = -n-2$.



              Now, any solution to our system of equation is of the form : general solution + special solution.



              So plugging it in, we have our solution to be $f(n) = Acdot 2^n -n - 2$.



              Plugging $f(1) = 1$, to get the value of $A$, we have:



              $1 = 2A - 1 - 2$, so $A=2$



              And our solution is $f(n) = 2^n+1 - n - 2$






              share|cite|improve this answer









              $endgroup$



              Looking at homogenous equation $f(n) = 2f(n-1)$, we get $f(n) = A cdot 2^n$ for some constant $A in mathbb R$ is our general solution to that equation.



              Now we want to find one solution to equation $f(n) = 2f(n-1) + n$.



              Looking at the remaining $n$, we can guess it should be some sort of linear, so let's try $f_*(n) = an+b$, where by $f_*$ I denote special solution.



              Then we have $an + b = 2a(n-1) + 2b + n$ which is equivalent to: $n(a+1) + b -2a = 0$



              It must holds for any $n in mathbb N$, so we need $(a+1) = 0$, that means $a=-1$ and $b-2a = 0$, so $b = 2a = -2$



              So our special solution is $f_*(n) = -n-2$.



              Now, any solution to our system of equation is of the form : general solution + special solution.



              So plugging it in, we have our solution to be $f(n) = Acdot 2^n -n - 2$.



              Plugging $f(1) = 1$, to get the value of $A$, we have:



              $1 = 2A - 1 - 2$, so $A=2$



              And our solution is $f(n) = 2^n+1 - n - 2$







              share|cite|improve this answer












              share|cite|improve this answer



              share|cite|improve this answer










              answered 8 hours ago









              Dominik KutekDominik Kutek

              1,7171 silver badge8 bronze badges




              1,7171 silver badge8 bronze badges


























                  2














                  $begingroup$

                  $$
                  beginalign
                  f(n)&=2f(n-1)+ntag1\
                  f(n)+(n+2)&=2(f(n-1)+(n+1))tag2\
                  g(n)&=2g(n-1)tag3
                  endalign
                  $$

                  Explanation:
                  $(1)$: original recursion
                  $(2)$: add $n+2$ to both sides
                  $(3)$: let $g(n)=f(n)+(n+2)$



                  Starting with $g(1)=f(1)+3=4$, we get
                  $$
                  g(n)=2^n+1tag4
                  $$

                  and therefore,
                  $$
                  f(n)=2^n+1-n-2tag5
                  $$






                  share|cite|improve this answer









                  $endgroup$














                  • $begingroup$
                    Probably, this is the simplest solution. Simpler then mine.
                    $endgroup$
                    – Alexandre Frias
                    7 hours ago






                  • 1




                    $begingroup$
                    @AlexandreFrias: The $sum_n=2^mfracn2^n$ is nice and mechanical, but a bit daunting to encounter. I looked at this by applying the shift operator on sequences, $S$, and got $(S-2)f(n)=n+1$ and so $(S-1)^2(S-2)f(n)=0$ which turns this into a homogeneous third degree linear difference equation whose solution is of the form $f(n)=A2^n+Bn+C$. Commuting the difference equation to $(S-2)(S-1)^2f(n)=0$ gave $(S-2)(f(n)+n+2)=0$, which is where I got $g(n)=f(n)+n+2$.
                    $endgroup$
                    – robjohn
                    7 hours ago
















                  2














                  $begingroup$

                  $$
                  beginalign
                  f(n)&=2f(n-1)+ntag1\
                  f(n)+(n+2)&=2(f(n-1)+(n+1))tag2\
                  g(n)&=2g(n-1)tag3
                  endalign
                  $$

                  Explanation:
                  $(1)$: original recursion
                  $(2)$: add $n+2$ to both sides
                  $(3)$: let $g(n)=f(n)+(n+2)$



                  Starting with $g(1)=f(1)+3=4$, we get
                  $$
                  g(n)=2^n+1tag4
                  $$

                  and therefore,
                  $$
                  f(n)=2^n+1-n-2tag5
                  $$






                  share|cite|improve this answer









                  $endgroup$














                  • $begingroup$
                    Probably, this is the simplest solution. Simpler then mine.
                    $endgroup$
                    – Alexandre Frias
                    7 hours ago






                  • 1




                    $begingroup$
                    @AlexandreFrias: The $sum_n=2^mfracn2^n$ is nice and mechanical, but a bit daunting to encounter. I looked at this by applying the shift operator on sequences, $S$, and got $(S-2)f(n)=n+1$ and so $(S-1)^2(S-2)f(n)=0$ which turns this into a homogeneous third degree linear difference equation whose solution is of the form $f(n)=A2^n+Bn+C$. Commuting the difference equation to $(S-2)(S-1)^2f(n)=0$ gave $(S-2)(f(n)+n+2)=0$, which is where I got $g(n)=f(n)+n+2$.
                    $endgroup$
                    – robjohn
                    7 hours ago














                  2














                  2










                  2







                  $begingroup$

                  $$
                  beginalign
                  f(n)&=2f(n-1)+ntag1\
                  f(n)+(n+2)&=2(f(n-1)+(n+1))tag2\
                  g(n)&=2g(n-1)tag3
                  endalign
                  $$

                  Explanation:
                  $(1)$: original recursion
                  $(2)$: add $n+2$ to both sides
                  $(3)$: let $g(n)=f(n)+(n+2)$



                  Starting with $g(1)=f(1)+3=4$, we get
                  $$
                  g(n)=2^n+1tag4
                  $$

                  and therefore,
                  $$
                  f(n)=2^n+1-n-2tag5
                  $$






                  share|cite|improve this answer









                  $endgroup$



                  $$
                  beginalign
                  f(n)&=2f(n-1)+ntag1\
                  f(n)+(n+2)&=2(f(n-1)+(n+1))tag2\
                  g(n)&=2g(n-1)tag3
                  endalign
                  $$

                  Explanation:
                  $(1)$: original recursion
                  $(2)$: add $n+2$ to both sides
                  $(3)$: let $g(n)=f(n)+(n+2)$



                  Starting with $g(1)=f(1)+3=4$, we get
                  $$
                  g(n)=2^n+1tag4
                  $$

                  and therefore,
                  $$
                  f(n)=2^n+1-n-2tag5
                  $$







                  share|cite|improve this answer












                  share|cite|improve this answer



                  share|cite|improve this answer










                  answered 7 hours ago









                  robjohnrobjohn

                  279k29 gold badges329 silver badges660 bronze badges




                  279k29 gold badges329 silver badges660 bronze badges














                  • $begingroup$
                    Probably, this is the simplest solution. Simpler then mine.
                    $endgroup$
                    – Alexandre Frias
                    7 hours ago






                  • 1




                    $begingroup$
                    @AlexandreFrias: The $sum_n=2^mfracn2^n$ is nice and mechanical, but a bit daunting to encounter. I looked at this by applying the shift operator on sequences, $S$, and got $(S-2)f(n)=n+1$ and so $(S-1)^2(S-2)f(n)=0$ which turns this into a homogeneous third degree linear difference equation whose solution is of the form $f(n)=A2^n+Bn+C$. Commuting the difference equation to $(S-2)(S-1)^2f(n)=0$ gave $(S-2)(f(n)+n+2)=0$, which is where I got $g(n)=f(n)+n+2$.
                    $endgroup$
                    – robjohn
                    7 hours ago

















                  • $begingroup$
                    Probably, this is the simplest solution. Simpler then mine.
                    $endgroup$
                    – Alexandre Frias
                    7 hours ago






                  • 1




                    $begingroup$
                    @AlexandreFrias: The $sum_n=2^mfracn2^n$ is nice and mechanical, but a bit daunting to encounter. I looked at this by applying the shift operator on sequences, $S$, and got $(S-2)f(n)=n+1$ and so $(S-1)^2(S-2)f(n)=0$ which turns this into a homogeneous third degree linear difference equation whose solution is of the form $f(n)=A2^n+Bn+C$. Commuting the difference equation to $(S-2)(S-1)^2f(n)=0$ gave $(S-2)(f(n)+n+2)=0$, which is where I got $g(n)=f(n)+n+2$.
                    $endgroup$
                    – robjohn
                    7 hours ago
















                  $begingroup$
                  Probably, this is the simplest solution. Simpler then mine.
                  $endgroup$
                  – Alexandre Frias
                  7 hours ago




                  $begingroup$
                  Probably, this is the simplest solution. Simpler then mine.
                  $endgroup$
                  – Alexandre Frias
                  7 hours ago




                  1




                  1




                  $begingroup$
                  @AlexandreFrias: The $sum_n=2^mfracn2^n$ is nice and mechanical, but a bit daunting to encounter. I looked at this by applying the shift operator on sequences, $S$, and got $(S-2)f(n)=n+1$ and so $(S-1)^2(S-2)f(n)=0$ which turns this into a homogeneous third degree linear difference equation whose solution is of the form $f(n)=A2^n+Bn+C$. Commuting the difference equation to $(S-2)(S-1)^2f(n)=0$ gave $(S-2)(f(n)+n+2)=0$, which is where I got $g(n)=f(n)+n+2$.
                  $endgroup$
                  – robjohn
                  7 hours ago





                  $begingroup$
                  @AlexandreFrias: The $sum_n=2^mfracn2^n$ is nice and mechanical, but a bit daunting to encounter. I looked at this by applying the shift operator on sequences, $S$, and got $(S-2)f(n)=n+1$ and so $(S-1)^2(S-2)f(n)=0$ which turns this into a homogeneous third degree linear difference equation whose solution is of the form $f(n)=A2^n+Bn+C$. Commuting the difference equation to $(S-2)(S-1)^2f(n)=0$ gave $(S-2)(f(n)+n+2)=0$, which is where I got $g(n)=f(n)+n+2$.
                  $endgroup$
                  – robjohn
                  7 hours ago












                  2














                  $begingroup$

                  Divide both parts by $2^n$ and you have a linear recurrence



                  $$fracf(n)2^n=fracf(n-1)2^n-1+fracn2^n$$



                  $$fracf(n)2^n-fracf(n-1)2^n-1=fracn2^n$$



                  This is a telescopic term then you can apply the summation in both parts



                  $$sum_n=2^mfracf(n)2^n-fracf(n-1)2^n-1=sum_n=2^mfracn2^n$$



                  $$fracf(m)2^m-fracf(1)2=frac32-fracm+22^m$$



                  $$f(m)=2^m+1-m-2$$






                  share|cite|improve this answer











                  $endgroup$



















                    2














                    $begingroup$

                    Divide both parts by $2^n$ and you have a linear recurrence



                    $$fracf(n)2^n=fracf(n-1)2^n-1+fracn2^n$$



                    $$fracf(n)2^n-fracf(n-1)2^n-1=fracn2^n$$



                    This is a telescopic term then you can apply the summation in both parts



                    $$sum_n=2^mfracf(n)2^n-fracf(n-1)2^n-1=sum_n=2^mfracn2^n$$



                    $$fracf(m)2^m-fracf(1)2=frac32-fracm+22^m$$



                    $$f(m)=2^m+1-m-2$$






                    share|cite|improve this answer











                    $endgroup$

















                      2














                      2










                      2







                      $begingroup$

                      Divide both parts by $2^n$ and you have a linear recurrence



                      $$fracf(n)2^n=fracf(n-1)2^n-1+fracn2^n$$



                      $$fracf(n)2^n-fracf(n-1)2^n-1=fracn2^n$$



                      This is a telescopic term then you can apply the summation in both parts



                      $$sum_n=2^mfracf(n)2^n-fracf(n-1)2^n-1=sum_n=2^mfracn2^n$$



                      $$fracf(m)2^m-fracf(1)2=frac32-fracm+22^m$$



                      $$f(m)=2^m+1-m-2$$






                      share|cite|improve this answer











                      $endgroup$



                      Divide both parts by $2^n$ and you have a linear recurrence



                      $$fracf(n)2^n=fracf(n-1)2^n-1+fracn2^n$$



                      $$fracf(n)2^n-fracf(n-1)2^n-1=fracn2^n$$



                      This is a telescopic term then you can apply the summation in both parts



                      $$sum_n=2^mfracf(n)2^n-fracf(n-1)2^n-1=sum_n=2^mfracn2^n$$



                      $$fracf(m)2^m-fracf(1)2=frac32-fracm+22^m$$



                      $$f(m)=2^m+1-m-2$$







                      share|cite|improve this answer














                      share|cite|improve this answer



                      share|cite|improve this answer








                      edited 1 hour ago

























                      answered 8 hours ago









                      Alexandre FriasAlexandre Frias

                      1654 bronze badges




                      1654 bronze badges
























                          1














                          $begingroup$

                          We try to write $f(n)=g(n)+h(n)$ where$$g(n)-2g(n-1)=n$$$$h(n)-2h(n-1)=0$$



                          Now $h(n)$ is easy with $h(n)=2^nh(0)$ - but we don't know what $h(0)$ is yet.



                          For forms like this with a polynomial in $n$ on the right-hand side, we try a solution with $g(n)$ being a polynomial of the same degree [there are special cases where a higher degree is necessary].



                          So here we want $g(n)=an+b$ to be linear.



                          We call $g(n)$ a particular solution, and $h(n)$ a solution of the "homogeneous part".



                          That should be enough clue for you to try to finish it yourself.



                          Note: Generally the unknowns in the particular solution will be determined direct from the recurrence, while those in the homogeneous part (which represents the degrees of freedom in the solution) will be found by reference to the initial conditions.






                          share|cite|improve this answer









                          $endgroup$



















                            1














                            $begingroup$

                            We try to write $f(n)=g(n)+h(n)$ where$$g(n)-2g(n-1)=n$$$$h(n)-2h(n-1)=0$$



                            Now $h(n)$ is easy with $h(n)=2^nh(0)$ - but we don't know what $h(0)$ is yet.



                            For forms like this with a polynomial in $n$ on the right-hand side, we try a solution with $g(n)$ being a polynomial of the same degree [there are special cases where a higher degree is necessary].



                            So here we want $g(n)=an+b$ to be linear.



                            We call $g(n)$ a particular solution, and $h(n)$ a solution of the "homogeneous part".



                            That should be enough clue for you to try to finish it yourself.



                            Note: Generally the unknowns in the particular solution will be determined direct from the recurrence, while those in the homogeneous part (which represents the degrees of freedom in the solution) will be found by reference to the initial conditions.






                            share|cite|improve this answer









                            $endgroup$

















                              1














                              1










                              1







                              $begingroup$

                              We try to write $f(n)=g(n)+h(n)$ where$$g(n)-2g(n-1)=n$$$$h(n)-2h(n-1)=0$$



                              Now $h(n)$ is easy with $h(n)=2^nh(0)$ - but we don't know what $h(0)$ is yet.



                              For forms like this with a polynomial in $n$ on the right-hand side, we try a solution with $g(n)$ being a polynomial of the same degree [there are special cases where a higher degree is necessary].



                              So here we want $g(n)=an+b$ to be linear.



                              We call $g(n)$ a particular solution, and $h(n)$ a solution of the "homogeneous part".



                              That should be enough clue for you to try to finish it yourself.



                              Note: Generally the unknowns in the particular solution will be determined direct from the recurrence, while those in the homogeneous part (which represents the degrees of freedom in the solution) will be found by reference to the initial conditions.






                              share|cite|improve this answer









                              $endgroup$



                              We try to write $f(n)=g(n)+h(n)$ where$$g(n)-2g(n-1)=n$$$$h(n)-2h(n-1)=0$$



                              Now $h(n)$ is easy with $h(n)=2^nh(0)$ - but we don't know what $h(0)$ is yet.



                              For forms like this with a polynomial in $n$ on the right-hand side, we try a solution with $g(n)$ being a polynomial of the same degree [there are special cases where a higher degree is necessary].



                              So here we want $g(n)=an+b$ to be linear.



                              We call $g(n)$ a particular solution, and $h(n)$ a solution of the "homogeneous part".



                              That should be enough clue for you to try to finish it yourself.



                              Note: Generally the unknowns in the particular solution will be determined direct from the recurrence, while those in the homogeneous part (which represents the degrees of freedom in the solution) will be found by reference to the initial conditions.







                              share|cite|improve this answer












                              share|cite|improve this answer



                              share|cite|improve this answer










                              answered 8 hours ago









                              Mark BennetMark Bennet

                              86.8k9 gold badges92 silver badges197 bronze badges




                              86.8k9 gold badges92 silver badges197 bronze badges
























                                  1














                                  $begingroup$

                                  Your recurrence relation is linear, but not homogeneous.



                                  One approach is as follows: begin by solving the homogeneous recurrence relation,
                                  $$
                                  f(n) = 2 f(n - 1).
                                  $$

                                  We end up with a general solution of $f_H(n) = C2^n$. Now, it suffices to find one "particular solution" to the original non-homogeneous difference equation. Following the method of undetermined coefficients, we take the ansatz
                                  $$
                                  f(n) = an + b implies\
                                  f(n-1) = an + (b-a).
                                  $$

                                  Plugging this in to our recurrence relation yields
                                  $$
                                  f(n) = 2 f(n - 1) + n implies
                                  an + b = 2[an + (b-a)] + nimplies\
                                  an + b = (2a+1)n + 2b-2a implies\
                                  (a + 1)n + (2a-b)= 0
                                  $$

                                  So, $a = -1$, $b = -2$ will work. We can therefore take
                                  $
                                  f_P(n) = -n-2.
                                  $

                                  Thus, our general solution is
                                  $$
                                  f(n) = f_H + f_P = C ,2^n - n - 2.
                                  $$

                                  Using the initial conditions, solve for $C$.






                                  share|cite|improve this answer









                                  $endgroup$



















                                    1














                                    $begingroup$

                                    Your recurrence relation is linear, but not homogeneous.



                                    One approach is as follows: begin by solving the homogeneous recurrence relation,
                                    $$
                                    f(n) = 2 f(n - 1).
                                    $$

                                    We end up with a general solution of $f_H(n) = C2^n$. Now, it suffices to find one "particular solution" to the original non-homogeneous difference equation. Following the method of undetermined coefficients, we take the ansatz
                                    $$
                                    f(n) = an + b implies\
                                    f(n-1) = an + (b-a).
                                    $$

                                    Plugging this in to our recurrence relation yields
                                    $$
                                    f(n) = 2 f(n - 1) + n implies
                                    an + b = 2[an + (b-a)] + nimplies\
                                    an + b = (2a+1)n + 2b-2a implies\
                                    (a + 1)n + (2a-b)= 0
                                    $$

                                    So, $a = -1$, $b = -2$ will work. We can therefore take
                                    $
                                    f_P(n) = -n-2.
                                    $

                                    Thus, our general solution is
                                    $$
                                    f(n) = f_H + f_P = C ,2^n - n - 2.
                                    $$

                                    Using the initial conditions, solve for $C$.






                                    share|cite|improve this answer









                                    $endgroup$

















                                      1














                                      1










                                      1







                                      $begingroup$

                                      Your recurrence relation is linear, but not homogeneous.



                                      One approach is as follows: begin by solving the homogeneous recurrence relation,
                                      $$
                                      f(n) = 2 f(n - 1).
                                      $$

                                      We end up with a general solution of $f_H(n) = C2^n$. Now, it suffices to find one "particular solution" to the original non-homogeneous difference equation. Following the method of undetermined coefficients, we take the ansatz
                                      $$
                                      f(n) = an + b implies\
                                      f(n-1) = an + (b-a).
                                      $$

                                      Plugging this in to our recurrence relation yields
                                      $$
                                      f(n) = 2 f(n - 1) + n implies
                                      an + b = 2[an + (b-a)] + nimplies\
                                      an + b = (2a+1)n + 2b-2a implies\
                                      (a + 1)n + (2a-b)= 0
                                      $$

                                      So, $a = -1$, $b = -2$ will work. We can therefore take
                                      $
                                      f_P(n) = -n-2.
                                      $

                                      Thus, our general solution is
                                      $$
                                      f(n) = f_H + f_P = C ,2^n - n - 2.
                                      $$

                                      Using the initial conditions, solve for $C$.






                                      share|cite|improve this answer









                                      $endgroup$



                                      Your recurrence relation is linear, but not homogeneous.



                                      One approach is as follows: begin by solving the homogeneous recurrence relation,
                                      $$
                                      f(n) = 2 f(n - 1).
                                      $$

                                      We end up with a general solution of $f_H(n) = C2^n$. Now, it suffices to find one "particular solution" to the original non-homogeneous difference equation. Following the method of undetermined coefficients, we take the ansatz
                                      $$
                                      f(n) = an + b implies\
                                      f(n-1) = an + (b-a).
                                      $$

                                      Plugging this in to our recurrence relation yields
                                      $$
                                      f(n) = 2 f(n - 1) + n implies
                                      an + b = 2[an + (b-a)] + nimplies\
                                      an + b = (2a+1)n + 2b-2a implies\
                                      (a + 1)n + (2a-b)= 0
                                      $$

                                      So, $a = -1$, $b = -2$ will work. We can therefore take
                                      $
                                      f_P(n) = -n-2.
                                      $

                                      Thus, our general solution is
                                      $$
                                      f(n) = f_H + f_P = C ,2^n - n - 2.
                                      $$

                                      Using the initial conditions, solve for $C$.







                                      share|cite|improve this answer












                                      share|cite|improve this answer



                                      share|cite|improve this answer










                                      answered 8 hours ago









                                      OmnomnomnomOmnomnomnom

                                      134k7 gold badges99 silver badges199 bronze badges




                                      134k7 gold badges99 silver badges199 bronze badges































                                          draft saved

                                          draft discarded















































                                          Thanks for contributing an answer to Mathematics Stack Exchange!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid


                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.

                                          Use MathJax to format equations. MathJax reference.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3360144%2fsolving-a-nonhomogeneous-linear-recurrence-relation%23new-answer', 'question_page');

                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          ParseJSON using SSJSUsing AMPscript with SSJS ActivitiesHow to resubscribe a user in Marketing cloud using SSJS?Pulling Subscriber Status from Lists using SSJSRetrieving Emails using SSJSProblem in updating DE using SSJSUsing SSJS to send single email in Marketing CloudError adding EmailSendDefinition using SSJS

                                          Кампала Садржај Географија Географија Историја Становништво Привреда Партнерски градови Референце Спољашње везе Мени за навигацију0°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.340°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.34МедијиПодациЗванични веб-сајту

                                          19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу