Occupancy Problem — Definition, Formula & Example
The occupancy problem is the classic question of what happens when you drop balls into bins at random: how many bins end up empty, how many hold two or more balls, or whether every bin gets at least one.
Place balls into bins, and let be the number of balls in bin , so that . An occupancy problem asks for the probability distribution of some function of the occupancy vector , such as the number of empty bins. In the standard model, the balls are distinguishable and each one lands in any bin with probability , independently of the others. Then all assignments are equally likely, and .
Key Formula
Where:
- = Number of balls (distinguishable), each placed at random
- = Number of bins, each equally likely for every ball
- = Number of bins forced to be empty in each inclusion-exclusion term
- = Number of ways to choose which bins are left empty
Worked Example
Problem: Four shoppers each pick one of 3 open checkout lanes at random, independently. What is the probability that every lane gets at least one shopper?
Step 1: Count all outcomes. Each of the 4 shoppers has 3 lane choices, and every assignment is equally likely.
Step 2: Use inclusion-exclusion to count the outcomes with no empty lane. First subtract the outcomes that miss at least one lane, which is 3 ways to pick the lane times assignments. Subtracting this way removes the outcomes that miss two lanes twice, so add those back once.
Step 3: Divide the favorable outcomes by the total.
Answer: The probability that all 3 lanes are used is , a bit less than half.
Why It Matters
Computer scientists use occupancy results to predict collisions in hash tables, where the keys are the balls and the slots are the bins. In statistical physics, the three ways of counting balls in bins match Maxwell-Boltzmann, Bose-Einstein, and Fermi-Dirac statistics for particles in energy states. The birthday problem and the coupon collector problem are both special cases.
Common Mistakes
Mistake: Counting the distinct occupancy patterns and treating them as equally likely. For 4 balls in 3 bins, stars and bars gives patterns, so students write the probability of a pattern as .
Correction: Shoppers, coins, and other physical objects are distinguishable, so the equally likely outcomes are the assignments, not the 15 patterns. The pattern (4, 0, 0) arises from 1 assignment, but (2, 1, 1) arises from 12. Count assignments, or use the multinomial formula.
