We have $30$ balls, of which $3$ are black. The balls are divided into five groups of six each. Now, the balls are distributed "randomly", but there are many different ways to randomize things, and they produce different answers. In this case, it seems reasonable to assume that the balls are set out in a row like a shuffled deck of cards, so that each of the $\binom{30}3$ distinguishable arrangements are equally likely, and that we then divide them into groups of six going from left to right. This procedure is appropriate for many applications. I cannot say whether it is the best for your application.
The condition is that each group have no more than two black balls.
- There is $\binom60=1$ way that a group can have no black balls.
- There are $\binom61=6$ ways that a group can have one black ball.
- There are $\binom62=15$ ways that a group can have two black balls.
Thus each group can be represented by the generating function $1+6x+15x^2$.
There are five groups, so the generating function to count all layouts which obey the condition is
$$(1+6x+15x^2)^5$$
The expansion begins
$$1+30x+435x^2+3960x^3+24930x^4+\ldots$$
which tells us that there is one layout with no black balls, thirty layouts with one black ball, $435$ layouts with two black balls, etc. In your example we get $3960$ layouts, and on dividing by $\binom{30}3=4060$, the result is a probability of $0.97537...$
In general, the coefficients can be calculated with the multinomial theorem. Here the coefficient for $x^p$, where $p$ represents the number of black balls, is
$$\sum_{i+j+k=5;\ j+2k=p} \binom{5}{i,j,k}1^i6^j15^k$$
where $\binom{5}{i,j,k}=\frac{5!}{i!j!k!}$. Since this example involves a trinomial, $1+6x+15x^2$, we have three variables $i,j,k$ and we need to find non-negative integer solutions of the system $i+j+k=5;\ j+2k=p$. For $p=3$ the solutions are $(3,1,1)$ and $(2,3,0)$ so the sum is
$$20\cdot 1^3\cdot 6^1\cdot 15^1+10\cdot 1^2\cdot 6^3\cdot 15^0=1800+2160=3960$$
Larger examples can be done by a computer algebra system, or just any package which can multiply polynomials together.
We have $6$ white balls (and therefore $6$ black balls) to place into $4$ bags. Each bag can contain $0,1,2$ or $3$ white balls (and correspondingly has $3-k$ black balls).
After each ball has been placed, we have a representative of the coefficient of $x^6$ in $(1+x+x^2+x^3)^4$.
So finding the coefficient of $x^6$ in $(1+x+x^2+x^3)^4$ gives the answer.
This can be calculated as:
$$[x^6]\left(\frac{1-x^4}{1-x}\right)^4$$
$$=[x^6]\frac{1-4x^4+\dots}{(1-x)^4}$$
$$=[x^6]\left(1-4x^4+\dots\right)\left(\sum_\limits{k=3}^\infty \binom{k}{3} x^{k-3}\right)$$
$$=\binom{9}{3}-4\binom{5}{3}$$
$$=84-4\cdot10$$
$$=44$$
Best Answer
I think it's just $ (8+1) \times (3+1) \times (5+1) =216$, by the product principle. The "plus 1's" come from the fact that you could have zero black balls on one side, (or zero White balls or zero blue balls).
Now, $216$ is the answer only if (a) you consider:
3 Black, 1 White and 4 Blue in "left group" and 5 Black, 2 White and 1 Blue in "right group"
different to: 5 Black, 2 White 1 Blue in "left group" and 3 Black, 1 White and 4 Blue in "right group"
and
you're OK with having one group being empty.
If you consider swapping groups as above to be the same, then just halve the 216.
And there are 2 out of 216 where 1 group is empty.
So you need to clarify your question a bit...