Filling at least $1$ box with a white ball from $1$ to $n$ numbered boxes

combinationscombinatoricsdiscrete mathematics

Given $n$ boxes numbered $1$ to $n$, each box is to be filled with either a white ball or a blue ball
such that at least one box contains a white ball and boxes containing white balls are consecutively
numbered. What is the total number of ways this can be done?

enter image description here

Solution provided:

The task is similar to choosing two out of the $n + 1$ crosses to mark the start and
end of the consecutively numbered boxes that contain white balls.
This is ${n+1 \choose 2}$, which is equal to $\frac{n(n + 1)}{2}$.

My question:

I get that the picture shows $n$ boxes because we can have $1$ to $n$ white balls.
I have a feeling they are using the $r$-combination formula here: ${r + n -1 \choose r}$.

That's all about I get. I have no clue why they have $n+1$ crosses or why they are choosing only $2$ from those crosses or what those crosses represent even?


PS: I know there is sum of sequence approach to this but I'm required to provide a combinatorial working.

Best Answer

To make a $7$-lettered string $$BBBBWWW$$ given the $7$ slots $$ \square \square \square \square \square \square \square $$ first separate the squares where consecutive $W$'s are to be placed like this $$ \square \square \square \square \times \square \square \square \times $$ and then place the W's into squares between crosses (and B's in rest).

The two crosses, which mark the beginning and end of substring of $W$'s, can be placed in any $n+1$ places around $n$ slots, hence $$ \binom{n+1}{2}$$

Related Question