Counting question on bit strings - problem with using cases











up vote
2
down vote

favorite













How many bit strings of length 10 either begin with three 0s or end with two 0s?




I solved this question using cases but I do not seem to be getting the answer of $352$.



My attempt:
Consider two cases:




  • Case 1: The string begins with three $0$s and does not end with two $0$s. There is only $1$ way to choose the first three bits, $2^5$ ways for the middle bits, and $3$ ways for the last two bits ($4$ ways to construct a string of two bits, minus $1$ way to make three $0$s). There are $2^5 cdot 3$ ways to construct strings of this type.

  • Case 2: The string does not begin with three $0$s but ends with two $0$s. There are $2^3 - 1 = 7$ ways to choose the first three bits without three $0$s, $2^5$ ways for the middle bits, and $1$ way for the last two bits. There are $7 cdot 2^5$ ways to construct strings of this type.


By the rule of sum, there are $2^5 cdot 3 + 2^5 cdot 7 = 320$ ways to construct bit strings of length 10 either begin with three $0$s or end with two $0$s.










share|cite|improve this question


























    up vote
    2
    down vote

    favorite













    How many bit strings of length 10 either begin with three 0s or end with two 0s?




    I solved this question using cases but I do not seem to be getting the answer of $352$.



    My attempt:
    Consider two cases:




    • Case 1: The string begins with three $0$s and does not end with two $0$s. There is only $1$ way to choose the first three bits, $2^5$ ways for the middle bits, and $3$ ways for the last two bits ($4$ ways to construct a string of two bits, minus $1$ way to make three $0$s). There are $2^5 cdot 3$ ways to construct strings of this type.

    • Case 2: The string does not begin with three $0$s but ends with two $0$s. There are $2^3 - 1 = 7$ ways to choose the first three bits without three $0$s, $2^5$ ways for the middle bits, and $1$ way for the last two bits. There are $7 cdot 2^5$ ways to construct strings of this type.


    By the rule of sum, there are $2^5 cdot 3 + 2^5 cdot 7 = 320$ ways to construct bit strings of length 10 either begin with three $0$s or end with two $0$s.










    share|cite|improve this question
























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite












      How many bit strings of length 10 either begin with three 0s or end with two 0s?




      I solved this question using cases but I do not seem to be getting the answer of $352$.



      My attempt:
      Consider two cases:




      • Case 1: The string begins with three $0$s and does not end with two $0$s. There is only $1$ way to choose the first three bits, $2^5$ ways for the middle bits, and $3$ ways for the last two bits ($4$ ways to construct a string of two bits, minus $1$ way to make three $0$s). There are $2^5 cdot 3$ ways to construct strings of this type.

      • Case 2: The string does not begin with three $0$s but ends with two $0$s. There are $2^3 - 1 = 7$ ways to choose the first three bits without three $0$s, $2^5$ ways for the middle bits, and $1$ way for the last two bits. There are $7 cdot 2^5$ ways to construct strings of this type.


      By the rule of sum, there are $2^5 cdot 3 + 2^5 cdot 7 = 320$ ways to construct bit strings of length 10 either begin with three $0$s or end with two $0$s.










      share|cite|improve this question














      How many bit strings of length 10 either begin with three 0s or end with two 0s?




      I solved this question using cases but I do not seem to be getting the answer of $352$.



      My attempt:
      Consider two cases:




      • Case 1: The string begins with three $0$s and does not end with two $0$s. There is only $1$ way to choose the first three bits, $2^5$ ways for the middle bits, and $3$ ways for the last two bits ($4$ ways to construct a string of two bits, minus $1$ way to make three $0$s). There are $2^5 cdot 3$ ways to construct strings of this type.

      • Case 2: The string does not begin with three $0$s but ends with two $0$s. There are $2^3 - 1 = 7$ ways to choose the first three bits without three $0$s, $2^5$ ways for the middle bits, and $1$ way for the last two bits. There are $7 cdot 2^5$ ways to construct strings of this type.


      By the rule of sum, there are $2^5 cdot 3 + 2^5 cdot 7 = 320$ ways to construct bit strings of length 10 either begin with three $0$s or end with two $0$s.







      combinatorics discrete-mathematics






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked yesterday









      holo

      1588




      1588






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          4
          down vote



          accepted










          You are missing the strings that both begin with three zeroes and end with two zeroes.



          And since there are five bits left that can be anything, you have $2^5=32$ of those, exactly the difference






          share|cite|improve this answer





















          • Ah. Well, I see that my problem involves not knowing that "either" also implied both in this context
            – holo
            yesterday






          • 1




            @holo Yeah, sometimes we use ‘either .. or’ to indicate an exclusive disjunction, but that is not always the case. For example, if I say that I would like to be either rich or happy, obviously I would not mind being rich and happy.
            – Bram28
            yesterday


















          up vote
          2
          down vote













          $$underbrace{2^7}_{text{begin with three zeros}}+underbrace{2^8}_{text{end with two zeros}}-underbrace{2^5}_{text{double-count}} $$






          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: 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%2f3012277%2fcounting-question-on-bit-strings-problem-with-using-cases%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








            up vote
            4
            down vote



            accepted










            You are missing the strings that both begin with three zeroes and end with two zeroes.



            And since there are five bits left that can be anything, you have $2^5=32$ of those, exactly the difference






            share|cite|improve this answer





















            • Ah. Well, I see that my problem involves not knowing that "either" also implied both in this context
              – holo
              yesterday






            • 1




              @holo Yeah, sometimes we use ‘either .. or’ to indicate an exclusive disjunction, but that is not always the case. For example, if I say that I would like to be either rich or happy, obviously I would not mind being rich and happy.
              – Bram28
              yesterday















            up vote
            4
            down vote



            accepted










            You are missing the strings that both begin with three zeroes and end with two zeroes.



            And since there are five bits left that can be anything, you have $2^5=32$ of those, exactly the difference






            share|cite|improve this answer





















            • Ah. Well, I see that my problem involves not knowing that "either" also implied both in this context
              – holo
              yesterday






            • 1




              @holo Yeah, sometimes we use ‘either .. or’ to indicate an exclusive disjunction, but that is not always the case. For example, if I say that I would like to be either rich or happy, obviously I would not mind being rich and happy.
              – Bram28
              yesterday













            up vote
            4
            down vote



            accepted







            up vote
            4
            down vote



            accepted






            You are missing the strings that both begin with three zeroes and end with two zeroes.



            And since there are five bits left that can be anything, you have $2^5=32$ of those, exactly the difference






            share|cite|improve this answer












            You are missing the strings that both begin with three zeroes and end with two zeroes.



            And since there are five bits left that can be anything, you have $2^5=32$ of those, exactly the difference







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered yesterday









            Bram28

            58.3k44185




            58.3k44185












            • Ah. Well, I see that my problem involves not knowing that "either" also implied both in this context
              – holo
              yesterday






            • 1




              @holo Yeah, sometimes we use ‘either .. or’ to indicate an exclusive disjunction, but that is not always the case. For example, if I say that I would like to be either rich or happy, obviously I would not mind being rich and happy.
              – Bram28
              yesterday


















            • Ah. Well, I see that my problem involves not knowing that "either" also implied both in this context
              – holo
              yesterday






            • 1




              @holo Yeah, sometimes we use ‘either .. or’ to indicate an exclusive disjunction, but that is not always the case. For example, if I say that I would like to be either rich or happy, obviously I would not mind being rich and happy.
              – Bram28
              yesterday
















            Ah. Well, I see that my problem involves not knowing that "either" also implied both in this context
            – holo
            yesterday




            Ah. Well, I see that my problem involves not knowing that "either" also implied both in this context
            – holo
            yesterday




            1




            1




            @holo Yeah, sometimes we use ‘either .. or’ to indicate an exclusive disjunction, but that is not always the case. For example, if I say that I would like to be either rich or happy, obviously I would not mind being rich and happy.
            – Bram28
            yesterday




            @holo Yeah, sometimes we use ‘either .. or’ to indicate an exclusive disjunction, but that is not always the case. For example, if I say that I would like to be either rich or happy, obviously I would not mind being rich and happy.
            – Bram28
            yesterday










            up vote
            2
            down vote













            $$underbrace{2^7}_{text{begin with three zeros}}+underbrace{2^8}_{text{end with two zeros}}-underbrace{2^5}_{text{double-count}} $$






            share|cite|improve this answer

























              up vote
              2
              down vote













              $$underbrace{2^7}_{text{begin with three zeros}}+underbrace{2^8}_{text{end with two zeros}}-underbrace{2^5}_{text{double-count}} $$






              share|cite|improve this answer























                up vote
                2
                down vote










                up vote
                2
                down vote









                $$underbrace{2^7}_{text{begin with three zeros}}+underbrace{2^8}_{text{end with two zeros}}-underbrace{2^5}_{text{double-count}} $$






                share|cite|improve this answer












                $$underbrace{2^7}_{text{begin with three zeros}}+underbrace{2^8}_{text{end with two zeros}}-underbrace{2^5}_{text{double-count}} $$







                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered yesterday









                David Peterson

                8,56621935




                8,56621935






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3012277%2fcounting-question-on-bit-strings-problem-with-using-cases%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

                    Accessing regular linux commands in Huawei's Dopra Linux

                    Can't connect RFCOMM socket: Host is down

                    Kernel panic - not syncing: Fatal Exception in Interrupt