3

Suppose there are $m$ boxes, out of which $a$ boxes contain $x$ balls each and the remaining $b$ boxes contain $y$ balls each. In how many ways can at least $u$ balls be selected from the boxes?

$m=a+b$. Suppose $a=2,x=2,b=1,y=1,u=3$, then there are 9 ways:

$$(0 2 1) ,(2 1 0),(2 2 1),(2 2 0),(2 1 1),(1 2 1),(1 1 1),(1 2 0),(2 0 1)$$

How to approach this kind of problem where this is no restriction?

All the boxes are distinguishable and balls are not.

Parcly Taxel
  • 103,344
  • See this introduction to posting mathematical expressions. As stated the problem is unclear. Do "ways" of choosing at least $u$ balls differ according to the boxes from which they are chosen? Are all $m$ boxes distinguishable, or only so far as the boxes containing $x$ balls differ from ones containing $y$ balls? Or are we distinguishing all the $ax+by$ balls individually? – hardmath Jan 05 '18 at 21:24
  • @hardmath looking at his example, the boxes are distinguishable, the balls are not. As for an approach, I would rephrase this as "how many ways strictly fewer than $u$ balls can be selected" and apply stars-and-bars and inclusion-exclusion. To take care of the "strictly fewer" part, you can add an extra box with an unlimited number of balls that you grab from enough to make the total exactly $u$. Subtract this result away from $(1+x)^a(1+y)^b$ for a final answer to the original question. – JMoravitz Jan 05 '18 at 21:27
  • 1
    @hardmath updated the question .All the boxes are distinguishable – Om Sharma Jan 05 '18 at 21:28
  • @JMoravitz can you please explain this with an example or any tutorial link? – Om Sharma Jan 05 '18 at 21:30
  • 1
    @JMoravitz stars and bars method would also include values greater than capacity of the bag,how to overcome this error? – Om Sharma Jan 05 '18 at 21:52
  • With inclusion-exclusion, as alluded to earlier. Your question can be rephrased into finding the number of non-negative integer solutions to $\begin{cases}c_1+c_2+\dots+c_a+d_1+d_2+\dots+d_b+e=u\0\leq c_i\leq x\0\leq d_i\leq y\e\geq 1\end{cases}$. Letting $C_i$ be the event that $c_i>x$ and $D_i$ the event that $d_i>x$, we are looking for $|\Omega|-|C_1\cup C_2\cup\dots D_1\cup \dots\cup D_b|$ which extends via inclusion-exclusion and each term of which can be solved with stars-and-bars along with a possible change of variable to adjust everything down to having a lower bound of zero. – JMoravitz Jan 05 '18 at 21:57
  • here is a related question with the complication that the boxes are all of possibly different sizes (rather than all of two different sizes) but without the complication of looking for "at least" or "at most" (which is accounted for by using a throwaway variable, which in the above comment would be $e$) – JMoravitz Jan 05 '18 at 21:59

1 Answers1

0

Consider the generalization where there are $m$ boxes and box $i$ contains $n_i$ balls. The number of ways to choose exactly $n$ balls is then the coefficient of $t^n$ in the generating function

$$\prod_{i=1}^m (1 + t + \dots + t^{n_i}).$$

In your case the generating function is

$$(1 + t + \dots + t^x)^a (1 + t + \dots + t^y)^b.$$

We can write $1 + t + \dots + t^{n_i} = \frac{t^{n_i+1} - 1}{t - 1}$ to make these expressions a little nicer. This allows us to express the answer as a certain sum of binomial coefficients but it's not particularly nice (I think it's more or less what you get via an inclusion-exclusion argument as JMoravitz suggests in the comments).

Qiaochu Yuan
  • 419,620