Simple example of invariants












2












$begingroup$


The combinatorics textbook I'm reading introduces invariants with the following example:




There are three piles with $n$ tokens each. In every step we are allowed
to choose two piles, take one token from each of those two piles and add a token to
the third pile. Using these moves, is it possible to end up having only one token?




Solution: To the tokens in the first pile we can assign the pair $(0, 1)$, to the tokens
in the second pile the pair $(1, 0)$ and to the tokens in the third pile the pair $(1, 1)$.



Notice that the sum modulo $2$ of any two of these pairs give us the third one. Thus,
in every step the sum modulo $2$ of all the assigned pairs is the same. However, the
sum of all the assigned pairs in the beginning is $(2n, 2n)$, which is equal to $(0, 0)$
modulo $2$. Since this pair was not assigned to any pile, it is not possible to end up
with only one token.



Although I already knew what invariants are, I do not understand how they're applied in this specific case, what is the meaning of the pairs that are assigned to each pile, and how is a pair affected by a step?










share|cite|improve this question









$endgroup$

















    2












    $begingroup$


    The combinatorics textbook I'm reading introduces invariants with the following example:




    There are three piles with $n$ tokens each. In every step we are allowed
    to choose two piles, take one token from each of those two piles and add a token to
    the third pile. Using these moves, is it possible to end up having only one token?




    Solution: To the tokens in the first pile we can assign the pair $(0, 1)$, to the tokens
    in the second pile the pair $(1, 0)$ and to the tokens in the third pile the pair $(1, 1)$.



    Notice that the sum modulo $2$ of any two of these pairs give us the third one. Thus,
    in every step the sum modulo $2$ of all the assigned pairs is the same. However, the
    sum of all the assigned pairs in the beginning is $(2n, 2n)$, which is equal to $(0, 0)$
    modulo $2$. Since this pair was not assigned to any pile, it is not possible to end up
    with only one token.



    Although I already knew what invariants are, I do not understand how they're applied in this specific case, what is the meaning of the pairs that are assigned to each pile, and how is a pair affected by a step?










    share|cite|improve this question









    $endgroup$















      2












      2








      2





      $begingroup$


      The combinatorics textbook I'm reading introduces invariants with the following example:




      There are three piles with $n$ tokens each. In every step we are allowed
      to choose two piles, take one token from each of those two piles and add a token to
      the third pile. Using these moves, is it possible to end up having only one token?




      Solution: To the tokens in the first pile we can assign the pair $(0, 1)$, to the tokens
      in the second pile the pair $(1, 0)$ and to the tokens in the third pile the pair $(1, 1)$.



      Notice that the sum modulo $2$ of any two of these pairs give us the third one. Thus,
      in every step the sum modulo $2$ of all the assigned pairs is the same. However, the
      sum of all the assigned pairs in the beginning is $(2n, 2n)$, which is equal to $(0, 0)$
      modulo $2$. Since this pair was not assigned to any pile, it is not possible to end up
      with only one token.



      Although I already knew what invariants are, I do not understand how they're applied in this specific case, what is the meaning of the pairs that are assigned to each pile, and how is a pair affected by a step?










      share|cite|improve this question









      $endgroup$




      The combinatorics textbook I'm reading introduces invariants with the following example:




      There are three piles with $n$ tokens each. In every step we are allowed
      to choose two piles, take one token from each of those two piles and add a token to
      the third pile. Using these moves, is it possible to end up having only one token?




      Solution: To the tokens in the first pile we can assign the pair $(0, 1)$, to the tokens
      in the second pile the pair $(1, 0)$ and to the tokens in the third pile the pair $(1, 1)$.



      Notice that the sum modulo $2$ of any two of these pairs give us the third one. Thus,
      in every step the sum modulo $2$ of all the assigned pairs is the same. However, the
      sum of all the assigned pairs in the beginning is $(2n, 2n)$, which is equal to $(0, 0)$
      modulo $2$. Since this pair was not assigned to any pile, it is not possible to end up
      with only one token.



      Although I already knew what invariants are, I do not understand how they're applied in this specific case, what is the meaning of the pairs that are assigned to each pile, and how is a pair affected by a step?







      combinatorics invariance






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Jan 19 at 14:10









      Spasoje DurovicSpasoje Durovic

      36510




      36510






















          2 Answers
          2






          active

          oldest

          votes


















          2












          $begingroup$

          The solution can be simplified. The invariant is the condition that all three piles have the same parity of tokens. The initial state is all three piles have $,n,$ tokens which implies the invariant condition is true. In each step, the parity of each pile is changed from even to odd or odd to even, and therefore if the invariant condition is true before the step, then it is true after the step. By induction, the invariant condition always is true. Thus, if there is only one token left, the three parities are even, even, and odd and the invariant condition is false.






          share|cite|improve this answer









          $endgroup$





















            1












            $begingroup$

            Let $a,b,c$ be the number of tokens in the first, second and third pile. Observe that in each step, the parity of $a+b$, $a+c$ are preserved after the operation. Let us make this observation formal. We have $2$ dimensional data $$(a+b,a+c)=a(1,1)+b(1,0)+c(0,1).$$ Since we are tracking its parity, we have this vector in $Bbb Z_2times Bbb Z_2$, i.e. in modulo $2$. This gives us the introduced invariant
            $$
            I=a(1,1)+b(1,0)+c(0,1)quad(text{mod }2).
            $$






            share|cite|improve this answer









            $endgroup$













              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',
              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/3.0/"u003ecc by-sa 3.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%2f3079386%2fsimple-example-of-invariants%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2












              $begingroup$

              The solution can be simplified. The invariant is the condition that all three piles have the same parity of tokens. The initial state is all three piles have $,n,$ tokens which implies the invariant condition is true. In each step, the parity of each pile is changed from even to odd or odd to even, and therefore if the invariant condition is true before the step, then it is true after the step. By induction, the invariant condition always is true. Thus, if there is only one token left, the three parities are even, even, and odd and the invariant condition is false.






              share|cite|improve this answer









              $endgroup$


















                2












                $begingroup$

                The solution can be simplified. The invariant is the condition that all three piles have the same parity of tokens. The initial state is all three piles have $,n,$ tokens which implies the invariant condition is true. In each step, the parity of each pile is changed from even to odd or odd to even, and therefore if the invariant condition is true before the step, then it is true after the step. By induction, the invariant condition always is true. Thus, if there is only one token left, the three parities are even, even, and odd and the invariant condition is false.






                share|cite|improve this answer









                $endgroup$
















                  2












                  2








                  2





                  $begingroup$

                  The solution can be simplified. The invariant is the condition that all three piles have the same parity of tokens. The initial state is all three piles have $,n,$ tokens which implies the invariant condition is true. In each step, the parity of each pile is changed from even to odd or odd to even, and therefore if the invariant condition is true before the step, then it is true after the step. By induction, the invariant condition always is true. Thus, if there is only one token left, the three parities are even, even, and odd and the invariant condition is false.






                  share|cite|improve this answer









                  $endgroup$



                  The solution can be simplified. The invariant is the condition that all three piles have the same parity of tokens. The initial state is all three piles have $,n,$ tokens which implies the invariant condition is true. In each step, the parity of each pile is changed from even to odd or odd to even, and therefore if the invariant condition is true before the step, then it is true after the step. By induction, the invariant condition always is true. Thus, if there is only one token left, the three parities are even, even, and odd and the invariant condition is false.







                  share|cite|improve this answer












                  share|cite|improve this answer



                  share|cite|improve this answer










                  answered Jan 19 at 14:37









                  SomosSomos

                  13.8k11235




                  13.8k11235























                      1












                      $begingroup$

                      Let $a,b,c$ be the number of tokens in the first, second and third pile. Observe that in each step, the parity of $a+b$, $a+c$ are preserved after the operation. Let us make this observation formal. We have $2$ dimensional data $$(a+b,a+c)=a(1,1)+b(1,0)+c(0,1).$$ Since we are tracking its parity, we have this vector in $Bbb Z_2times Bbb Z_2$, i.e. in modulo $2$. This gives us the introduced invariant
                      $$
                      I=a(1,1)+b(1,0)+c(0,1)quad(text{mod }2).
                      $$






                      share|cite|improve this answer









                      $endgroup$


















                        1












                        $begingroup$

                        Let $a,b,c$ be the number of tokens in the first, second and third pile. Observe that in each step, the parity of $a+b$, $a+c$ are preserved after the operation. Let us make this observation formal. We have $2$ dimensional data $$(a+b,a+c)=a(1,1)+b(1,0)+c(0,1).$$ Since we are tracking its parity, we have this vector in $Bbb Z_2times Bbb Z_2$, i.e. in modulo $2$. This gives us the introduced invariant
                        $$
                        I=a(1,1)+b(1,0)+c(0,1)quad(text{mod }2).
                        $$






                        share|cite|improve this answer









                        $endgroup$
















                          1












                          1








                          1





                          $begingroup$

                          Let $a,b,c$ be the number of tokens in the first, second and third pile. Observe that in each step, the parity of $a+b$, $a+c$ are preserved after the operation. Let us make this observation formal. We have $2$ dimensional data $$(a+b,a+c)=a(1,1)+b(1,0)+c(0,1).$$ Since we are tracking its parity, we have this vector in $Bbb Z_2times Bbb Z_2$, i.e. in modulo $2$. This gives us the introduced invariant
                          $$
                          I=a(1,1)+b(1,0)+c(0,1)quad(text{mod }2).
                          $$






                          share|cite|improve this answer









                          $endgroup$



                          Let $a,b,c$ be the number of tokens in the first, second and third pile. Observe that in each step, the parity of $a+b$, $a+c$ are preserved after the operation. Let us make this observation formal. We have $2$ dimensional data $$(a+b,a+c)=a(1,1)+b(1,0)+c(0,1).$$ Since we are tracking its parity, we have this vector in $Bbb Z_2times Bbb Z_2$, i.e. in modulo $2$. This gives us the introduced invariant
                          $$
                          I=a(1,1)+b(1,0)+c(0,1)quad(text{mod }2).
                          $$







                          share|cite|improve this answer












                          share|cite|improve this answer



                          share|cite|improve this answer










                          answered Jan 19 at 14:26









                          SongSong

                          13.2k632




                          13.2k632






























                              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%2f3079386%2fsimple-example-of-invariants%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

                              Human spaceflight

                              Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                              張江高科駅