Find the binary input function given the outputs












0












$begingroup$


Here we have three binary variables $x_1$, $x_2$, $x_3$ $in {0,1}$.

I want to find the form of the function $f(x_1, x_2, x_3)$ such that the following are satisfied:



if $ x_1 = 0, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 0$

if $ x_1 = 0, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$

if $ x_1 = 0, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$

if $ x_1 = 0, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$

if $ x_1 = 1, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 1$

if $ x_1 = 1, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$

if $ x_1 = 1, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$

if $ x_1 = 1, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$



I imagine it like having a "virtual sum" which is increased by one each step in the sequence. Every time I see a one, this virtual sum "becomes real" and is zeroed. For instance:





  • $ x_1 = 0, x_2 = 0, x_3 = 1 $. After seeing the first zero the virtual sum is 1. After the second zero the virtual sum is 2. Finally there is a one, so the virtual sum becomes 3 and is reset. The final result is 3.


  • $ x_1 = 0, x_2 = 0, x_3 = 0 $ We have three zero, so the virtual sum is 3 at the end of the sequence. However, since there are no ones it does not "become real" and the result is 0.


In the two variables case it is enough to write $f(x_1, x_2) = x_1 + x_2$, but in higher dimensions things start to become more difficult.










share|cite|improve this question











$endgroup$

















    0












    $begingroup$


    Here we have three binary variables $x_1$, $x_2$, $x_3$ $in {0,1}$.

    I want to find the form of the function $f(x_1, x_2, x_3)$ such that the following are satisfied:



    if $ x_1 = 0, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 0$

    if $ x_1 = 0, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$

    if $ x_1 = 0, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$

    if $ x_1 = 0, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$

    if $ x_1 = 1, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 1$

    if $ x_1 = 1, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$

    if $ x_1 = 1, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$

    if $ x_1 = 1, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$



    I imagine it like having a "virtual sum" which is increased by one each step in the sequence. Every time I see a one, this virtual sum "becomes real" and is zeroed. For instance:





    • $ x_1 = 0, x_2 = 0, x_3 = 1 $. After seeing the first zero the virtual sum is 1. After the second zero the virtual sum is 2. Finally there is a one, so the virtual sum becomes 3 and is reset. The final result is 3.


    • $ x_1 = 0, x_2 = 0, x_3 = 0 $ We have three zero, so the virtual sum is 3 at the end of the sequence. However, since there are no ones it does not "become real" and the result is 0.


    In the two variables case it is enough to write $f(x_1, x_2) = x_1 + x_2$, but in higher dimensions things start to become more difficult.










    share|cite|improve this question











    $endgroup$















      0












      0








      0


      1



      $begingroup$


      Here we have three binary variables $x_1$, $x_2$, $x_3$ $in {0,1}$.

      I want to find the form of the function $f(x_1, x_2, x_3)$ such that the following are satisfied:



      if $ x_1 = 0, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 0$

      if $ x_1 = 0, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$

      if $ x_1 = 0, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$

      if $ x_1 = 0, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$

      if $ x_1 = 1, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 1$

      if $ x_1 = 1, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$

      if $ x_1 = 1, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$

      if $ x_1 = 1, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$



      I imagine it like having a "virtual sum" which is increased by one each step in the sequence. Every time I see a one, this virtual sum "becomes real" and is zeroed. For instance:





      • $ x_1 = 0, x_2 = 0, x_3 = 1 $. After seeing the first zero the virtual sum is 1. After the second zero the virtual sum is 2. Finally there is a one, so the virtual sum becomes 3 and is reset. The final result is 3.


      • $ x_1 = 0, x_2 = 0, x_3 = 0 $ We have three zero, so the virtual sum is 3 at the end of the sequence. However, since there are no ones it does not "become real" and the result is 0.


      In the two variables case it is enough to write $f(x_1, x_2) = x_1 + x_2$, but in higher dimensions things start to become more difficult.










      share|cite|improve this question











      $endgroup$




      Here we have three binary variables $x_1$, $x_2$, $x_3$ $in {0,1}$.

      I want to find the form of the function $f(x_1, x_2, x_3)$ such that the following are satisfied:



      if $ x_1 = 0, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 0$

      if $ x_1 = 0, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$

      if $ x_1 = 0, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$

      if $ x_1 = 0, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$

      if $ x_1 = 1, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 1$

      if $ x_1 = 1, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$

      if $ x_1 = 1, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$

      if $ x_1 = 1, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$



      I imagine it like having a "virtual sum" which is increased by one each step in the sequence. Every time I see a one, this virtual sum "becomes real" and is zeroed. For instance:





      • $ x_1 = 0, x_2 = 0, x_3 = 1 $. After seeing the first zero the virtual sum is 1. After the second zero the virtual sum is 2. Finally there is a one, so the virtual sum becomes 3 and is reset. The final result is 3.


      • $ x_1 = 0, x_2 = 0, x_3 = 0 $ We have three zero, so the virtual sum is 3 at the end of the sequence. However, since there are no ones it does not "become real" and the result is 0.


      In the two variables case it is enough to write $f(x_1, x_2) = x_1 + x_2$, but in higher dimensions things start to become more difficult.







      combinatorics binary binary-operations






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Dec 17 '18 at 21:32







      aprospero

















      asked Dec 17 '18 at 21:08









      aprosperoaprospero

      103




      103






















          2 Answers
          2






          active

          oldest

          votes


















          0












          $begingroup$

          What you are looking for is simply the last bit set.



          You can reverse this, and instead count the sequence of zeroes at the end instead. This has a simple pattern:




          1. At least one zero at the end: $(1 - x_3)$.


          2. At least two zeroes at the end: $(1 - x_3)(1 - x_2)$.


          3. At least three zeroes at the end: $(1 - x_3)(1 - x_2)(1 - x_1)$.



          So we get our total expression as:



          $$3 - (1 - x_3) - (1 - x_3)(1 - x_2) - (1 - x_3)(1 - x_2)(1 - x_1)$$






          share|cite|improve this answer









          $endgroup$





















            0












            $begingroup$

            If you sort in ascending order of $f$, you can think $f(x_1, x_2, x_3)$ as the maximum index of the variable on, i.e.
            $f(x_1, x_2, x_3)=max{i, :, x_i=1}$






            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%2f3044441%2ffind-the-binary-input-function-given-the-outputs%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









              0












              $begingroup$

              What you are looking for is simply the last bit set.



              You can reverse this, and instead count the sequence of zeroes at the end instead. This has a simple pattern:




              1. At least one zero at the end: $(1 - x_3)$.


              2. At least two zeroes at the end: $(1 - x_3)(1 - x_2)$.


              3. At least three zeroes at the end: $(1 - x_3)(1 - x_2)(1 - x_1)$.



              So we get our total expression as:



              $$3 - (1 - x_3) - (1 - x_3)(1 - x_2) - (1 - x_3)(1 - x_2)(1 - x_1)$$






              share|cite|improve this answer









              $endgroup$


















                0












                $begingroup$

                What you are looking for is simply the last bit set.



                You can reverse this, and instead count the sequence of zeroes at the end instead. This has a simple pattern:




                1. At least one zero at the end: $(1 - x_3)$.


                2. At least two zeroes at the end: $(1 - x_3)(1 - x_2)$.


                3. At least three zeroes at the end: $(1 - x_3)(1 - x_2)(1 - x_1)$.



                So we get our total expression as:



                $$3 - (1 - x_3) - (1 - x_3)(1 - x_2) - (1 - x_3)(1 - x_2)(1 - x_1)$$






                share|cite|improve this answer









                $endgroup$
















                  0












                  0








                  0





                  $begingroup$

                  What you are looking for is simply the last bit set.



                  You can reverse this, and instead count the sequence of zeroes at the end instead. This has a simple pattern:




                  1. At least one zero at the end: $(1 - x_3)$.


                  2. At least two zeroes at the end: $(1 - x_3)(1 - x_2)$.


                  3. At least three zeroes at the end: $(1 - x_3)(1 - x_2)(1 - x_1)$.



                  So we get our total expression as:



                  $$3 - (1 - x_3) - (1 - x_3)(1 - x_2) - (1 - x_3)(1 - x_2)(1 - x_1)$$






                  share|cite|improve this answer









                  $endgroup$



                  What you are looking for is simply the last bit set.



                  You can reverse this, and instead count the sequence of zeroes at the end instead. This has a simple pattern:




                  1. At least one zero at the end: $(1 - x_3)$.


                  2. At least two zeroes at the end: $(1 - x_3)(1 - x_2)$.


                  3. At least three zeroes at the end: $(1 - x_3)(1 - x_2)(1 - x_1)$.



                  So we get our total expression as:



                  $$3 - (1 - x_3) - (1 - x_3)(1 - x_2) - (1 - x_3)(1 - x_2)(1 - x_1)$$







                  share|cite|improve this answer












                  share|cite|improve this answer



                  share|cite|improve this answer










                  answered Dec 17 '18 at 21:41









                  orlporlp

                  7,5791433




                  7,5791433























                      0












                      $begingroup$

                      If you sort in ascending order of $f$, you can think $f(x_1, x_2, x_3)$ as the maximum index of the variable on, i.e.
                      $f(x_1, x_2, x_3)=max{i, :, x_i=1}$






                      share|cite|improve this answer









                      $endgroup$


















                        0












                        $begingroup$

                        If you sort in ascending order of $f$, you can think $f(x_1, x_2, x_3)$ as the maximum index of the variable on, i.e.
                        $f(x_1, x_2, x_3)=max{i, :, x_i=1}$






                        share|cite|improve this answer









                        $endgroup$
















                          0












                          0








                          0





                          $begingroup$

                          If you sort in ascending order of $f$, you can think $f(x_1, x_2, x_3)$ as the maximum index of the variable on, i.e.
                          $f(x_1, x_2, x_3)=max{i, :, x_i=1}$






                          share|cite|improve this answer









                          $endgroup$



                          If you sort in ascending order of $f$, you can think $f(x_1, x_2, x_3)$ as the maximum index of the variable on, i.e.
                          $f(x_1, x_2, x_3)=max{i, :, x_i=1}$







                          share|cite|improve this answer












                          share|cite|improve this answer



                          share|cite|improve this answer










                          answered Dec 17 '18 at 21:52









                          PiccoloPaoloPiccoloPaolo

                          413




                          413






























                              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%2f3044441%2ffind-the-binary-input-function-given-the-outputs%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

                              Probability when a professor distributes a quiz and homework assignment to a class of n students.

                              Aardman Animations

                              Are they similar matrix