Using a summation factor to solve a recurrence

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












On Princeton's Analysis of Algorithms, they discuss solving recurrence relations and they come across a line that I can't seem to decipher



beginalign
n(n-1)a_n &=(n-1)(n-2)a_n-1 + 2(n-1)\
&=(n-2)(n-3)a_n-2+2(n-2)+2(n-1)\
&=2(1+2+cdots+n-1)\
&=n(n-1)\
a_n&=1
endalign



Basically lines (1) through (4) I am not sure how they are making those simplifications. If it's a matter of reading up on some literature a reference would be greatly appreciated.







share|cite|improve this question





















  • It's easier to follow if you first define $,b_colorredn = colorredn(colorredn-1)a_colorredn-1,$. Then changing $,n mapsto n-1,$ gives $,b_colorredn-1 = colorred(n-1)(colorredn-1-1)a_colorredn-1-1$ $=(n-1)(n-2)a_n-2,$, so the recurrence can be written as $,b_n = b_n-1+2(n-1),$, then it telescopes from there on.
    – dxiv
    Jul 26 at 0:32















up vote
0
down vote

favorite












On Princeton's Analysis of Algorithms, they discuss solving recurrence relations and they come across a line that I can't seem to decipher



beginalign
n(n-1)a_n &=(n-1)(n-2)a_n-1 + 2(n-1)\
&=(n-2)(n-3)a_n-2+2(n-2)+2(n-1)\
&=2(1+2+cdots+n-1)\
&=n(n-1)\
a_n&=1
endalign



Basically lines (1) through (4) I am not sure how they are making those simplifications. If it's a matter of reading up on some literature a reference would be greatly appreciated.







share|cite|improve this question





















  • It's easier to follow if you first define $,b_colorredn = colorredn(colorredn-1)a_colorredn-1,$. Then changing $,n mapsto n-1,$ gives $,b_colorredn-1 = colorred(n-1)(colorredn-1-1)a_colorredn-1-1$ $=(n-1)(n-2)a_n-2,$, so the recurrence can be written as $,b_n = b_n-1+2(n-1),$, then it telescopes from there on.
    – dxiv
    Jul 26 at 0:32













up vote
0
down vote

favorite









up vote
0
down vote

favorite











On Princeton's Analysis of Algorithms, they discuss solving recurrence relations and they come across a line that I can't seem to decipher



beginalign
n(n-1)a_n &=(n-1)(n-2)a_n-1 + 2(n-1)\
&=(n-2)(n-3)a_n-2+2(n-2)+2(n-1)\
&=2(1+2+cdots+n-1)\
&=n(n-1)\
a_n&=1
endalign



Basically lines (1) through (4) I am not sure how they are making those simplifications. If it's a matter of reading up on some literature a reference would be greatly appreciated.







share|cite|improve this question













On Princeton's Analysis of Algorithms, they discuss solving recurrence relations and they come across a line that I can't seem to decipher



beginalign
n(n-1)a_n &=(n-1)(n-2)a_n-1 + 2(n-1)\
&=(n-2)(n-3)a_n-2+2(n-2)+2(n-1)\
&=2(1+2+cdots+n-1)\
&=n(n-1)\
a_n&=1
endalign



Basically lines (1) through (4) I am not sure how they are making those simplifications. If it's a matter of reading up on some literature a reference would be greatly appreciated.









share|cite|improve this question












share|cite|improve this question




share|cite|improve this question








edited Jul 26 at 0:35









David K

48.1k340107




48.1k340107









asked Jul 26 at 0:24









phandaman

676




