Find the binary input function given the outputs (part 2)












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) = 6$

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

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

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

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

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) = 4$

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



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





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


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


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


  • $ x_1 = 0, x_2 = 0, x_3 = 0 $ We have three zeroes, so we get 2 at each step and the sum is 6.


I had already asked a similar question (Find the binary input function given the outputs), which was (brilliantly) solved. This is a generalisation in which the "virtual sum" starts from one rather then zero and that, with respect to the previous question, inverts the binary value of the variables $x_1$, $x_2$, $x_3$.










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) = 6$

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

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

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

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

    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) = 4$

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



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





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


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


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


    • $ x_1 = 0, x_2 = 0, x_3 = 0 $ We have three zeroes, so we get 2 at each step and the sum is 6.


    I had already asked a similar question (Find the binary input function given the outputs), which was (brilliantly) solved. This is a generalisation in which the "virtual sum" starts from one rather then zero and that, with respect to the previous question, inverts the binary value of the variables $x_1$, $x_2$, $x_3$.










    share|cite|improve this question









    $endgroup$















      0












      0








      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) = 6$

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

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

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

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

      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) = 4$

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



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





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


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


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


      • $ x_1 = 0, x_2 = 0, x_3 = 0 $ We have three zeroes, so we get 2 at each step and the sum is 6.


      I had already asked a similar question (Find the binary input function given the outputs), which was (brilliantly) solved. This is a generalisation in which the "virtual sum" starts from one rather then zero and that, with respect to the previous question, inverts the binary value of the variables $x_1$, $x_2$, $x_3$.










      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) = 6$

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

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

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

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

      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) = 4$

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



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





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


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


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


      • $ x_1 = 0, x_2 = 0, x_3 = 0 $ We have three zeroes, so we get 2 at each step and the sum is 6.


      I had already asked a similar question (Find the binary input function given the outputs), which was (brilliantly) solved. This is a generalisation in which the "virtual sum" starts from one rather then zero and that, with respect to the previous question, inverts the binary value of the variables $x_1$, $x_2$, $x_3$.







      combinatorics binary binary-operations






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Jan 16 at 15:58









      aprosperoaprospero

      103




      103






















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          How about (completed) $$f(x_1,x_2,x_3) = 6cdot (1-x_1)(1-x_2)(1-x_3) + 4cdot (1-x_1)(1-x_2)x_3 \+ 5cdot (1-x_1)x_2(1-x_3) + 2cdot (1-x_1)x_2x_3
          +5cdot x_1(1-x_2)(1-x_3) + 3cdot x_1(1-x_2)x_3 + 4cdot x_1x_2(1-x_3) + 0cdot x_1x_2x_3.$$






          share|cite|improve this answer











          $endgroup$













          • $begingroup$
            Is the complete formula $f(x_1,x_2,x_3) = 6(1-x_1)(1-x_2)(1-x_3) + 4(1-x_1)(1-x_2)x_3 + 2(1-x_1)x_2x_3$? Because it doesn't work for many inputs. Try (0,1,0) for example.
            $endgroup$
            – aprospero
            Jan 16 at 16:26










          • $begingroup$
            No I guess you got the idea. You need to complete it.
            $endgroup$
            – Wuestenfux
            Jan 16 at 16:30










          • $begingroup$
            Oooh! I got the point. So it is enough to hardcode the output sequence I want and then simplify the expression. Wow, did not come into my mind! Also I can easily generalise at 4, 5 variables and search for a pattern. Thank you @Wuestenfux, really helpful!
            $endgroup$
            – aprospero
            Jan 16 at 17:06












          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%2f3075908%2ffind-the-binary-input-function-given-the-outputs-part-2%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0












          $begingroup$

          How about (completed) $$f(x_1,x_2,x_3) = 6cdot (1-x_1)(1-x_2)(1-x_3) + 4cdot (1-x_1)(1-x_2)x_3 \+ 5cdot (1-x_1)x_2(1-x_3) + 2cdot (1-x_1)x_2x_3
          +5cdot x_1(1-x_2)(1-x_3) + 3cdot x_1(1-x_2)x_3 + 4cdot x_1x_2(1-x_3) + 0cdot x_1x_2x_3.$$






          share|cite|improve this answer











          $endgroup$













          • $begingroup$
            Is the complete formula $f(x_1,x_2,x_3) = 6(1-x_1)(1-x_2)(1-x_3) + 4(1-x_1)(1-x_2)x_3 + 2(1-x_1)x_2x_3$? Because it doesn't work for many inputs. Try (0,1,0) for example.
            $endgroup$
            – aprospero
            Jan 16 at 16:26










          • $begingroup$
            No I guess you got the idea. You need to complete it.
            $endgroup$
            – Wuestenfux
            Jan 16 at 16:30










          • $begingroup$
            Oooh! I got the point. So it is enough to hardcode the output sequence I want and then simplify the expression. Wow, did not come into my mind! Also I can easily generalise at 4, 5 variables and search for a pattern. Thank you @Wuestenfux, really helpful!
            $endgroup$
            – aprospero
            Jan 16 at 17:06
















          0












          $begingroup$

          How about (completed) $$f(x_1,x_2,x_3) = 6cdot (1-x_1)(1-x_2)(1-x_3) + 4cdot (1-x_1)(1-x_2)x_3 \+ 5cdot (1-x_1)x_2(1-x_3) + 2cdot (1-x_1)x_2x_3
          +5cdot x_1(1-x_2)(1-x_3) + 3cdot x_1(1-x_2)x_3 + 4cdot x_1x_2(1-x_3) + 0cdot x_1x_2x_3.$$






          share|cite|improve this answer











          $endgroup$













          • $begingroup$
            Is the complete formula $f(x_1,x_2,x_3) = 6(1-x_1)(1-x_2)(1-x_3) + 4(1-x_1)(1-x_2)x_3 + 2(1-x_1)x_2x_3$? Because it doesn't work for many inputs. Try (0,1,0) for example.
            $endgroup$
            – aprospero
            Jan 16 at 16:26










          • $begingroup$
            No I guess you got the idea. You need to complete it.
            $endgroup$
            – Wuestenfux
            Jan 16 at 16:30










          • $begingroup$
            Oooh! I got the point. So it is enough to hardcode the output sequence I want and then simplify the expression. Wow, did not come into my mind! Also I can easily generalise at 4, 5 variables and search for a pattern. Thank you @Wuestenfux, really helpful!
            $endgroup$
            – aprospero
            Jan 16 at 17:06














          0












          0








          0





          $begingroup$

          How about (completed) $$f(x_1,x_2,x_3) = 6cdot (1-x_1)(1-x_2)(1-x_3) + 4cdot (1-x_1)(1-x_2)x_3 \+ 5cdot (1-x_1)x_2(1-x_3) + 2cdot (1-x_1)x_2x_3
          +5cdot x_1(1-x_2)(1-x_3) + 3cdot x_1(1-x_2)x_3 + 4cdot x_1x_2(1-x_3) + 0cdot x_1x_2x_3.$$






          share|cite|improve this answer











          $endgroup$



          How about (completed) $$f(x_1,x_2,x_3) = 6cdot (1-x_1)(1-x_2)(1-x_3) + 4cdot (1-x_1)(1-x_2)x_3 \+ 5cdot (1-x_1)x_2(1-x_3) + 2cdot (1-x_1)x_2x_3
          +5cdot x_1(1-x_2)(1-x_3) + 3cdot x_1(1-x_2)x_3 + 4cdot x_1x_2(1-x_3) + 0cdot x_1x_2x_3.$$







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Jan 16 at 16:34

























          answered Jan 16 at 16:01









          WuestenfuxWuestenfux

          5,3631513




          5,3631513












          • $begingroup$
            Is the complete formula $f(x_1,x_2,x_3) = 6(1-x_1)(1-x_2)(1-x_3) + 4(1-x_1)(1-x_2)x_3 + 2(1-x_1)x_2x_3$? Because it doesn't work for many inputs. Try (0,1,0) for example.
            $endgroup$
            – aprospero
            Jan 16 at 16:26










          • $begingroup$
            No I guess you got the idea. You need to complete it.
            $endgroup$
            – Wuestenfux
            Jan 16 at 16:30










          • $begingroup$
            Oooh! I got the point. So it is enough to hardcode the output sequence I want and then simplify the expression. Wow, did not come into my mind! Also I can easily generalise at 4, 5 variables and search for a pattern. Thank you @Wuestenfux, really helpful!
            $endgroup$
            – aprospero
            Jan 16 at 17:06


















          • $begingroup$
            Is the complete formula $f(x_1,x_2,x_3) = 6(1-x_1)(1-x_2)(1-x_3) + 4(1-x_1)(1-x_2)x_3 + 2(1-x_1)x_2x_3$? Because it doesn't work for many inputs. Try (0,1,0) for example.
            $endgroup$
            – aprospero
            Jan 16 at 16:26










          • $begingroup$
            No I guess you got the idea. You need to complete it.
            $endgroup$
            – Wuestenfux
            Jan 16 at 16:30










          • $begingroup$
            Oooh! I got the point. So it is enough to hardcode the output sequence I want and then simplify the expression. Wow, did not come into my mind! Also I can easily generalise at 4, 5 variables and search for a pattern. Thank you @Wuestenfux, really helpful!
            $endgroup$
            – aprospero
            Jan 16 at 17:06
















          $begingroup$
          Is the complete formula $f(x_1,x_2,x_3) = 6(1-x_1)(1-x_2)(1-x_3) + 4(1-x_1)(1-x_2)x_3 + 2(1-x_1)x_2x_3$? Because it doesn't work for many inputs. Try (0,1,0) for example.
          $endgroup$
          – aprospero
          Jan 16 at 16:26




          $begingroup$
          Is the complete formula $f(x_1,x_2,x_3) = 6(1-x_1)(1-x_2)(1-x_3) + 4(1-x_1)(1-x_2)x_3 + 2(1-x_1)x_2x_3$? Because it doesn't work for many inputs. Try (0,1,0) for example.
          $endgroup$
          – aprospero
          Jan 16 at 16:26












          $begingroup$
          No I guess you got the idea. You need to complete it.
          $endgroup$
          – Wuestenfux
          Jan 16 at 16:30




          $begingroup$
          No I guess you got the idea. You need to complete it.
          $endgroup$
          – Wuestenfux
          Jan 16 at 16:30












          $begingroup$
          Oooh! I got the point. So it is enough to hardcode the output sequence I want and then simplify the expression. Wow, did not come into my mind! Also I can easily generalise at 4, 5 variables and search for a pattern. Thank you @Wuestenfux, really helpful!
          $endgroup$
          – aprospero
          Jan 16 at 17:06




          $begingroup$
          Oooh! I got the point. So it is enough to hardcode the output sequence I want and then simplify the expression. Wow, did not come into my mind! Also I can easily generalise at 4, 5 variables and search for a pattern. Thank you @Wuestenfux, really helpful!
          $endgroup$
          – aprospero
          Jan 16 at 17:06


















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

          張江高科駅