Skip to main content

Three counting principles for restricted arrangements: grouping into blocks, counting the complement, and splitting into cases with inclusion-exclusion

Syllabus dot point

“Apply three reusable counting principles to ordered arrangements with restrictions: keep tied items together by grouping them into a block and ordering inside it, count an unwanted condition and subtract it from the total (the complement), and split an 'or' count into non-overlapping cases, subtracting the overlap by inclusion-exclusion when the cases meet”

HSCMaths Extension 1Combinatorics (ME-A1)17 min read

Quick answer

Three moves handle restricted ordered arrangements. Grouping (the block method): when items must be together, glue them into a block, order the groups, then multiply by k!k! for the inside of each block, for example a couple with a block of three girls gives 5!×2!×3!=14405! \times 2! \times 3! = 1440. The complement: count "at least one", "not all" or "separated" as (total)−(unwanted)(\text{total}) - (\text{unwanted}), for example two vowels apart is 7!−2!×6!=36007! - 2! \times 6! = 3600. Cases: split a hard "or" into cases and add, subtracting the overlap once when the cases meet, by inclusion-exclusion ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B|, for example 250+120−20=350250 + 120 - 20 = 350. A fourth shortcut is symmetry: one item "somewhere to the left of" another distinct item happens in exactly half the arrangements, for example 6!2=360\tfrac{6!}{2} = 360 for NN left of UU in NUMBER\text{NUMBER}.

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. How exam questions ask about this dot point
  4. Practice questions

What this dot point is asking

The multiplication principle and ordered selections page gave you the engine for counting in stages, the powers nrn^r and permutations nPr^{n}P_{r}, and the first two restriction moves: deal with the hardest box first, and fix a forced position. This page is about the three principles that handle the harder restrictions, the ones that decide most of the marks on a counting question. Each is a way of reshaping a question you cannot box directly into one you can.

The three moves are grouping, the complement, and cases. Grouping handles "must be together": glue the tied items into a single block, order the blocks, then order inside each block. The complement handles "at least one", "not all" and "must be separated": count the unwanted arrangements and subtract them from the total. Cases handle a genuine "or" that no single box diagram captures: split into separate cases and add, and if the cases overlap, subtract the overlap so nothing is counted twice. That last subtraction is the inclusion-exclusion principle, the same ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B| you met in set theory. The whole skill is reading the wording, picking the move, and laying the working out so a marker can follow it.

The answer

Principle 1: grouping (the block method)

When certain items must stay together, you cannot order them as if they were free, because the arrangement has to keep them adjacent. The fix is to glue the tied items into a single block and treat that block as one item. The arrangement now has fewer items, the block plus everything else, and you order those in the usual way. Then, because the items inside a block can still be shuffled among themselves while staying adjacent, you separately order the inside of each block and multiply. In short: order the groups, then order within each group.

A group can even be a single item, which orders in 1!=11! = 1 way and so contributes nothing, but it is worth listing the groups explicitly so you do not miscount how many there are. The classic question stacks two groups at once. Four boys and four girls form a queue; one couple (one boy and one girl) want to stand together, and three particular girls also want to stand together, while the remaining three boys do not mind where they go. Count the groups: the couple is one group, the three girls are one group, and each of the three free boys is a group of one, giving 55 groups in all. Order the 55 groups in 5!5! ways, order the couple internally in 2!2! ways, and order the three girls internally in 3!3! ways:

5!×2!×3!=120×2×6=1440.5! \times 2! \times 3! = 120 \times 2 \times 6 = 1440.

The block method: collapse each tied group into one slotEight people in a queue: a couple and a block of three girls must each stay together, with three free boys. Glue the couple and the three girls so each becomes a single block, leaving five groups. Order the five groups in five factorial ways, then order inside the couple in two factorial and inside the girls in three factorial. The total is five factorial times two factorial times three factorial, which equals 1440.The block method: glue each tied group into one slotCCGGGbbbstay togetherstay togetherglue each tied group ↓ one block5[CC] block×4[GGG] block×3×2×1order the 5 groups× 2!in couple× 3!in girls5! × 2! × 3! = 120 × 2 × 6 = 1440