676











  • It's easier to follow if you first define $,b_colorredn = colorredn(colorredn-1)a_colorredn-1,$. Then changing $,n mapsto n-1,$ gives $,b_colorredn-1 = colorred(n-1)(colorredn-1-1)a_colorredn-1-1$ $=(n-1)(n-2)a_n-2,$, so the recurrence can be written as $,b_n = b_n-1+2(n-1),$, then it telescopes from there on.
    – dxiv
    Jul 26 at 0:32

















  • It's easier to follow if you first define $,b_colorredn = colorredn(colorredn-1)a_colorredn-1,$. Then changing $,n mapsto n-1,$ gives $,b_colorredn-1 = colorred(n-1)(colorredn-1-1)a_colorredn-1-1$ $=(n-1)(n-2)a_n-2,$, so the recurrence can be written as $,b_n = b_n-1+2(n-1),$, then it telescopes from there on.
    – dxiv
    Jul 26 at 0:32
















It's easier to follow if you first define $,b_colorredn = colorredn(colorredn-1)a_colorredn-1,$. Then changing $,n mapsto n-1,$ gives $,b_colorredn-1 = colorred(n-1)(colorredn-1-1)a_colorredn-1-1$ $=(n-1)(n-2)a_n-2,$, so the recurrence can be written as $,b_n = b_n-1+2(n-1),$, then it telescopes from there on.
– dxiv
Jul 26 at 0:32





It's easier to follow if you first define $,b_colorredn = colorredn(colorredn-1)a_colorredn-1,$. Then changing $,n mapsto n-1,$ gives $,b_colorredn-1 = colorred(n-1)(colorredn-1-1)a_colorredn-1-1$ $=(n-1)(n-2)a_n-2,$, so the recurrence can be written as $,b_n = b_n-1+2(n-1),$, then it telescopes from there on.
– dxiv
Jul 26 at 0:32











3 Answers
3






active

oldest

votes

















up vote
2
down vote



accepted










$$
n(n-1)a_n = (n-1)(n-2)a_n-1+2(n-1)
$$



Let $m = n-1$, then $(n-1)(n-2)a_n-1 = m(m-1)a_m$. From this, we can apply the recurrence again.



$$
n(n-1)a_n = [(m-1)(m-2)a_m-1+2(m-1)]+2(n-1)
$$



Then let $k = m-1$, then $(m-1)(m-2)a_m-1 = k(k-1)a_k$. We apply the recurrence again.



$$
n(n-1)a_n = left[[(k-1)(k-2)a_k-1+2(k-1)]+2(m-1)right]+2(n-1)
$$



And so on. Each time, we add another constant term on the right: first $2(n-1)$, then $2(m-1) = 2(n-2)$, then $2(k-1) = 2(n-3)$. This continues until we run out of positive terms.






