Sub topic 12
Dividing Objects into Equal and Unequal Groups
This chapter assumes you can compute nCr, that you know factorial notation, and that you have seen the formula for arrangements with repeated letters. Splitting objects into groups is the same counting idea in a new setting. The main risk is overcounting when groups are interchangeable.
Two questions decide everything
Before writing any formula, answer two questions about the problem.
- Are the objects distinct (named people, different books) or identical?
- Are the groups distinguishable (given to named people, or sizes all different) or interchangeable (several groups of the same size with no label)?
This chapter covers distinct objects. Identical objects are handled by stars and bars in a later chapter.
Groups of different sizes
Suppose 12 distinct people are split into groups of 3, 4 and 5. The sizes differ, so each group is already distinguishable by its size. Pick the groups one after another:
C(12,3) × C(9,4) × C(5,5) = 220 × 126 × 1 = 27,720
This equals 12! / (3! 4! 5!), the same multinomial form you used for MISSISSIPPI. Each person is assigned one of three "slots", and the slots have different sizes.
The same number counts the ways to give those groups to three named people, where A gets 3, B gets 4 and C gets 5. If the sizes are all different, naming the receivers changes nothing.
Groups of equal size
Now split the 12 people into three groups of 4 with no labels on the groups. Choosing in sequence gives
C(12,4) × C(8,4) × C(4,4) = 495 × 70 × 1 = 34,650
This count treats "first group, second group, third group" as an ordered list. A split such as {P, Q, R, S}, {T, U, V, W}, {X, Y, Z, A} appears 3! = 6 times, once for each order of listing the same three groups. If the groups are not labelled, divide by 3!:
12! / ((4!)³ × 3!) = 34,650 / 6 = 5,775
If the three groups of 4 go to three named people, the order matters again and the answer is 34,650.
Mixed sizes: divide once per repeated size
Split 8 people into groups of 2, 2 and 4. Only the two groups of size 2 are interchangeable, so divide by 2! once:
8! / (2! 2! 4!) ÷ 2! = 420 ÷ 2 = 210
You can check this directly. Choose the group of 4 in C(8,4) = 70 ways. The remaining 4 people split into two pairs in 3 ways. That gives 70 × 3 = 210.
For several repeated sizes, divide by the factorial of each repeat count. Split 10 people into groups of 2, 2, 3 and 3:
10! / (2! 2! 3! 3!) ÷ (2! × 2!) = 25,200 ÷ 4 = 6,300
Then assign the groups to people
Many CAT problems have two stages: split first, then give the groups to named recipients. Use this chain.
- Count the unlabelled splits.
- Multiply by the number of ways to assign the groups to the recipients.
For the 2, 2, 4 split above, there are 210 unlabelled splits. Give the three groups to three named people. All 3! = 6 assignments give a different outcome, because the two pairs are different sets of people. The count is 210 × 6 = 1,260.
You can confirm it directly. Choose who receives the group of 4 (3 ways). Then 8!/(2! 2! 4!) = 420 splits fill the named slots, but the slot of the person with 4 is fixed, so the count is 3 × 420 = 1,260. The two methods agree.
Pairs and special cases
Pairing 8 players into 4 unlabelled pairs is the standard equal-group case:
8! / ((2!)⁴ × 4!) = 40,320 / (16 × 24) = 105
A short pattern for unlabelled pairs of 2k people is (2k)! / (2ᵏ × k!), which equals the product 1 × 3 × 5 × … × (2k − 1). For 8 players, that is 1 × 3 × 5 × 7 = 105.
Another frequent case is splitting n distinct objects into 2 non-empty groups with no size given. Each object goes to one of two groups, giving 2ⁿ assignments. Remove the 2 cases where one group is empty, then divide by 2 because the groups are unlabelled:
(2ⁿ − 2) / 2 = 2ⁿ⁻¹ − 1
For 4 objects, that gives 7. A direct count agrees: sizes 1 and 3 give 4 ways, and sizes 2 and 2 give 3 ways.
A function that applies the rules
This code encodes the formulas. It lets you check hand answers.
from collections import Counter
from math import factorial
def group_count(n, sizes, labelled):
# Ways to split n distinct objects into groups with the given sizes.
# labelled=False divides by m! for each size that appears m times.
if sum(sizes) != n or min(sizes) < 1:
raise ValueError("sizes must be positive and add up to n")
ways = factorial(n)
for s in sizes:
ways //= factorial(s)
if not labelled:
for repeats in Counter(sizes).values():
ways //= factorial(repeats)
return ways
print(group_count(12, [3, 4, 5], True)) # 27720
print(group_count(12, [4, 4, 4], False)) # 5775
print(group_count(12, [4, 4, 4], True)) # 34650
print(group_count(8, [2, 2, 4], False)) # 210
print(group_count(10, [2, 2, 3, 3], False)) # 6300
print(group_count(8, [2, 2, 2, 2], False)) # 105The labelled=True case with sizes that all differ matches the unlabelled case, as the rules predict.
Common errors
- Dividing too little. Using 34,650 where the question has unlabelled groups of 4.
- Dividing too much. Dividing by 3! for groups of sizes 3, 4 and 5.
- Missing the label. Statements such as "distribute among A, B and C", "three teams assigned to three rooms" or "Team 1, Team 2" make the groups labelled. Statements such as "split into three teams" or "form three pairs" do not.
- Ignoring the order of stages. When the question asks for a split and then an assignment, count the split first and multiply by the assignment count.
Exercises
Exercise
Nine students are divided into three unlabelled groups of 3. In how many ways can this be done? How many ways if the three groups are sent to three named rooms?
Show answer
Unlabelled: 9! / ((3!)³ × 3!) = 362,880 / (216 × 6) = 280. Labelled by room: 9! / (3!)³ = 1,680, which is 280 × 3!.
Exercise
Six people are split into groups of sizes 1, 2 and 3. How many ways are there, and does it matter whether the groups are labelled?
Show answer
6! / (1! 2! 3!) = 720 / 12 = 60. All sizes differ, so no group is interchangeable and the labelled and unlabelled counts are both 60.
Exercise
Seven people are split into groups of sizes 2, 2 and 3. How many unlabelled splits are there, and how many ways can those groups be given to three named people?
Show answer
Unlabelled: 7! / (2! 2! 3!) ÷ 2! = 210 ÷ 2 = 105. Assigning the three distinct groups to three named people multiplies by 3! = 6, giving 630.