Probability of different balls to different boxes There are $6$ different balls that need to be arranged in $4$ different boxes. If there is at least one ball in each box, what is the probability that there is a box with $3$ balls? (assuming that for every arrangement of the balls in the boxes there is the same same probability).


My attempt: is to choose $4$ balls and arrange them in the boxes and then to choose one box that will get the other 2 balls: $$\frac{\dbinom{6}{4}4!\cdot4}{4!\cdot\dbinom{4+6-1}{6}}$$

Is that correct?
Step one: Find the size of the sample space.  How many ways can you arrange six balls into four boxes such that every box gets at least one ball.

Approach via inclusion-exclusion.

Let the balls be labeled $1,2,3,4,5,6$ and the boxes be labeled $A,B,C,D$.

Number of ways placing balls in boxes can be thought of as counting how many functions there are from the set of balls to the set of boxes.  In this case, in particular we wish to count how many surjective functions there are.

Let $X$ be the universal set of all functions from six balls to four boxes.  $X_A$ denote the set of functions where box $A$ is empty (i.e. $A$ has no preimage).  $X_B$ denote the set of functions where box $B$ is empty, ... $X_{A,B}$ the set of functions where both $A$ and $B$ are empty, et cetera.

Then $|X_A^c\cap X_B^c\cap X_C^c\cap X_D^c|$ represents the number of ways of sending the balls to the boxes so that $A$ is not empty, $B$ is not empty, $C$ is not empty, and $D$ is not empty.

Now, expand this via inclusion exclusion: $|X_A^c\cap\dots X_D^c| = |X|-|X_A\cup X_B\cup X_C\cup X_D| \\= |X|-|X_A|-|X_B|-|X_C|-|X_D|+|X_{A,B}|+\dots-|X_{A,B,C}|-\dots+|X_{A,B,C,D}|$

How big is $|X|$?  $|X_A|$?  $|X_{A,B}|$?...


  $=4^6-4\cdot 3^6+6\cdot 2^6-4\cdot 1^6 + 0$




Now, the problem tells us to treat each of these possible ways as having equal probability, so to continue, this will be our denominator.

For the numerator, we notice that for there to be a box with three balls and all boxes to have at least one ball (and not be empty), it must be that there is exactly one box with three and exactly three boxes with one ball each.

Approach via multiplication principle:


Pick which box has three balls
Pick which three balls went into that box
Left to right, for each still empty box, pick a ball from those remaining to go into the box



   There are then $4\cdot \binom{6}{3}\cdot 3!$ good arrangements.


Combine this information using that probability in an unbiased sample space is given as $Pr(E)=\frac{|E|}{|\Omega|}$
Extremely new stuff: we are wrong!

Check this out: simulation disagrees with both of us!

Simulation says:


Numerator = 2880.
Denominator = 7200.
Probability = 0.4.


Go figure.

Simulation code:

import random

arrange_good_target = dict()
arrange_good = dict()

for i in range(0, 10000000):
    balls = [1,2,3,4,5,6]
    buckets = [[],[],[],[]]

    # assign all balls to buckets
    while len(balls) &gt; 0:
        # choose ball and bucket
        ball_i = random.randrange(0,len(balls))
        bucket_i = random.randrange(0,4)

        # put chosen ball in chosen bucket
        buckets[bucket_i].append(balls.pop(ball_i))

    # test if configuration is good
    good = True
    for i in range(0, 4):
        if len(buckets[i]) == 0:
            good = False

    # test if configuration is good and meets target
    good_target = False
    for i in range(0, 4):
        if len(buckets[i]) == 3:
            good_target = True

    # update counters
    if good:
        arrange_good[str(buckets)] = 1

    if good and good_target:
        arrange_good_target[str(buckets)] = 1


# hell yeah dude
probability = float(len(arrange_good_target))/len(arrange_good)

print 'numerator is: ' + str(len(arrange_good_target))
print 'denominator is: ' + str(len(arrange_good))
print 'probability is: ' + str(probability)

#for key in arrange_good.keys():
#    print key


New stuff

My answer after thinking independently (thanks to JMoravitz for putting spoiler-guards):
\begin{equation}
  \frac{{4 \choose 1} \times [{6 \choose 3} \times 3 \times 2 \times 1]}{{4 \choose 1} \times [{6 \choose 3} \times 3 \times 2 \times 1] + {4 \choose 2} \times [{6 \choose 2} \times {4 \choose 2} \times 2 \times 1]}
\end{equation}

Turns out that my answer:


Has an identical numerator.
But my denominator is more straightforward to understand in my view


Let me rewrite mine to make it look tinier:
\begin{equation}
  \frac{{4 \choose 1} {6 \choose 3} 3!}{{4 \choose 1} {6 \choose 3} 3! + {4 \choose 2} {6 \choose 2} {4 \choose 2} 2!}
\end{equation}



Old stuff

let's see... there are only 4 possible configurations where a single box has 3 balls. So clearly the probability is this:
\begin{equation}
\Pr(\text{4 balls in a box}) = \frac{4}{\text{normalization stuff goes here}}
\end{equation}

Now, what are all the possible configurations of fitting six balls into four buckets? This is the value of our $\text{normalization stuff goes here}$.

Let's see. If three balls in a bucket, we get four possibilities. What if we allow for two balls in a bucket? We must have two balls in one bucket, and two other balls in another bucket, then have two buckets each with a single ball (so that we consume all the six balls). Here, we have ${6 \choose 2}$ possibilities.

Now, what if we allow for one ball in each box? Impossible, cause we won't use all six balls.

Now, what if we allow for four balls in a single box? Impossible too, cause we will have an empty bucket.

There you go buddy, answer is:
\begin{equation}
\Pr(\text{4 balls in a box}) = \frac{4}{4 + {6 \choose 4}}
\end{equation}