Number of Ways to Order Red Balls and Blue Balls with Limitations

46 Views Asked by At

Suppose there are an infinite number of indistinguishable red balls and blue balls at our disposal. Now we want to want order N balls. The N balls can be made up of any number of red balls and blue balls, but there are 2 limitations that we pose on the ordering. Let R be the maximum number of consecutive red balls that can be in the ordering, and B be the maximum number of consecutive blue balls that can be in the ordering. We want to find the number of different orderings that we can make.

One solution(maybe) that I have thought of is to iterate from 0 to N for some number i, meaning there are i red balls and N - i blue balls that we put in our ordering. Then for each i, we count the total number of orderings ${N \choose i}$ minus the number of orderings that violate our limitations. A bit more on the orderings that violate our limitations later at the end. So, we sum up over all these possibilities, and we should have our answer.

But I want to know if there is a more elegant method of thought that provides a neater solution. It would really helpful!

Anyways, back to orderings that violate our limitations. So we need to order N balls with the limitations R and B. Also, we want i red balls and N - i blue balls. If i > R, let $R_j$ represent the number of orderings such that there are at least j consecutive red balls in the ordering for R + 1 $\leq$ j $\leq$ i. Likewise, let $B_k$ represent the number of orderings such that there are at least k consecutive blue balls for B + 1 $\leq$ k $\leq$ N - i. So we want to find $R_{R+1}$ and $B_{B+1}$ minus their overlap. I think we can find $R_{R+1}$ recursively with the following the equations: $$R_j = (N-j+1){N-j \choose i-j} - R_{j+1}$$ $$R_i = N-j+1$$ Similarly, we can find $B_{B+1}$. However, there could be overlap between $R_{R+1}$ and $B_{B+1}$, and I'm not sure how to find this overlap. How would I find this overlap, or how would I find the number of orderings that violate the restraints in general?

If you can complete my solution or have an entirely different solution for this problem, it would be great if you could explain. Thanks!