The slot diagram shows the idea exactly. The eight people collapse into five group-slots, two of them glued blocks drawn with a heavier outline, and you order those five in 5×4×3×2×1=5!5 \times 4 \times 3 \times 2 \times 1 = 5!. The two tails on the right, ×2!\times 2! and ×3!\times 3!, are the internal orders of the couple and the girls. The single boys add no tail because 1!=11! = 1.

Key fact

The grouping (block) principle. If certain items must stay together, glue them into a single block and count

(order the groups)×(order inside group 1)×(order inside group 2)×⋯ .(\text{order the groups}) \times (\text{order inside group 1}) \times (\text{order inside group 2}) \times \cdots.

If the items split into gg groups (a block of kk items counts as one group, a lone item as a group of one), order the gg groups in g!g! ways and multiply by ki!k_i! for the inside of each block. A block of kk contributes k!k!; a lone item contributes 1!=11! = 1.

Principle 2: the complement (count the unwanted and subtract)

Some conditions are awkward to count head-on but easy to count in reverse. "At least one" is the signature example, because counting it directly forces you to add the cases exactly one, exactly two, and so on. The escape is the complement: count the arrangements that fail the condition, the ones with none of the wanted feature, and subtract from the total.

(wanted)=(total)−(unwanted).(\text{wanted}) = (\text{total}) - (\text{unwanted}).

The complement is also the fastest way to count "must be separated", which is the exact mirror of grouping. To separate two items, count every arrangement, then subtract the arrangements where they are together (which you get from the block method). Take seven-letter words formed from the letters A,B,C,D,E,F,GA, B, C, D, E, F, G, with the two vowels AA and EE required to be separated by at least one consonant. The total number of arrangements of seven distinct letters is 7!=50407! = 5040. The unwanted arrangements are those with AA and EE together; glue them into a block, leaving 66 items in 6!6! ways with 2!2! internal orders, so the together count is 2!×6!=14402! \times 6! = 1440. Therefore

7!−2!×6!=5040−1440=36007! - 2! \times 6! = 5040 - 1440 = 3600

words have the vowels apart. The "2×6!2 \times 6!" is just 2!×6!2! \times 6!; it is the whole unwanted block count, not a stray factor.

Key fact

The complement principle. When the wanted condition splits into many cases but its negation is a single clean count, use

(wanted)=(total)−(none / unwanted).(\text{wanted}) = (\text{total}) - (\text{none / unwanted}).

"At least one" subtracts the "none" count. "Must be separated" subtracts the "together" count, and "together" is itself a block-method count. The trigger words are at least one, at most, not all, and must be apart.

Principle 3: cases (split, add, and subtract any overlap)

Sometimes the conditions are so awkward that no single box diagram can capture them, and the honest thing is to split the problem into cases, count each separately, and add. The one rule that makes this safe is about overlap. If the cases are genuinely disjoint, that is, no arrangement belongs to two of them at once, you simply add the case counts. If the cases overlap, an arrangement in the overlap gets counted once in each case, so you must subtract the overlap once to correct the double count. For two overlapping cases this is the inclusion-exclusion principle:

∣A∪B∣=∣A∣+∣B∣−∣A∩B∣,|A \cup B| = |A| + |B| - |A \cap B|,

the same identity you met for sets. It says: add the sizes of the two cases, then take back the shared part you counted twice.

Here is the contrast in one breath. First a disjoint count. How many whole numbers below 10001000 are odd and greater than 500500, or are a multiple of 55 and less than 200200? There are 250250 odd numbers from 501501 to 999999, and there are 4040 multiples of 55 below 200200 (counting 00). No number can be both greater than 500500 and less than 200200, so the cases cannot overlap and you add: 250+40=290250 + 40 = 290.

Now an overlapping count, which is where inclusion-exclusion earns its keep. How many three-digit numbers (from 100100 to 999999) are odd and greater than 500500, or a multiple of 55 and less than 700700? Let AA be the odd numbers above 500500 and BB the multiples of 55 below 700700. There are 250250 numbers in AA (the odd numbers 501501 to 999999) and 120120 numbers in BB (the multiples of 55 from 100100 to 695695). This time the cases overlap: an odd multiple of 55 between 501501 and 699699 lies in both. Those are the numbers 505,515,…,695505, 515, \dots, 695, of which there are 2020. So

