views:

245

answers:

3

and we need to put these balls into boxes.

How many states of the states could there be?

This is part of a computer simulation puzzle. I've almost forget all my math knowledges.

A: 

this is a basic combinatorial question (distribution of identical objects into non identical slots)

the number of states is [(N+M-1) choose (M-1)]

Alon
If M=2 and N=2 there are three states: [({o,o},{}), ({o},{o}), ({}, {o,o})]. Your formula gives one.
Mark Byers
No this isn't it, this is the number of way M - 1 identical balls can be selected from a group N - 1 balls.
Andreas Brinck
i stand corrected ;-) modified to formula
Alon
This is correct. But can you give some clue on how to get this equation?
ablmf
+3  A: 

I believe you are looking for the Multinomial Coefficient.
I will check myself and expand my answer.

Edit:
If you take a look at the wikipedia article I gave a link to, you can see that the M and N you defined in your question correspond to the m and n defined in the Theorem section.

This means that your question corresponds to: "What is the number of possible coefficient orderings when expanding a polynomial raised to an arbitrary power?", where N is the power, and M is the number of variables in the polynomial.

In other words:
What you are looking for is to sum over the multinomial coefficients of a polynomial of M variables expanded when raised to the power on N.

The exact equations are a bit long, but they are explained very clearly in wikipedia.

Why is this true:
The multinomial coefficient gives you the number of ways to order identical balls between baskets when grouped into a specific grouping (for example, 4 balls grouped into 3, 1, and 1 - in this case M=4 and N=3). When summing over all grouping options you get all possible combinations.

I hope this helped you out.

Dana
A: 

These notes explain how to solve the "balls in boxes" problem in general: whether the balls are labeled or not, whether the boxes are labeled or not, whether you have to have at least one ball in each box, etc.

John D. Cook