# How many different permutations?

Suppose I've n boxes and m different colored balls of different quantities.How many unique permutations can be obtained ?

Example : n=2,m=2, with quantities ( A - 1 ball, B - 2 balls) Thus the number of permutations is 3 ( {A,B} , {B,A} , {B,B} )

Similarly, for n=2,m=2 but with quantities ( A-1 ball, B-3 balls) , the answer should be 3 only,since the balls are identical. Please help. Thank You.

• Sorry, but in both of your two examples, shouldn't the answer be $4$ instead of $3$ when considering the case where one of the $2$ boxes is empty? – LaBird Mar 11 '15 at 8:10
• No it's 3 only.We've to choose 2 balls and each box contains a single ball only. Actually it's just choosing 2 balls from the lot. The box doesn't really add anything. – user2125722 Mar 11 '15 at 8:26

Use a generating fraction with every term resembling $e^x$ and then try to find the coefficient of required power and it will surely depend on the values of $m,n$ and quantities too.

Suppose there are $m$ types of letters each has $q_i$ quantity, and then for $n$ bins: $${\rm W}=\text{Coefficient of x^n in }n!\prod_{i=1}^m\left(\sum_{k=0}^{q_i}\frac{x^k}{k!}\right)$$

• Can you guide me further please ? I couldn't gather much. – user2125722 Mar 11 '15 at 6:58
• @user2125722 done. – RE60K Mar 11 '15 at 7:03
• Could you please explain the formula ? I mean why does it work.. – user2125722 Mar 11 '15 at 8:51
• @user2125722 you need to study geerating functions from a good source/book. It's a whole topic – RE60K Mar 11 '15 at 12:12
• Any books you would recommend to begin with ? – user2125722 Mar 11 '15 at 13:12