Counting Marbles in Boxes: Solving Tough Combinatorics Problems

  • Thread starter Thread starter qbert
  • Start date Start date
  • Tags Tags
    Combinatorics
Click For Summary
The discussion revolves around finding the number of ways to distribute M identical marbles into N boxes with a maximum of k marbles per box. For k equal to M, the formula is derived as (M+N-1) choose M, while for k equal to 1, the possibilities are represented by N choose M, assuming M is less than N. The conversation explores a general formula for arbitrary k, emphasizing the need to account for invalid configurations by subtracting them from the total arrangements. The approach involves grouping k+1 marbles together to treat them as a single unit, leading to a refined calculation. The final formula combines the total arrangements with the adjustments for invalid configurations, showcasing the complexity of combinatorial problems.
qbert
Messages
185
Reaction score
5
I've just managed to stump myself. Let's say you have
M (identical) marbles and N boxes. How many ways
can you put the marbles in the boxes if each box
can have at most k (k <= M) marbles?

for k=M we can take M .'s to be the marbles
and N-1 |'s to be the boxes so a valid configuration
is a sequence like ..|.|...||.. so we end up with
(M+N-1) choose M.

for k=1, we must have M<N, and
we have N choices for the first marble,
N-1 choices for the second, ...
which is just N choose M possibilities.

is there a formula for arbitrary k?
 
Physics news on Phys.org
The trick here is to subtract the invalid orderings.

first, let t = n+m-1 to simplify things a bit.

If we can separate the m balls into n boxes without restriction we get n-1 bars and m balls:

N_{all} = \frac{t!}{m!(n-1)!}

If we want to make sure we have at least k+1 balls in a box, we group k+1 balls together and treat them like they're a single weird ball. An example of this is ".|..|{...}.|||", where three of the balls are placed in a set. Then we have n-1 bars, m-(k+1) balls, and 1 weird ball (note that I still divide by m! because you can swap balls within the weird ball with balls outside of it):

N_{remove} = \frac{((n-1)+(m-(k+1))+(1))!}{m!(n-1)!}

=\frac{(n+m-k-1)!}{m!(n-1)!}

=\frac{(t-k)!}{m!(n-1)!}

Now, all the permutations we want to remove just happen to have at least k+1 balls together, so:

N = N_{all} - N_{remove}

=\frac{t!}{m!(n-1)!} - \frac{(t-k)!}{m!(n-1)!}}

=\frac{t! - (t-k)!}{m!(n-1)!}

not counting any stupid errors I made, of course.

EDIT: Fixed a mistake (forgot to include balls within weird ball in the denominator)
 
Last edited:
so we meet again, subtraction--my arch enemy!

That was exceedingly clever. Thanks for your help.
 
The standard _A " operator" maps a Null Hypothesis Ho into a decision set { Do not reject:=1 and reject :=0}. In this sense ( HA)_A , makes no sense. Since H0, HA aren't exhaustive, can we find an alternative operator, _A' , so that ( H_A)_A' makes sense? Isn't Pearson Neyman related to this? Hope I'm making sense. Edit: I was motivated by a superficial similarity of the idea with double transposition of matrices M, with ## (M^{T})^{T}=M##, and just wanted to see if it made sense to talk...

Similar threads

  • · Replies 29 ·
Replies
29
Views
4K
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
4
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 14 ·
Replies
14
Views
6K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 20 ·
Replies
20
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K