Question
In how many ways can 5 distinct balls be distributed into 3 distinct boxes such that no box is empty?
(JEE Main 2023, similar pattern)
Solution — Step by Step
Each of the 5 balls can go into any of the 3 boxes independently. So the total number of ways (with no restriction):
Let = set of distributions where box is empty.
We want: Total
By inclusion-exclusion:
= distributions with one specific box empty = (5 balls into remaining 2 boxes)
There are such terms:
= distributions with two specific boxes empty = (all balls in the remaining 1 box)
There are such terms:
= all three boxes empty = (impossible, balls must go somewhere)
Number of distributions with no box empty:
Why This Works
The inclusion-exclusion principle systematically removes overcounted cases. First, we subtract all distributions where at least one box is empty. But this double-subtracts distributions where two boxes are empty, so we add those back. The formula ensures exact counting.
This is actually a specific case of the Surjective function count: the number of onto functions from a set of 5 elements to a set of 3 elements. The general formula for surjections from elements to elements is:
For : .
Alternative Method — Using Stirling numbers
The number of distributions = where is the Stirling number of the second kind.
(number of ways to partition 5 objects into 3 non-empty groups).
Since the boxes are distinct: .
For JEE, the distribution formula with inclusion-exclusion is the most reliable method. For small numbers, you can also enumerate: the possible distributions of 5 balls into 3 non-empty boxes are (3,1,1), (2,2,1) types. Count each separately. But for larger numbers, inclusion-exclusion scales better.
Common Mistake
Students sometimes try to split the problem as “choose 3 balls for 3 boxes, then distribute the remaining 2.” This leads to complicated casework and double-counting. The inclusion-exclusion approach is cleaner: start with all distributions and subtract the ones with empty boxes. Don’t overcomplicate it with manual casework.