Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

N boys and M girls are learning acting skills from a theatre in Mumbai. To perform a play on ‘Ramayana’ they need to form a group of P actors containing not less than 4 boys and not less than 1 girl. The theatre requires you to write a program that tells them the number of ways the group can be formed.

share|cite|improve this question
Hint: I think you can reduce this problem by assuming $4$ of the $P$ slots are filled by boys, and $1$ of the slots are filled by girls. Then you have only $P-5$ slots to be filled by $N-4$ boys and $M-1$ girls. ATM, I'm forgetting how you to count that. – Jeff Feb 18 '12 at 6:12
@Jeff: Unfortunately, without substantial adjustment, this approach won't work. In general it overcounts the number of choices. The idea would work for the related problem of choosing $P$ balls from $M$ green and $N$ red, with the restrictions of the problem, where balls of the same colour are indistinguishable. – André Nicolas Feb 18 '12 at 7:27
The title should give some indication of the actual question. – Marc van Leeuwen Feb 18 '12 at 10:00

Assume that $M \ge 1$, $N\ge 4$, and $P\ge 5$. In how many ways can we choose $P$ people, with no sex restrictions? We are choosing $P$ people from $M+N$. The number of choices is $$\tbinom{M+N}{P}.$$ However, choosing $0$, $1$, $2$, or $3$ boys is forbidden.

In how many ways can we choose $0$ boys, and therefore $P$ girls? The answer is $\binom{M}{P}$. For reasons that will be apparent soon, we write that as $\binom{N}{0}\binom{M}{P}$.

There are $\binom{N}{1}\binom{M}{P-1}$ ways to choose $1$ boy and $P-1\,$ girls.

There are $\binom{N}{2}\binom{M}{P-2}$ ways to choose $2$ boys and $P-2\,$ girls.

There are $\binom{N}{3}\binom{M}{P-3}$ ways to choose $3$ boys and $P-3\,$ girls.

We need to deal with a small technical complication. Suppose, for example, that we are choosing $0$ boys and therefore $P$ girls, but the number $M$ of available girls is less than $P$. The answer above remains correct if we use the common convention that $\binom{m}{n}=0$ if $m<n$.

Finally, at least $1$ girl must be chosen. So the $\binom{N}{P}\binom{M}{0}$ all-boy choices are forbidden.

The total number of forbidden choices is therefore $$\tbinom{N}{0}\tbinom{M}{P}+\tbinom{N}{1}\tbinom{M}{P-1}+\tbinom{N}{2}\tbinom{M}{P-2} +\tbinom{N}{3}\tbinom{M}{P-3}+\tbinom{N}{P}\tbinom{M}{0}.$$ Finally, subtract the above number from the total number $\binom{M+N}{P}$ of choices with no sex restrictions.

share|cite|improve this answer
Is that answer the same as $\binom{(M-1)+(N-4)}{P-5}$? – Jeff Feb 18 '12 at 9:25
@Jeff: For (for instance) $M=3$, $N=8$, $P=5$ one has $\binom{(M-1)+(N-4)}{P-5}=\binom60=1$ whereas $\binom{M+N}P-\sum_{i=0}^3\binom Ni\binom M{P-i}-\binom NP =462-0-0-28-168-56=210$, so frankly: no! – Marc van Leeuwen Feb 18 '12 at 10:25

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.