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?

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

What are the end bytes of *.docx file format

4h 40m delay caused by aircraft inspection, Norwegian refuses EU 261/2004 compensation because it turned out there was nothing wrong with the aircraft

Inquiry answerer

What do solvers like Gurobi and CPLEX do when they run into hard instances of MIP

Which museums have artworks of all four ninja turtles' namesakes?

Do household ovens ventilate heat to the outdoors?

What is the origin of the "being immortal sucks" trope?

Algorithm for competing cells of 0s and 1s

Can one guy with a duplicator initiate a nuclear apocalypse?

EU compensation - fire alarm at the Flight Crew's hotel

Regular Expressions with `<` and `?` strange matches

Madrid to London w/ Expired 90/180 days stay as US citizen

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

How to influence manager to not schedule team meetings during lunch?

Is it safe to unplug a blinking USB drive after 'safely' ejecting it?

I feel like most of my characters are the same, what can I do?

Does battery condition have anything to do with macbook pro performance?

Why are two-stroke engines nearly unheard of in aviation?

Why would a fighter use the afterburner and air brakes at the same time?

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

Escape the labyrinth!

Is the name of an interval between two notes unique and absolute?

Temporarily moving a SQL Server 2016 database to SQL Server 2017 and then moving back. Is it possible?



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 8 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

                                          Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                                          Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                                          199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單