[Math] What are the number of ways to pack apples and oranges in 6 baskets with restrictions

combinationscombinatoricsdiscrete mathematics

There are 6 baskets numbered 1,2,3,4,5,6. Each basket needs to be filled up with fruits of the same kind (either apple or oranges). These are the conditions which needs to be satisfied:

  1. At least 1 basket contains apples
  2. If there are more than one basket that contains apples, these apple baskets must be numbered consecutively

The total number of ways this can be done is?

My attempt:

I used combination with repetitions. Since there are 2 objects and 6 bins, you just plug in these values into the formula which is ${n+r-1 \choose r}$ with n bins and r objects, which is ${6+2-1 \choose 2}$ = 21.

I'm not sure if this is the correct answer, since it's too straightforward and didn't take into account the restrictions. I don't know how to approach it otherwise.

Best Answer

Your answer is correct: to visualize this, let's use bars ($|$) to symbolize the baskets and plusses ($+$) to symbolize our possible choices.

We have six baskets, and we want to find how many ways we can select a set of consecutive baskets to put the apples in, given that there must be at least one basket with apples in it.

Consider the following arrangement of bars and plusses: $||+||+||$. We could take this to mean that the baskets inside the plusses will get apples and the rest will get oranges. The baskets inside the plusses will always be consecutive, so as long as we don't place our two plusses in the same location, we will meet both requirements.

There are $7$ possible spots for the plusses (we include the ends outside the bars) and we need to place $2$ plusses without replacement, and the order doesn't matter, so our final answer is $\binom{7}{2}$.