Combinatorics- distribute n objects to k bin with constraints












0












$begingroup$


Suppose I have n objects distributed to k bins and I want to know how many multisets satisfy the following condition: exactly j bins have at least m objects, where j $leq$ k,m $leq$ n, and j*m $leq$ n. For example, if n = 5, k=4, j=2 and m = 2, there are 24 subsets:



[3, 2, 0, 0]
[3, 0, 2, 0]
[3, 0, 0, 2]
[2, 3, 0, 0]
[2, 2, 1, 0]
[2, 2, 0, 1]
[2, 1, 2, 0]
[2, 1, 0, 2]
[2, 0, 3, 0]
[2, 0, 2, 1]
[2, 0, 1, 2]
[2, 0, 0, 3]
[1, 2, 2, 0]
[1, 2, 0, 2]
[1, 0, 2, 2]
[0, 3, 2, 0]
[0, 3, 0, 2]
[0, 2, 3, 0]
[0, 2, 2, 1]
[0, 2, 1, 2]
[0, 2, 0, 3]
[0, 1, 2, 2]
[0, 0, 3, 2]
[0, 0, 2, 3]



I'm having difficulty finding a general formula for this problem. Any help would be appreciated.










share|cite|improve this question









$endgroup$

















    0












    $begingroup$


    Suppose I have n objects distributed to k bins and I want to know how many multisets satisfy the following condition: exactly j bins have at least m objects, where j $leq$ k,m $leq$ n, and j*m $leq$ n. For example, if n = 5, k=4, j=2 and m = 2, there are 24 subsets:



    [3, 2, 0, 0]
    [3, 0, 2, 0]
    [3, 0, 0, 2]
    [2, 3, 0, 0]
    [2, 2, 1, 0]
    [2, 2, 0, 1]
    [2, 1, 2, 0]
    [2, 1, 0, 2]
    [2, 0, 3, 0]
    [2, 0, 2, 1]
    [2, 0, 1, 2]
    [2, 0, 0, 3]
    [1, 2, 2, 0]
    [1, 2, 0, 2]
    [1, 0, 2, 2]
    [0, 3, 2, 0]
    [0, 3, 0, 2]
    [0, 2, 3, 0]
    [0, 2, 2, 1]
    [0, 2, 1, 2]
    [0, 2, 0, 3]
    [0, 1, 2, 2]
    [0, 0, 3, 2]
    [0, 0, 2, 3]



    I'm having difficulty finding a general formula for this problem. Any help would be appreciated.










    share|cite|improve this question









    $endgroup$















      0












      0








      0


      0



      $begingroup$


      Suppose I have n objects distributed to k bins and I want to know how many multisets satisfy the following condition: exactly j bins have at least m objects, where j $leq$ k,m $leq$ n, and j*m $leq$ n. For example, if n = 5, k=4, j=2 and m = 2, there are 24 subsets:



      [3, 2, 0, 0]
      [3, 0, 2, 0]
      [3, 0, 0, 2]
      [2, 3, 0, 0]
      [2, 2, 1, 0]
      [2, 2, 0, 1]
      [2, 1, 2, 0]
      [2, 1, 0, 2]
      [2, 0, 3, 0]
      [2, 0, 2, 1]
      [2, 0, 1, 2]
      [2, 0, 0, 3]
      [1, 2, 2, 0]
      [1, 2, 0, 2]
      [1, 0, 2, 2]
      [0, 3, 2, 0]
      [0, 3, 0, 2]
      [0, 2, 3, 0]
      [0, 2, 2, 1]
      [0, 2, 1, 2]
      [0, 2, 0, 3]
      [0, 1, 2, 2]
      [0, 0, 3, 2]
      [0, 0, 2, 3]



      I'm having difficulty finding a general formula for this problem. Any help would be appreciated.










      share|cite|improve this question









      $endgroup$




      Suppose I have n objects distributed to k bins and I want to know how many multisets satisfy the following condition: exactly j bins have at least m objects, where j $leq$ k,m $leq$ n, and j*m $leq$ n. For example, if n = 5, k=4, j=2 and m = 2, there are 24 subsets:



      [3, 2, 0, 0]
      [3, 0, 2, 0]
      [3, 0, 0, 2]
      [2, 3, 0, 0]
      [2, 2, 1, 0]
      [2, 2, 0, 1]
      [2, 1, 2, 0]
      [2, 1, 0, 2]
      [2, 0, 3, 0]
      [2, 0, 2, 1]
      [2, 0, 1, 2]
      [2, 0, 0, 3]
      [1, 2, 2, 0]
      [1, 2, 0, 2]
      [1, 0, 2, 2]
      [0, 3, 2, 0]
      [0, 3, 0, 2]
      [0, 2, 3, 0]
      [0, 2, 2, 1]
      [0, 2, 1, 2]
      [0, 2, 0, 3]
      [0, 1, 2, 2]
      [0, 0, 3, 2]
      [0, 0, 2, 3]



      I'm having difficulty finding a general formula for this problem. Any help would be appreciated.







      combinatorics






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Jan 7 at 17:32









      Christopher FisherChristopher Fisher

      32




      32






















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          Choose which of the $j$ bins have at least $m$ objects in $binom{k}j$ ways. Let $x_1,x_2,dots,x_j$ be number of objects minus $j$ in these $j$ bins. Let $y_1,y_2,dots,y_{k-j}$ be the number of object in the other bins. Then
          $$
          begin{align}
          x_1+dots+x_j+y_1+dots+y_{k-j}&=n-jm,\
          0 &le x_i,\
          0&le y_i<m
          end{align}
          $$

          If we ignored the condition $y_i<m$, then we would have several non negative integers summing to $n-jm$; the number of ways to do this is $binom{n-jm+k-1}{k-1}$, using stars and bars. In order to account for $y_i<m$, we use inclusion exclusion. Namely, subtract out the bad solutions where $y_ige m$ for each $i$, then add back in the doubly subtracted solutions where $y_ige m$ and $y_jge m$, then subtract out the triply bad solutions, etc. The result is
          $$
          binom{k}jsum_{ell = 0}^{k-j}binom{k-j}{ell}(-1)^ell binom{n-(j+ell)m+k-1}{k-1}
          $$

          Here, I am using the convention that $binom{n}k=0$ when $n<k$.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Thank you for your help. I believe I identified a case where it fails: n=4,k=3,m=4,j=1. I think it should equal ${k choose j}$ = 3. I suspect the inclusion-exclusion method might be failing because something is overcounted in certain cases.
            $endgroup$
            – Christopher Fisher
            Jan 7 at 20:40












          • $begingroup$
            If you apply my formula in your comment, you should get $$binom{3}1left(binom{2}0binom{2}2-binom{2}1binom{-2}{2}+binom{2}2binom{-6}2right)=3(1-0+0)=3,$$ which is correct.
            $endgroup$
            – Mike Earnest
            Jan 7 at 21:10










          • $begingroup$
            You are right. Sorry for the confusion. The program I am using yielded ${-2 choose 1}$ = -2, which was unexpected. Thanks again!
            $endgroup$
            – Christopher Fisher
            Jan 7 at 21:23












          • $begingroup$
            The confusion is my fault. Most mathematicians agree that $binom{-2}1=-2$; it just makes my formula more convenient to write if you assume $binom{-2}1=0$.
            $endgroup$
            – Mike Earnest
            Jan 7 at 22:27











          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%2f3065257%2fcombinatorics-distribute-n-objects-to-k-bin-with-constraints%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$

          Choose which of the $j$ bins have at least $m$ objects in $binom{k}j$ ways. Let $x_1,x_2,dots,x_j$ be number of objects minus $j$ in these $j$ bins. Let $y_1,y_2,dots,y_{k-j}$ be the number of object in the other bins. Then
          $$
          begin{align}
          x_1+dots+x_j+y_1+dots+y_{k-j}&=n-jm,\
          0 &le x_i,\
          0&le y_i<m
          end{align}
          $$

          If we ignored the condition $y_i<m$, then we would have several non negative integers summing to $n-jm$; the number of ways to do this is $binom{n-jm+k-1}{k-1}$, using stars and bars. In order to account for $y_i<m$, we use inclusion exclusion. Namely, subtract out the bad solutions where $y_ige m$ for each $i$, then add back in the doubly subtracted solutions where $y_ige m$ and $y_jge m$, then subtract out the triply bad solutions, etc. The result is
          $$
          binom{k}jsum_{ell = 0}^{k-j}binom{k-j}{ell}(-1)^ell binom{n-(j+ell)m+k-1}{k-1}
          $$

          Here, I am using the convention that $binom{n}k=0$ when $n<k$.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Thank you for your help. I believe I identified a case where it fails: n=4,k=3,m=4,j=1. I think it should equal ${k choose j}$ = 3. I suspect the inclusion-exclusion method might be failing because something is overcounted in certain cases.
            $endgroup$
            – Christopher Fisher
            Jan 7 at 20:40












          • $begingroup$
            If you apply my formula in your comment, you should get $$binom{3}1left(binom{2}0binom{2}2-binom{2}1binom{-2}{2}+binom{2}2binom{-6}2right)=3(1-0+0)=3,$$ which is correct.
            $endgroup$
            – Mike Earnest
            Jan 7 at 21:10










          • $begingroup$
            You are right. Sorry for the confusion. The program I am using yielded ${-2 choose 1}$ = -2, which was unexpected. Thanks again!
            $endgroup$
            – Christopher Fisher
            Jan 7 at 21:23












          • $begingroup$
            The confusion is my fault. Most mathematicians agree that $binom{-2}1=-2$; it just makes my formula more convenient to write if you assume $binom{-2}1=0$.
            $endgroup$
            – Mike Earnest
            Jan 7 at 22:27
















          0












          $begingroup$

          Choose which of the $j$ bins have at least $m$ objects in $binom{k}j$ ways. Let $x_1,x_2,dots,x_j$ be number of objects minus $j$ in these $j$ bins. Let $y_1,y_2,dots,y_{k-j}$ be the number of object in the other bins. Then
          $$
          begin{align}
          x_1+dots+x_j+y_1+dots+y_{k-j}&=n-jm,\
          0 &le x_i,\
          0&le y_i<m
          end{align}
          $$

          If we ignored the condition $y_i<m$, then we would have several non negative integers summing to $n-jm$; the number of ways to do this is $binom{n-jm+k-1}{k-1}$, using stars and bars. In order to account for $y_i<m$, we use inclusion exclusion. Namely, subtract out the bad solutions where $y_ige m$ for each $i$, then add back in the doubly subtracted solutions where $y_ige m$ and $y_jge m$, then subtract out the triply bad solutions, etc. The result is
          $$
          binom{k}jsum_{ell = 0}^{k-j}binom{k-j}{ell}(-1)^ell binom{n-(j+ell)m+k-1}{k-1}
          $$

          Here, I am using the convention that $binom{n}k=0$ when $n<k$.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Thank you for your help. I believe I identified a case where it fails: n=4,k=3,m=4,j=1. I think it should equal ${k choose j}$ = 3. I suspect the inclusion-exclusion method might be failing because something is overcounted in certain cases.
            $endgroup$
            – Christopher Fisher
            Jan 7 at 20:40












          • $begingroup$
            If you apply my formula in your comment, you should get $$binom{3}1left(binom{2}0binom{2}2-binom{2}1binom{-2}{2}+binom{2}2binom{-6}2right)=3(1-0+0)=3,$$ which is correct.
            $endgroup$
            – Mike Earnest
            Jan 7 at 21:10










          • $begingroup$
            You are right. Sorry for the confusion. The program I am using yielded ${-2 choose 1}$ = -2, which was unexpected. Thanks again!
            $endgroup$
            – Christopher Fisher
            Jan 7 at 21:23












          • $begingroup$
            The confusion is my fault. Most mathematicians agree that $binom{-2}1=-2$; it just makes my formula more convenient to write if you assume $binom{-2}1=0$.
            $endgroup$
            – Mike Earnest
            Jan 7 at 22:27














          0












          0








          0





          $begingroup$

          Choose which of the $j$ bins have at least $m$ objects in $binom{k}j$ ways. Let $x_1,x_2,dots,x_j$ be number of objects minus $j$ in these $j$ bins. Let $y_1,y_2,dots,y_{k-j}$ be the number of object in the other bins. Then
          $$
          begin{align}
          x_1+dots+x_j+y_1+dots+y_{k-j}&=n-jm,\
          0 &le x_i,\
          0&le y_i<m
          end{align}
          $$

          If we ignored the condition $y_i<m$, then we would have several non negative integers summing to $n-jm$; the number of ways to do this is $binom{n-jm+k-1}{k-1}$, using stars and bars. In order to account for $y_i<m$, we use inclusion exclusion. Namely, subtract out the bad solutions where $y_ige m$ for each $i$, then add back in the doubly subtracted solutions where $y_ige m$ and $y_jge m$, then subtract out the triply bad solutions, etc. The result is
          $$
          binom{k}jsum_{ell = 0}^{k-j}binom{k-j}{ell}(-1)^ell binom{n-(j+ell)m+k-1}{k-1}
          $$

          Here, I am using the convention that $binom{n}k=0$ when $n<k$.






          share|cite|improve this answer









          $endgroup$



          Choose which of the $j$ bins have at least $m$ objects in $binom{k}j$ ways. Let $x_1,x_2,dots,x_j$ be number of objects minus $j$ in these $j$ bins. Let $y_1,y_2,dots,y_{k-j}$ be the number of object in the other bins. Then
          $$
          begin{align}
          x_1+dots+x_j+y_1+dots+y_{k-j}&=n-jm,\
          0 &le x_i,\
          0&le y_i<m
          end{align}
          $$

          If we ignored the condition $y_i<m$, then we would have several non negative integers summing to $n-jm$; the number of ways to do this is $binom{n-jm+k-1}{k-1}$, using stars and bars. In order to account for $y_i<m$, we use inclusion exclusion. Namely, subtract out the bad solutions where $y_ige m$ for each $i$, then add back in the doubly subtracted solutions where $y_ige m$ and $y_jge m$, then subtract out the triply bad solutions, etc. The result is
          $$
          binom{k}jsum_{ell = 0}^{k-j}binom{k-j}{ell}(-1)^ell binom{n-(j+ell)m+k-1}{k-1}
          $$

          Here, I am using the convention that $binom{n}k=0$ when $n<k$.







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Jan 7 at 18:46









          Mike EarnestMike Earnest

          23.3k12051




          23.3k12051












          • $begingroup$
            Thank you for your help. I believe I identified a case where it fails: n=4,k=3,m=4,j=1. I think it should equal ${k choose j}$ = 3. I suspect the inclusion-exclusion method might be failing because something is overcounted in certain cases.
            $endgroup$
            – Christopher Fisher
            Jan 7 at 20:40












          • $begingroup$
            If you apply my formula in your comment, you should get $$binom{3}1left(binom{2}0binom{2}2-binom{2}1binom{-2}{2}+binom{2}2binom{-6}2right)=3(1-0+0)=3,$$ which is correct.
            $endgroup$
            – Mike Earnest
            Jan 7 at 21:10










          • $begingroup$
            You are right. Sorry for the confusion. The program I am using yielded ${-2 choose 1}$ = -2, which was unexpected. Thanks again!
            $endgroup$
            – Christopher Fisher
            Jan 7 at 21:23












          • $begingroup$
            The confusion is my fault. Most mathematicians agree that $binom{-2}1=-2$; it just makes my formula more convenient to write if you assume $binom{-2}1=0$.
            $endgroup$
            – Mike Earnest
            Jan 7 at 22:27


















          • $begingroup$
            Thank you for your help. I believe I identified a case where it fails: n=4,k=3,m=4,j=1. I think it should equal ${k choose j}$ = 3. I suspect the inclusion-exclusion method might be failing because something is overcounted in certain cases.
            $endgroup$
            – Christopher Fisher
            Jan 7 at 20:40












          • $begingroup$
            If you apply my formula in your comment, you should get $$binom{3}1left(binom{2}0binom{2}2-binom{2}1binom{-2}{2}+binom{2}2binom{-6}2right)=3(1-0+0)=3,$$ which is correct.
            $endgroup$
            – Mike Earnest
            Jan 7 at 21:10










          • $begingroup$
            You are right. Sorry for the confusion. The program I am using yielded ${-2 choose 1}$ = -2, which was unexpected. Thanks again!
            $endgroup$
            – Christopher Fisher
            Jan 7 at 21:23












          • $begingroup$
            The confusion is my fault. Most mathematicians agree that $binom{-2}1=-2$; it just makes my formula more convenient to write if you assume $binom{-2}1=0$.
            $endgroup$
            – Mike Earnest
            Jan 7 at 22:27
















          $begingroup$
          Thank you for your help. I believe I identified a case where it fails: n=4,k=3,m=4,j=1. I think it should equal ${k choose j}$ = 3. I suspect the inclusion-exclusion method might be failing because something is overcounted in certain cases.
          $endgroup$
          – Christopher Fisher
          Jan 7 at 20:40






          $begingroup$
          Thank you for your help. I believe I identified a case where it fails: n=4,k=3,m=4,j=1. I think it should equal ${k choose j}$ = 3. I suspect the inclusion-exclusion method might be failing because something is overcounted in certain cases.
          $endgroup$
          – Christopher Fisher
          Jan 7 at 20:40














          $begingroup$
          If you apply my formula in your comment, you should get $$binom{3}1left(binom{2}0binom{2}2-binom{2}1binom{-2}{2}+binom{2}2binom{-6}2right)=3(1-0+0)=3,$$ which is correct.
          $endgroup$
          – Mike Earnest
          Jan 7 at 21:10




          $begingroup$
          If you apply my formula in your comment, you should get $$binom{3}1left(binom{2}0binom{2}2-binom{2}1binom{-2}{2}+binom{2}2binom{-6}2right)=3(1-0+0)=3,$$ which is correct.
          $endgroup$
          – Mike Earnest
          Jan 7 at 21:10












          $begingroup$
          You are right. Sorry for the confusion. The program I am using yielded ${-2 choose 1}$ = -2, which was unexpected. Thanks again!
          $endgroup$
          – Christopher Fisher
          Jan 7 at 21:23






          $begingroup$
          You are right. Sorry for the confusion. The program I am using yielded ${-2 choose 1}$ = -2, which was unexpected. Thanks again!
          $endgroup$
          – Christopher Fisher
          Jan 7 at 21:23














          $begingroup$
          The confusion is my fault. Most mathematicians agree that $binom{-2}1=-2$; it just makes my formula more convenient to write if you assume $binom{-2}1=0$.
          $endgroup$
          – Mike Earnest
          Jan 7 at 22:27




          $begingroup$
          The confusion is my fault. Most mathematicians agree that $binom{-2}1=-2$; it just makes my formula more convenient to write if you assume $binom{-2}1=0$.
          $endgroup$
          – Mike Earnest
          Jan 7 at 22:27


















          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%2f3065257%2fcombinatorics-distribute-n-objects-to-k-bin-with-constraints%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?

          File:DeusFollowingSea.jpg