We can set up the position of the red balls in this way
i) BRBRBRBRB
Where R denotes the places where we can keep the red balls and B denotes the places where we can keep the black balls.
Now, the red balls can be arranged within themselves in 4! ways.
In the 5 gaps that are available between the red balls, we have to arrange to black balls. They can be arranged in 5C5 ways which is 5!.
Hence,
Total possible ways of arranging balls such that
no two balls of the same color come together 4!×5!=2880.We can set up the position of the red balls in this way
ii) There are two possibilities of arranging balls in such a way thatBBBBBRRRR or RRRRBBBBB
Where R denotes the places where we can keep the red balls and B denotes the places where we can keep the black balls.
Now, the red balls can be arranged within themselves in 4! ways.
In the 5 gaps that are available between the red balls, we have to arrange to black balls. They can be arranged in 5C5 ways which is 5!.
Hence,
Total possible ways of arranging balls such that
no two balls of the same color come together 2×4!×5!=5760.