# How to count using polynomials when we have subsets that partially overlap?

This question is my own invention. You can add any restriction when you feel confused.

Assume there are $8$ distinguishable balls outside boxes and $5$ boxes, randomly draw $5$ balls to $5$ boxes respectively, $1$ ball $1$ box, but there is a condition that

1. divide $5$ boxes into $3$ groups,
2. group $1$ is box $1$, box $2$, box $3$; group $2$ is box $2$, box $3$, box $4$; group $3$ is box $3$, box $4$, box $5$

After ball drawn, will return back, every draw is from $8$ balls, just mark the ball number on the box to do a record

The important criterion is that $3$ groups must be distinct that for example group $1$ and group $2$ can not be $2,3,5$ at the same, but it can be $2,3,5$ and $3,5,2$ respectively

If there are more boxes, any two of groups can not be can not be $2,3,5$ at the same time in example.

If it can be generalized to the case of $n$ balls and $r$ boxes, it would be more powerful.

How many ways do balls put into the boxes that satisfy above criteria?

better use $(z+z^2+z^3+z^4+z^5+z^6+z^7+z^8)^5$ i guess divided by or minus $(z+z^2+z^3)^3$ ($z+z^2+z^3)$, $(z^2+z^3+z^4)$... i am confusing about the overlapping

-
You're saying you want to draw "from balls" "to boxes". Do I gather correctly that you in fact want to draw balls from boxes, as usual? –  joriki Mar 11 '12 at 10:05
not draw balls from boxes, the correct is that there are balls outside the boxes, draw balls and put into boxes –  M-Askman Mar 11 '12 at 10:58
Then I think you'll need to clarify the process. How are the balls put into boxes? Do you randomly select a box with uniform distribution into which to put the ball? If you have the opportunity, it might be worthwhile to let someone with a higher proficiency in English who speaks your native language look over the question; it may be less effort to explain to them what you mean than to explain it to us. –  joriki Mar 11 '12 at 11:33
randomly draw balls, just think it from the view of enumerative combination –  M-Askman Mar 11 '12 at 11:35
I don't see a question. –  Gerry Myerson Mar 11 '12 at 11:46