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

There are 10 types of fruits, of them 1 type is apples. You have to pick 4 of fruits, but max 2 apples. How many ways are there for you to pick fruits?

share|cite|improve this question


In how many ways can you pick the fruits without apples?

In how many ways can you pick them with 1 apple?

In how many ways can you pick them with 2 apples?

What's the sum of those?

share|cite|improve this answer

Let $x_1$ be the number of apples that you choose, and let $x_2,x_3,\dots,x_{10}$ be the numbers of the other nine types of fruit that you choose. The answer to your question is the number of solutions in non-negative integers of the equation


subject to the condition that $x_1\le 2$.

Without that extra condition limiting the value of $x_1$, this is a standard stars-and-bars problem, and the answer is


(The reasoning behind this formula is explained reasonably well in the linked article.)

However, we have to subtract from this the solutions that have $x_1>2$. If we choose at least $3$ apples, there are $10$ ways to choose the fourth piece of fruit, so there are just $10$ of these unacceptable choices, and the final answer is $715-10=705$.

share|cite|improve this answer

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.