Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It's Friday, and I'm tired, so there possibly a trivial solution that I am overlooking ...

The problem is the following: I have ($n=2$) two kinds of things, say Apples and Bananas, and I choose $k$ of these, not minding the order in which I take them.

What is the possible number of combinations, given that I only have $\alpha$ Apples and $\beta$ Bananas? ($\alpha+\beta>k$, but typically $\alpha<=k$ or $\beta<=k$ or both). And how many solutions are there that include exactly $\gamma<=\alpha$ Apples?

(I think that without the limits the solution would be an application of the multiset-number/stars-and-bars, with n and k. However, these solutions assume a unlimited supply of fruit, and I cannot see a way to adapt that these results to my limits.)

share|cite|improve this question
Are the apples distinguishable? – Phira May 6 '11 at 15:56
They're Fuji and Granny Smith apples. – Neil May 6 '11 at 16:23
up vote 3 down vote accepted

Choosing $\gamma$ apples you must have $k-\gamma$ bananas (if $\gamma \ge k-\beta$). That is the only way, unless you are going to distinguish the apples and distinguish the bananas, in which case there are ${\alpha \choose \gamma}{\beta \choose k-\gamma}$ ways.

Add these up over $\gamma$ and you get your answer: either

$$\sum_{\gamma=\max(0,k-\beta)}^{\min(k,\alpha)} 1 $$

if you are not going to distinguish the apples and distinguish the bananas, or

$$\sum_{\gamma=\max(0,k-\beta)}^{\min(k,\alpha)} {\alpha \choose \gamma}{\beta \choose k-\gamma} $$

if you are.

The first of these is equal to $\alpha+\beta+1-k$, provided that $ 0 \le k - \beta < \alpha \le k$.

share|cite|improve this answer
In fact, I realized I have to distinguish the apples and bananas only after writing the question (and reading your answer). – subsub May 9 '11 at 8:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.