3

I am trying to solve this problem:

I have $m$ boxes and each box has $l$ identically colored balls, so $n = ml$.

I want to select $k$ balls such that at least one ball from each box. i.e. $m$ distinct balls.

I thought that if I would first take $m$ balls out of $k$, one from each of the $m$ box and then take $k-m$ remaining balls from remaining $n-m$ balls.

But is it not wrong because I might not start taking first $m$ balls one from each of the box ?

Would multiplying it with $\displaystyle\binom mk$ would make it right, or is it all wrong?

Thanks.

Sorry I do not know how to write formulas here.

Ashish Negi
  • 101
  • 8

2 Answers2

0

I'm going to assume each box has its own unique colour for its balls. I'm also assuming because you didn't state it clearly that you're interesting in the number of distinct subsets of size $k$ you can draw.

You have to take at least one ball from each box. Each box is left with $l - 1$ balls. If $k - m \geq l - 1$ then it's a Stars and Bars problem, with formula ${k - m - 1 \choose m - 1}$. If $k - m < l - 1$ then the formula for how many distinct subsets you can make is more complicated. This becomes a kind of extended stars and bars problem (see also this) with upper limits, for which you use polynomials in a sort of multiset notation.

wlad
  • 8,185
0

You're going to choose between $1$ and $l$ balls from each of the $m$ boxes, so the number you're looking for is the coefficient of $x^k$ in $$(x+x^2+x^3+\cdots+x^l)^m = \frac{x^m (1-x^l)^m}{(1-x)^m}.$$

Since $(1-x)^{-m}=\sum \binom{m+r-1}{r}x^r$, we have $$\begin{align} &[x^k]\frac{x^m (1-x^l)^m}{(1-x)^m}\\ =&[x^{k-m}](1-x^l)^m\sum_{r\ge0} \binom{m+r-1}{m-1}x^r\\ =&\sum_{i=0}^m(-1)^i\binom{m}{i}\binom{m+(k-m)-i l -1}{m-1}\\ =&\sum_{i=0}^{\min(m,(k-1)/l)}(-1)^i\binom{m}{i}\binom{k - i l - 1}{m-1}. \end{align} $$

Tad
  • 6,679