∣A∪B∣=250+120−20=350.|A \cup B| = 250 + 120 - 20 = 350.

Two overlapping cases: add, then subtract the overlapTwo overlapping sets A and B. The size of A or B equals the size of A plus the size of B minus the size of the overlap A and B, so that the shared region is not counted twice. With A of size 250, B of size 120 and overlap 20, the union is 250 plus 120 minus 20, which is 350.Overlapping cases: add them, then subtract the overlapAB230A only20both100B only|A ∪ B| = 250 + 120 − 20 = 350

The Venn picture makes the bookkeeping obvious. The left circle holds 250250, the right holds 120120, but the lens where they meet holds 2020 counted in both. Adding 250+120250 + 120 counts that lens twice, so subtracting 2020 once leaves each region counted exactly once: the three regions hold 230230, 2020 and 100100, totalling 350350.

Key fact

The cases principle (and inclusion-exclusion). Split a hard "or" into cases, count each, and add. First ask whether the cases can overlap.

disjoint cases: ∣A∣+∣B∣,overlapping cases: ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣.\text{disjoint cases: } |A| + |B|, \qquad \text{overlapping cases: } |A \cup B| = |A| + |B| - |A \cap B|.

If an item could satisfy two cases at once, the cases overlap and you must subtract the overlap once. Always minimise the number of cases, and check disjointness before you add.

A fourth trick: counting by symmetry

A few questions reward a one-line symmetry argument instead of any of the three principles. The standard one is "AA is somewhere to the left of BB" in a row of distinct items, where AA and BB need not be adjacent. In any arrangement, exactly one of two things is true: AA is left of BB, or BB is left of AA. Reversing the row, or just swapping the two labels, pairs each "AA left of BB" arrangement with exactly one "BB left of AA" arrangement, so the two outcomes are equally likely. Neither is special, so exactly half of all arrangements have AA to the left of BB.

For example, in arrangements of the six distinct letters of NUMBER\text{NUMBER}, the number with NN somewhere to the left of UU is half of the total:

6!2=7202=360.\frac{6!}{2} = \frac{720}{2} = 360.

The same halving works for any single "left of" condition on two distinguishable items, because the swap is a perfect pairing. It does not extend naively to three or more items in a fixed order, where the fraction is 13!\tfrac{1}{3!}, nor to items that might be identical, where the swap is not a genuine pairing.

How exam questions ask about this dot point

The wording points straight at the move. Match the phrase to the principle:

  • "...must sit together / be next to each other / as a group", "kept together", "the vowels are together". Grouping: glue the tied items into a block, order the groups, then multiply by k!k! for the inside of each block.
  • "...two groups must each be together", "the boys together and the girls together". Grouping with several blocks: order the groups, then multiply by the internal ki!k_i! of every block.
  • "...at least one...", "at most...", "not all...". Complement: count the total, subtract the "none" count.
  • "...must be separated / not next to each other / no two together". Complement of grouping: total minus the "together" block count.
  • "...XX or YY..." where no single slot diagram fits. Cases: split, count each, add. Check overlap first.
  • "...XX or YY..." where an item can satisfy both. Inclusion-exclusion: ∣A∣+∣B∣−∣A∩B∣|A| + |B| - |A \cap B|, subtracting the overlap once.
  • "...XX somewhere to the left of / before YY", two distinguishable items. Symmetry: halve the total, 12×(total)\tfrac{1}{2} \times (\text{total}).
Worked examples

Arrange a queue with two separate groups kept together

Four boys and four girls form a queue. One couple, made of one boy and one girl, want to stand together; three particular girls also want to stand together; the remaining three boys do not mind where they stand. How many acceptable queues are there?

List the groups. The couple is one group, the three tied girls are one group, and each of the three free boys is a group of one. That is 55 groups in total.

Order the groups. The 55 groups can be arranged in

5!=120 ways.5! = 120 \text{ ways.}

Order inside each block. The couple has 2!2! internal orders and the three girls have 3!3! internal orders. The single boys contribute 1!1! each, so nothing extra. Multiply:

