Counting Marbles in Boxes: Solving Tough Combinatorics Problems

In summary, the conversation discussed the problem of finding the number of ways to put M identical marbles into N boxes, with each box having at most k marbles. For k=M, the number of possibilities is (M+N-1) choose M. For k=1, the number of possibilities is N choose M. For arbitrary k, the formula is (t! / (m!(n-1)!)) - ((t-k)! / (m!(n-1)!)), where t = n+m-1.
  • #1
qbert
185
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
  • #2
The trick here is to subtract the invalid orderings.

first, let [tex]t = n+m-1[/tex] 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:

[tex]N_{all} = \frac{t!}{m!(n-1)!}[/tex]

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):

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

[tex]=\frac{(n+m-k-1)!}{m!(n-1)!}[/tex]

[tex]=\frac{(t-k)!}{m!(n-1)!}[/tex]

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

[tex]N = N_{all} - N_{remove}[/tex]

[tex]=\frac{t!}{m!(n-1)!} - \frac{(t-k)!}{m!(n-1)!}}[/tex]

[tex]=\frac{t! - (t-k)!}{m!(n-1)!}[/tex]

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:
  • #3
so we meet again, subtraction--my arch enemy!

That was exceedingly clever. Thanks for your help.
 

FAQ: Counting Marbles in Boxes: Solving Tough Combinatorics Problems

What is combinatorics?

Combinatorics is a branch of mathematics that deals with counting and arranging objects or events in a systematic way.

What makes a combinatorics problem "tough"?

A tough combinatorics problem typically involves a large number of objects or events, complex rules or restrictions, and a high level of abstract thinking.

What skills are needed to solve a tough combinatorics problem?

To solve a tough combinatorics problem, one needs a strong understanding of combinatorial principles, such as permutations and combinations, as well as the ability to think logically and creatively.

Can real-world applications be modeled using combinatorics?

Yes, combinatorial principles are often used to model real-world scenarios in fields such as computer science, statistics, and network analysis.

How can I improve my combinatorics problem-solving skills?

Practicing with a variety of combinatorics problems and actively seeking out challenging problems to solve can help improve problem-solving skills. It can also be helpful to study and understand different combinatorial principles and techniques.

Similar threads

Replies
4
Views
2K
Replies
1
Views
2K
Replies
1
Views
1K
Replies
14
Views
6K
Replies
14
Views
1K
Replies
12
Views
1K
Replies
1
Views
1K
Back
Top