share|cite|improve this answer




























    up vote
    1
    down vote













    The equality in line (2) just plugs in the definition of (1) back into the r.h.s. E.g. $(n-1)(n-2)a_n-1 = (n-2)(n-3)a_n-2+2(n-2)$.



    The equality in line (3) comes from repeated use of (1). E.g:



    $n(n-1)a_n = (n-k)(n-k+1)a_n-k + sum_i=1^k 2(n-i)$.



    Can you take it from here?



    If it helps, define $y_n:=n(n-1)a_n$. Then the recursion is rewritten to be $y_n=y_n-1+2(n-1)$. Then $y_n-y_n-1=2(n-1)$. Now sum both sides from $n=1$ to $n$. The left side will telescope.



    Once you solve for $y_n$, you can then solve for $a_n$.






    share|cite|improve this answer





















    • I see that you are plugging in the recurrence relationship between lines 1 and 2 and lines 3 to 4 is basically the sum of the first $n$ integers with a factor of 2. The step in between 2 and 3 is still elusive. How does applying the recurrence relation many times get rid of the $a_n-k$ dependence and give you a sum from $n=1$ to $n-1$?
      – phandaman
      Jul 26 at 2:28










    • @phandaman: see the second part with $y_n$.
      – Alex R.
      Jul 26 at 6:43

















    up vote
    0
    down vote













    What this means is that if the first line is true for all $n$, then by induction you can prove that $n(n-1)a_n=n(n-1)$ and derive that $a_n=1$ for all $n$.



    Implicitly the assumption $a_1=1$ must have been made somewhere above in the text.






    share|cite|improve this answer





















      Your Answer




      StackExchange.ifUsing("editor", function ()
      return StackExchange.using("mathjaxEditing", function ()
      StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
      StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
      );
      );
      , "mathjax-editing");

      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',
      convertImagesToLinks: true,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      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%2f2862960%2fusing-a-summation-factor-to-solve-a-recurrence%23new-answer', 'question_page');

      );

      Post as a guest






























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      2
      down vote



      accepted










      $$
      n(n-1)a_n = (n-1)(n-2)a_n-1+2(n-1)
      $$



      Let $m = n-1$, then $(n-1)(n-2)a_n-1 = m(m-1)a_m$. From this, we can apply the recurrence again.



      $$
      n(n-1)a_n = [(m-1)(m-2)a_m-1+2(m-1)]+2(n-1)
      $$



      Then let $k = m-1$, then $(m-1)(m-2)a_m-1 = k(k-1)a_k$. We apply the recurrence again.



      $$
      n(n-1)a_n = left[[(k-1)(k-2)a_k-1+2(k-1)]+2(m-1)right]+2(n-1)
      $$



      And so on. Each time, we add another constant term on the right: first $2(n-1)$, then $2(m-1) = 2(n-2)$, then $2(k-1) = 2(n-3)$. This continues until we run out of positive terms.






      share|cite|improve this answer

























        up vote
        2
        down vote



        accepted










        $$
        n(n-1)a_n = (n-1)(n-2)a_n-1+2(n-1)
        $$



        Let $m = n-1$, then $(n-1)(n-2)a_n-1 = m(m-1)a_m$. From this, we can apply the recurrence again.



        $$
        n(n-1)a_n = [(m-1)(m-2)a_m-1+2(m-1)]+2(n-1)
        $$



        Then let $k = m-1$, then $(m-1)(m-2)a_m-1 = k(k-1)a_k$. We apply the recurrence again.



        $$
        n(n-1)a_n = left[[(k-1)(k-2)a_k-1+2(k-1)]+2(m-1)right]+2(n-1)
        $$



        And so on. Each time, we add another constant term on the right: first $2(n-1)$, then $2(m-1) = 2(n-2)$, then $2(k-1) = 2(n-3)$. This continues until we run out of positive terms.






        share|cite|improve this answer























          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          $$
          n(n-1)a_n = (n-1)(n-2)a_n-1+2(n-1)
          $$



          Let $m = n-1$, then $(n-1)(n-2)a_n-1 = m(m-1)a_m$. From this, we can apply the recurrence again.



          $$
          n(n-1)a_n = [(m-1)(m-2)a_m-1+2(m-1)]+2(n-1)
          $$



          Then let $k = m-1$, then $(m-1)(m-2)a_m-1 = k(k-1)a_k$. We apply the recurrence again.



          $$
          n(n-1)a_n = left[[(k-1)(k-2)a_k-1+2(k-1)]+2(m-1)right]+2(n-1)
          $$



          And so on. Each time, we add another constant term on the right: first $2(n-1)$, then $2(m-1) = 2(n-2)$, then $2(k-1) = 2(n-3)$. This continues until we run out of positive terms.






          share|cite|improve this answer













          $$
          n(n-1)a_n = (n-1)(n-2)a_n-1+2(n-1)
          $$



          Let $m = n-1$, then $(n-1)(n-2)a_n-1 = m(m-1)a_m$. From this, we can apply the recurrence again.



          $$
          n(n-1)a_n = [(m-1)(m-2)a_m-1+2(m-1)]+2(n-1)
          $$



          Then let $k = m-1$, then $(m-1)(m-2)a_m-1 = k(k-1)a_k$. We apply the recurrence again.



          $$
          n(n-1)a_n = left[[(k-1)(k-2)a_k-1+2(k-1)]+2(m-1)right]+2(n-1)
          $$



          And so on. Each time, we add another constant term on the right: first $2(n-1)$, then $2(m-1) = 2(n-2)$, then $2(k-1) = 2(n-3)$. This continues until we run out of positive terms.







          share|cite|improve this answer













          share|cite|improve this answer



          share|cite|improve this answer











          answered Jul 26 at 0:30









          Brian Tung

          25.2k32353




          25.2k32353




















              up vote
              1
              down vote













              The equality in line (2) just plugs in the definition of (1) back into the r.h.s. E.g. $(n-1)(n-2)a_n-1 = (n-2)(n-3)a_n-2+2(n-2)$.



              The equality in line (3) comes from repeated use of (1). E.g:



              $n(n-1)a_n = (n-k)(n-k+1)a_n-k + sum_i=1^k 2(n-i)$.



              Can you take it from here?



              If it helps, define $y_n:=n(n-1)a_n$. Then the recursion is rewritten to be $y_n=y_n-1+2(n-1)$. Then $y_n-y_n-1=2(n-1)$. Now sum both sides from $n=1$ to $n$. The left side will telescope.



              Once you solve for $y_n$, you can then solve for $a_n$.






              share|cite|improve this answer





















              • I see that you are plugging in the recurrence relationship between lines 1 and 2 and lines 3 to 4 is basically the sum of the first $n$ integers with a factor of 2. The step in between 2 and 3 is still elusive. How does applying the recurrence relation many times get rid of the $a_n-k$ dependence and give you a sum from $n=1$ to $n-1$?
                – phandaman
                Jul 26 at 2:28










              • @phandaman: see the second part with $y_n$.
                – Alex R.
                Jul 26 at 6:43














              up vote
              1
              down vote













              The equality in line (2) just plugs in the definition of (1) back into the r.h.s. E.g. $(n-1)(n-2)a_n-1 = (n-2)(n-3)a_n-2+2(n-2)$.



              The equality in line (3) comes from repeated use of (1). E.g:



              $n(n-1)a_n = (n-k)(n-k+1)a_n-k + sum_i=1^k 2(n-i)$.



              Can you take it from here?



              If it helps, define $y_n:=n(n-1)a_n$. Then the recursion is rewritten to be $y_n=y_n-1+2(n-1)$. Then $y_n-y_n-1=2(n-1)$. Now sum both sides from $n=1$ to $n$. The left side will telescope.



              Once you solve for $y_n$, you can then solve for $a_n$.






              share|cite|improve this answer





















              • I see that you are plugging in the recurrence relationship between lines 1 and 2 and lines 3 to 4 is basically the sum of the first $n$ integers with a factor of 2. The step in between 2 and 3 is still elusive. How does applying the recurrence relation many times get rid of the $a_n-k$ dependence and give you a sum from $n=1$ to $n-1$?
                – phandaman
                Jul 26 at 2:28










              • @phandaman: see the second part with $y_n$.
                – Alex R.
                Jul 26 at 6:43












              up vote
              1
              down vote










              up vote
              1
              down vote









              The equality in line (2) just plugs in the definition of (1) back into the r.h.s. E.g. $(n-1)(n-2)a_n-1 = (n-2)(n-3)a_n-2+2(n-2)$.



              The equality in line (3) comes from repeated use of (1). E.g:



              $n(n-1)a_n = (n-k)(n-k+1)a_n-k + sum_i=1^k 2(n-i)$.



              Can you take it from here?



              If it helps, define $y_n:=n(n-1)a_n$. Then the recursion is rewritten to be $y_n=y_n-1+2(n-1)$. Then $y_n-y_n-1=2(n-1)$. Now sum both sides from $n=1$ to $n$. The left side will telescope.



              Once you solve for $y_n$, you can then solve for $a_n$.






              share|cite|improve this answer













              The equality in line (2) just plugs in the definition of (1) back into the r.h.s. E.g. $(n-1)(n-2)a_n-1 = (n-2)(n-3)a_n-2+2(n-2)$.



              The equality in line (3) comes from repeated use of (1). E.g:



              $n(n-1)a_n = (n-k)(n-k+1)a_n-k + sum_i=1^k 2(n-i)$.



              Can you take it from here?



              If it helps, define $y_n:=n(n-1)a_n$. Then the recursion is rewritten to be $y_n=y_n-1+2(n-1)$. Then $y_n-y_n-1=2(n-1)$. Now sum both sides from $n=1$ to $n$. The left side will telescope.



              Once you solve for $y_n$, you can then solve for $a_n$.







              share|cite|improve this answer













              share|cite|improve this answer



              share|cite|improve this answer











              answered Jul 26 at 0:29









              Alex R.

              23.7k12352




              23.7k12352











              • I see that you are plugging in the recurrence relationship between lines 1 and 2 and lines 3 to 4 is basically the sum of the first $n$ integers with a factor of 2. The step in between 2 and 3 is still elusive. How does applying the recurrence relation many times get rid of the $a_n-k$ dependence and give you a sum from $n=1$ to $n-1$?
                – phandaman
                Jul 26 at 2:28










              • @phandaman: see the second part with $y_n$.
                – Alex R.
                Jul 26 at 6:43
















              • I see that you are plugging in the recurrence relationship between lines 1 and 2 and lines 3 to 4 is basically the sum of the first $n$ integers with a factor of 2. The step in between 2 and 3 is still elusive. How does applying the recurrence relation many times get rid of the $a_n-k$ dependence and give you a sum from $n=1$ to $n-1$?
                – phandaman
                Jul 26 at 2:28










              • @phandaman: see the second part with $y_n$.
                – Alex R.
                Jul 26 at 6:43















              I see that you are plugging in the recurrence relationship between lines 1 and 2 and lines 3 to 4 is basically the sum of the first $n$ integers with a factor of 2. The step in between 2 and 3 is still elusive. How does applying the recurrence relation many times get rid of the $a_n-k$ dependence and give you a sum from $n=1$ to $n-1$?
              – phandaman
              Jul 26 at 2:28




              I see that you are plugging in the recurrence relationship between lines 1 and 2 and lines 3 to 4 is basically the sum of the first $n$ integers with a factor of 2. The step in between 2 and 3 is still elusive. How does applying the recurrence relation many times get rid of the $a_n-k$ dependence and give you a sum from $n=1$ to $n-1$?
              – phandaman
              Jul 26 at 2:28












              @phandaman: see the second part with $y_n$.
              – Alex R.
              Jul 26 at 6:43




              @phandaman: see the second part with $y_n$.
              – Alex R.
              Jul 26 at 6:43










              up vote
              0
              down vote













              What this means is that if the first line is true for all $n$, then by induction you can prove that $n(n-1)a_n=n(n-1)$ and derive that $a_n=1$ for all $n$.



              Implicitly the assumption $a_1=1$ must have been made somewhere above in the text.






              share|cite|improve this answer

























                up vote
                0
                down vote













                What this means is that if the first line is true for all $n$, then by induction you can prove that $n(n-1)a_n=n(n-1)$ and derive that $a_n=1$ for all $n$.



                Implicitly the assumption $a_1=1$ must have been made somewhere above in the text.






                share|cite|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  What this means is that if the first line is true for all $n$, then by induction you can prove that $n(n-1)a_n=n(n-1)$ and derive that $a_n=1$ for all $n$.



                  Implicitly the assumption $a_1=1$ must have been made somewhere above in the text.






                  share|cite|improve this answer













                  What this means is that if the first line is true for all $n$, then by induction you can prove that $n(n-1)a_n=n(n-1)$ and derive that $a_n=1$ for all $n$.



                  Implicitly the assumption $a_1=1$ must have been made somewhere above in the text.







                  share|cite|improve this answer













                  share|cite|improve this answer



                  share|cite|improve this answer











                  answered Jul 26 at 0:31









                  Arnaud Mortier

                  18.7k22159




                  18.7k22159






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2862960%2fusing-a-summation-factor-to-solve-a-recurrence%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Comments

                      Popular posts from this blog

                      What is the equation of a 3D cone with generalised tilt?

                      Color the edges and diagonals of a regular polygon

                      Relationship between determinant of matrix and determinant of adjoint?