5!×2!×3!=120×2×6=1440.5! \times 2! \times 3! = 120 \times 2 \times 6 = 1440.

Final answer. There are 14401440 acceptable queues. Counting only 5!5! and forgetting the internal 2!2! and 3!3! is the usual slip; it undercounts by a factor of 1212.


Separate two vowels using the complement

Seven-letter words are formed using each of the letters A,B,C,D,E,F,GA, B, C, D, E, F, G once. In how many of them are the two vowels, AA and EE, separated by at least one consonant?

Recognise "separated" as a complement. Counting the separated arrangements directly is awkward, so count the total and subtract the arrangements where AA and EE are together.

Count all arrangements. Seven distinct letters in a row give

7!=5040.7! = 5040.

Count the unwanted (vowels together) by the block method. Glue AA and EE into one block, leaving 66 items in 6!6! ways with 2!2! internal orders:

2!×6!=2×720=1440.2! \times 6! = 2 \times 720 = 1440.

Subtract.

7!−2!×6!=5040−1440=3600.7! - 2! \times 6! = 5040 - 1440 = 3600.

Final answer. There are 36003600 words with the vowels apart. "Separated" is just the complement of "together", so the block count is exactly what you take away.


Count an "or" with overlapping cases by inclusion-exclusion

How many three-digit whole numbers (from 100100 to 999999) are odd and greater than 500500, or are a multiple of 55 and less than 700700?

Name the two cases and test for overlap. Let AA be the odd numbers greater than 500500 and BB the multiples of 55 less than 700700. A number can be both (an odd multiple of 55 between 501501 and 699699), so the cases overlap and inclusion-exclusion is needed.

Count case AA. The odd numbers from 501501 to 999999 are 501,503,…,999501, 503, \dots, 999, which number

999−5012+1=250.\frac{999 - 501}{2} + 1 = 250.

Count case BB. The multiples of 55 from 100100 to 695695 are 100,105,…,695100, 105, \dots, 695, which number

695−1005+1=120.\frac{695 - 100}{5} + 1 = 120.

Count the overlap A∩BA \cap B. These are the odd multiples of 55 from 505505 to 695695, namely 505,515,…,695505, 515, \dots, 695 (every second multiple of 55), which number

695−50510+1=20.\frac{695 - 505}{10} + 1 = 20.

Apply inclusion-exclusion.

∣A∪B∣=250+120−20=350.|A \cup B| = 250 + 120 - 20 = 350.

Final answer. There are 350350 such numbers. Adding 250+120=370250 + 120 = 370 without removing the overlap double-counts the 2020 shared numbers.


Count an arrangement by symmetry

In how many arrangements of the six distinct letters of the word NUMBER\text{NUMBER} does NN appear somewhere to the left of UU? The letters need not be next to each other.

Set up the symmetry pairing. In every arrangement either NN is left of UU or UU is left of NN. Swapping the positions of NN and UU turns one type into the other and back, a perfect one-to-one pairing, so the two types are equally numerous.

Count all arrangements. Six distinct letters give

6!=720.6! = 720.

Halve. Exactly half have NN to the left of UU:

6!2=7202=360.\frac{6!}{2} = \frac{720}{2} = 360.

Final answer. In 360360 arrangements NN is somewhere to the left of UU. The same halving works for any single "left of" condition on two distinct items, because the swap pairs the arrangements exactly.


Combine grouping and the complement

Eight people, including three friends XX, YY and ZZ, sit in a row of eight seats. In how many arrangements are no two of XX, YY, ZZ all together as a single block, that is, the three friends do NOT occupy three consecutive seats?

Choose the complement. "Not all three consecutive" is the complement of "all three consecutive", so count the total and subtract the arrangements where XX, YY, ZZ form one solid block.

Count all arrangements. Eight distinct people give

8!=40 320.8! = 40\,320.

Count the unwanted (the three in one block) by grouping. Glue XX, YY, ZZ into one block, leaving 66 items in 6!6! ways, with 3!3! internal orders of the block:

6!×3!=720×6=4320.6! \times 3! = 720 \times 6 = 4320.

Subtract.

8!−6!×3!=40 320−4320=36 000.8! - 6! \times 3! = 40\,320 - 4320 = 36\,000.

