I am trying to find formula for calculating unique combinations. Say if i have $4$ red balls, $2$ blue balls, if i need to choose $3$ balls out of them and order is not mandatory, i get following options:


The total number of permutation for $4$ red balls and $2$ blue balls is $\frac{6!}{2!4!} = 15$. But how do i get above unique option for required balls (in this case, $3$ balls)?

P.S: one more eg: if i have $6$ red balls and $2$ blue balls and if i take $4$ balls, unique number of combination is $3$ again.

  • $\begingroup$ It's not totally clear what you are looking for. Let me know if I understand correctly: Given $a$ red balls and $b$ blue balls, and an integer $1 \leq n \leq a+b$, you want to know how many unique ways there are to choose $n$ balls out of the total $(a+b)$ balls, disregarding order? $\endgroup$ – j3M Oct 12 '17 at 10:31
  • $\begingroup$ yes, perfect way to describe $\endgroup$ – Ama Oct 12 '17 at 11:02
  • $\begingroup$ The reason you obtain $3$ for both your examples is that you can select either $0$, $1$, or $2$ blue balls. $\endgroup$ – N. F. Taussig Oct 12 '17 at 11:47

Use the stars and bars method to find the possible combinations of $3$ balls from unlimited amount of blue and red balls. After you find out the number of such combinations, now subtract the combainations that use too many blue balls. In you example you have:

$$\binom{3+2-1}{3} = \binom{4}{3} = 4$$

To find the bad combinations just assume you have already drawn $3$ blue balls and try to find how many possible combinations you can get the rest $3-3 = 0$ balls in the same fashion. So you will get that the answer is $1$, so there are $4-1$ ways to draw $3$ balls from $4$ red and $2$ blue ones.

Another one is to use generating functions. So you just multiply:

$$(1 + x + x^2 + x^3 + x^4)(1+x+x^2) = 1 + 2x + 3x^2 + 3x^3 + 3x^4 + 2x^5 + x^6$$

and then check the coefficient in front of $x^3$ to get you answer.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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