Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

There are $12$ different boxes which has number from $1$ to $12$ and $8$ same balls. Ask how many way to arrange these $8$ balls to $12$ boxes such that, the sum of balls in box $1;2;3$ is even number, the sum of balls in box $4;5;6$ is odd number

share|improve this question
1  
Since the number of balls is less than the number of boxes, I like to ask: can we put more than one ball into a singe box? –  Hendrik Jan Nov 12 '12 at 13:24

2 Answers 2

up vote 1 down vote accepted

Let's say there are $2k$ balls in boxes $1$ through $3$ and $2l+1$ balls in boxes $4$ through $6$. Then $0\le k\le3$ and $0\le l\le3-k$. In terms of the stars and bars approach, $k$ and $l$ fix the positions of two of the $11$ bars, and it remains to pick positions for $2$ bars among $2k$ stars, $2$ bars among $2l+1$ stars and $5$ bars among $8-2k-(2l+1)$ stars. Thus the total number of ways to arrange the balls is

$$ \sum_{k=0}^3\sum_{l=0}^{3-k}\binom{2k+2}2\binom{2l+3}2\binom{12-2(k+l)}5=18864 $$

(computation).

share|improve this answer

18864.

We can compute this using GAP as follows. We first choose $a$ balls in cells 1..3, then $b$ balls in cells 4..6, then the remainder, $c$, must all go in cells 7..12. For each (a,b,c), we compute the unordered partitions of a,b,c that could go in the cells, 1..3, 4..6 and 7..12, respectively. Then we compute the number of ordered partitions that generate the given unordered partitions.

count:=0;
inc:=0;
for a in Filtered([0..8],i->i mod 2=0) do
  for b in Filtered([0..8],i->i mod 2=1) do
    c:=8-a-b;
    if(c<0) then continue; fi;
    Print(a," ball(s) in 1..3;  ",b," ball(s) in 4..6;  ",c," ball(s) elsewhere\n");
    for A in RestrictedPartitions(a+3,[1..a+1],3)-1 do
      for B in RestrictedPartitions(b+3,[1..b+1],3)-1 do
        for C in RestrictedPartitions(c+6,[1..c+1],6)-1 do
          orbA:=OrbitLength(SymmetricGroup(3),A,Permuted);
          orbB:=OrbitLength(SymmetricGroup(3),B,Permuted);
          orbC:=OrbitLength(SymmetricGroup(6),C,Permuted);
          inc:=orbA*orbB*orbC;
          Print(A," ",B," ",C," ",inc,"\n");
          count:=count+inc;
        od;
      od;
    od;
  od;
od;
Print("total configurations: ",count,"\n");

Note, the somewhat tricky use of RestrictedPartitions is due to the fact that this function is invalid for parts of size 0.

The output was:

0 ball(s) in 1..3;  1 ball(s) in 4..6;  7 ball(s) elsewhere
[ 0, 0, 0 ] [ 1, 0, 0 ] [ 2, 1, 1, 1, 1, 1 ] 18
[ 0, 0, 0 ] [ 1, 0, 0 ] [ 2, 2, 1, 1, 1, 0 ] 180
[ 0, 0, 0 ] [ 1, 0, 0 ] [ 2, 2, 2, 1, 0, 0 ] 180
[ 0, 0, 0 ] [ 1, 0, 0 ] [ 3, 1, 1, 1, 1, 0 ] 90
[ 0, 0, 0 ] [ 1, 0, 0 ] [ 3, 2, 1, 1, 0, 0 ] 540
[ 0, 0, 0 ] [ 1, 0, 0 ] [ 3, 2, 2, 0, 0, 0 ] 180
[ 0, 0, 0 ] [ 1, 0, 0 ] [ 3, 3, 1, 0, 0, 0 ] 180
[ 0, 0, 0 ] [ 1, 0, 0 ] [ 4, 1, 1, 1, 0, 0 ] 180
[ 0, 0, 0 ] [ 1, 0, 0 ] [ 4, 2, 1, 0, 0, 0 ] 360
[ 0, 0, 0 ] [ 1, 0, 0 ] [ 4, 3, 0, 0, 0, 0 ] 90
[ 0, 0, 0 ] [ 1, 0, 0 ] [ 5, 1, 1, 0, 0, 0 ] 180
[ 0, 0, 0 ] [ 1, 0, 0 ] [ 5, 2, 0, 0, 0, 0 ] 90
[ 0, 0, 0 ] [ 1, 0, 0 ] [ 6, 1, 0, 0, 0, 0 ] 90
[ 0, 0, 0 ] [ 1, 0, 0 ] [ 7, 0, 0, 0, 0, 0 ] 18
0 ball(s) in 1..3;  3 ball(s) in 4..6;  5 ball(s) elsewhere
[ 0, 0, 0 ] [ 1, 1, 1 ] [ 1, 1, 1, 1, 1, 0 ] 6
[ 0, 0, 0 ] [ 1, 1, 1 ] [ 2, 1, 1, 1, 0, 0 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 108
[ 6, 0, 0 ] [ 1, 0, 0 ] [ 1, 0, 0, 0, 0, 0 ] 54
total configurations: 18864
share|improve this answer
    
I agree that there's probably no particularly clever way to find this number that doesn't involve adding up the various possibilities for the even and odd numbers of balls in the groups of boxes, but we can do with a bit less computational effort than this; see my answer. –  joriki Nov 12 '12 at 13:50
    
Ah yes, I should have used the stars and bars approach; I snipped the comment from my answer. –  Douglas S. Stones Nov 12 '12 at 20:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.