Final answer. There are 36 00036\,000 arrangements in which XX, YY, ZZ are not all three consecutive. Grouping supplies the unwanted count; the complement turns it into the answer.

Common traps
Forgetting the internal orders of a block
Grouping is two stages, not one: order the groups AND order inside each block. A couple together gives 5!×2!5! \times 2!, not 5!5!; two blocks of sizes 22 and 33 give 5!×2!×3!5! \times 2! \times 3!, not 5!5!.
Counting "at least one" or "separated" directly
Both fragment into overlapping cases. Use the complement: "at least one" is total minus "none"; "separated" is total minus "together".
Adding overlapping cases without subtracting
If an item can satisfy two cases at once, adding the case counts double-counts the overlap. Always test disjointness; if the cases meet, subtract ∣A∩B∣|A \cap B| once.
Subtracting an overlap that is empty (or assuming one that is not)
Inclusion-exclusion needs the real overlap. If no item can be in both cases, the overlap is 00 and you just add; check it rather than guessing.
Halving when the items can be identical or the order is over three items
The "left of" symmetry halves only for two distinguishable items. For three items in a fixed order the fraction is 13!\tfrac{1}{3!}, and identical items break the swap pairing entirely.
Mislabelling 2×6!2 \times 6!
In the vowel example, 2×6!2 \times 6! is 2!×6!2! \times 6!, the full "together" block count, not 6!6! with a stray 22. Write it as a block count so the logic is visible.
Exam technique

Markers reward seeing the principle named and the working laid out so each stage is checkable. Lock in the marks like this:

  • Say which principle you are using. Write "block method", "complement: total minus together", or "cases with inclusion-exclusion" before the arithmetic. The statement often earns the method mark even if a number slips.
  • For grouping, show both stages. Write the group ordering and every internal factor, for example 5!×2!×3!5! \times 2! \times 3!, never a bare final number. Count and state how many groups there are.
  • For the complement, write the subtraction line explicitly: (wanted)=(total)−(unwanted)(\text{wanted}) = (\text{total}) - (\text{unwanted}), then evaluate each piece. For "separated", show that the unwanted piece is the block count.
  • For cases, test overlap first. State "the cases are disjoint" and add, or "the cases overlap by …\dots" and subtract once. A quick Venn sketch with the three region counts is persuasive and guards against double counting.
  • For a "left of" condition, justify the halving in one line ("by symmetry, NN left of UU in exactly half"), then write 12×(total)\tfrac{1}{2} \times (\text{total}).
  • Keep one source of truth. If a sub-count (like a block total) appears twice, compute it once and reuse it, so a slip cannot creep into only one place.

Practice questions

Original practice questions graded from foundation to exam level, each with a full worked solution. Try them before revealing the solution.

foundation2 marks
Three different mathematics books and four different science books are arranged in a row on a shelf, with all the books on each subject kept together. In how many ways can this be done?
Show worked solution →
Treat each subject as one block
Glue the three maths books into one block and the four science books into another. There are then 22 blocks to arrange in the row.
Order the blocks
The 22 blocks can be placed in 2!=22! = 2 orders (maths block then science block, or the reverse).
Order inside each block
The maths books rearrange among themselves in 3!=63! = 6 ways and the science books in 4!=244! = 24 ways. By the multiplication principle,

2!×3!×4!=2×6×24=288.2! \times 3! \times 4! = 2 \times 6 \times 24 = 288.

Answer. There are 288288 arrangements.

foundation3 marks
Five people stand in a row. Two of them, PP and QQ, refuse to stand next to each other. In how many ways can the row be formed?
Show worked solution →

Choose the complement. Counting "not next to each other" directly is fiddly, so count the arrangements where PP and QQ ARE together and subtract from the total.

Count all arrangements. Five distinct people in a row give

5!=120.5! = 120.

Count the unwanted (together) by the block method. Glue PP and QQ into one block, leaving 44 items to arrange in 4!4! ways, with 2!2! internal orders:

4!×2!=24×2=48.4! \times 2! = 24 \times 2 = 48.

Subtract. The arrangements with PP and QQ apart are

120−48=72.120 - 48 = 72.

Answer. There are 7272 acceptable arrangements.

core3 marks
How many three-digit whole numbers (from 100100 to 999999) are even or divisible by 55?
Show worked solution →

Spot the overlap and reach for inclusion-exclusion. "Even" and "divisible by 55" can both hold at once (a number divisible by 1010), so the two cases overlap. Use ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B|.

Count the even three-digit numbers. From 100100 to 998998 inclusive, stepping by 22, there are

998−1002+1=450.\frac{998 - 100}{2} + 1 = 450.

Count those divisible by 55. From 100100 to 995995 inclusive, stepping by 55,

995−1005+1=180.\frac{995 - 100}{5} + 1 = 180.

Count the overlap (divisible by 1010). From 100100 to 990990 inclusive, stepping by 1010,

990−10010+1=90.\frac{990 - 100}{10} + 1 = 90.

Apply inclusion-exclusion.

450+180−90=540.450 + 180 - 90 = 540.

Answer. There are 540540 such numbers.

core2 marks
Seven different people stand in a row. In how many of the arrangements is a particular person, XX, standing somewhere to the left of another particular person, YY? (They need not be adjacent.)
Show worked solution →

Use the symmetry argument. In any arrangement either XX is left of YY or YY is left of XX, and reversing the roles pairs the two situations one-to-one. Neither is special, so exactly half of all arrangements have XX to the left of YY.

Count all arrangements. Seven distinct people in a row give

7!=5040.7! = 5040.

Halve.

7!2=50402=2520.\frac{7!}{2} = \frac{5040}{2} = 2520.

Answer. In 25202520 arrangements XX is somewhere to the left of YY.

exam4 marks
Eight different books, including a trilogy of three volumes, are arranged in a row. (i) In how many arrangements do the three trilogy volumes stand together (in any order)? (ii) In how many arrangements do they stand together and in the correct series order (volume 1, then 2, then 3)?
Show worked solution →

Part (i): glue the trilogy into a block. Treat the three volumes as one block, leaving 66 items (the block plus the other 55 books) to arrange.

Order the items, then inside the block. The 66 items go in 6!6! ways and the block has 3!3! internal orders:

6!×3!=720×6=4320.6! \times 3! = 720 \times 6 = 4320.

Part (ii): fix the internal order. "Together and in series order" means the block is still 11 item, but now its three volumes have only 11 acceptable internal order instead of 3!3!:

6!×1=720.6! \times 1 = 720.

Sanity check. Of the 3!=63! = 6 internal orders, exactly 11 is the correct series order, so part (ii) should be 16\tfrac{1}{6} of part (i): 16×4320=720\tfrac{1}{6} \times 4320 = 720, which agrees.

Answer. (i) 43204320; (ii) 720720.

exam4 marks
A five-digit string is formed from the digits 00 to 99 with repetition allowed (a leading 00 is permitted, so any of 0000000000 to 9999999999 may occur). How many such strings contain at least one 33 or at least one 77 (or both)?
Show worked solution →

Read it as a union of two 'at least one' conditions. Let AA be the strings with at least one 33 and BB those with at least one 77; the question asks for ∣A∪B∣|A \cup B|. The cleanest route is the complement of the union.

Count the total. Five positions, each any of 1010 digits:

105=100 000.10^5 = 100\,000.

Count the strings in neither set (no 33 and no 77). Each position avoids both 33 and 77, leaving 88 digits:

85=32 768.8^5 = 32\,768.

Subtract: at least one 33 or one 77 is everything except neither.

100 000−32 768=67 232.100\,000 - 32\,768 = 67\,232.

Confirm with inclusion-exclusion. ∣A∣=105−95=40 951|A| = 10^5 - 9^5 = 40\,951 and ∣B∣=40 951|B| = 40\,951. The overlap, at least one 33 AND at least one 77, is ∣A∩B∣=105−2(95)+85=14 670|A \cap B| = 10^5 - 2(9^5) + 8^5 = 14\,670. Then ∣A∪B∣=40 951+40 951−14 670=67 232|A \cup B| = 40\,951 + 40\,951 - 14\,670 = 67\,232, the same value.

Answer. 67 23267\,232 strings.

Practise this

Sources & how we know this

ExamExplained