Maths4UBETA

Distinct objects, factorials and position restrictions

Choose an ordered sample space, then handle leading zeroes, blocks, distances and relative order without double-counting.

Try the quick check →
Lesson 1 of 5

Section 1 of 5 · Core · about 6 min

When should I multiply, and when should I add?

First define one complete outcome. For a row, code or set of different roles, changing the order usually changes the outcome. Label the positions so each finished arrangement is counted exactly once.

If there are aa choices for the first step and exactly bb permitted continuations after each first choice, the count is abab. The actual available objects may change; the number of continuations must be the stated one. If that number differs between first choices, split into cases.

Worked example

Multiply within a case, then add the cases

A code has one letter from A, B, C followed by one digit from 1,2,3,41,2,3,4. The code C4 is forbidden. How many codes remain?

  1. If the first letter is A or B, all four digits are allowed: 2⋅4=82\cdot4=8 codes.

  2. If the letter is C, only three digits are allowed: 1⋅3=31\cdot3=3 codes.

  3. 8+3=11.8+3=11.

    The cases are disjoint and cover every permitted first letter. As a check, the unrestricted 3⋅4=123\cdot4=12 codes lose exactly one forbidden code.

Your turn

A code contains one letter followed by one digit. If the letter is X or Y, the digit may be 1,21,2 or 33. If the letter is Z, the digit may be 22 or 44. How many codes are possible?

Enter an exact number, for example 3/2 or 2-sqrt(3).

Section 2 of 5 · Core · about 8 min

When do I use a factorial or a partial permutation?

For a nonnegative integer nn, the number of arrangements of nn distinct objects in a full linear row is n!n!. For n≥1n\ge1,

n!=n(n−1)(n−2)⋯2⋅1.n!=n(n-1)(n-2)\cdots2\cdot1.

Also 0!=10!=1: there is one way to leave zero positions empty. Swapping distinct objects creates a different arrangement; reversing a row does not identify it with the original row.

To fill only rr labelled positions from nn distinct objects without reuse, stop after rr choices:

nPr=n!(n−r)!=n(n−1)⋯(n−r+1),0≤r≤n.{}^{n}\mathrm{P}_{r}=\frac{n!}{(n-r)!}=n(n-1)\cdots(n-r+1),\qquad0\le r\le n.

Here n,rn,r are integers; when r=0r=0, the product is empty and equals one. If r>nr>n, the requested arrangement is impossible, with count zero; do not substitute into a negative factorial.

If one specified object must appear among the rr positions, choose its position first, then fill the others:

r⋅n−1Pr−1,1≤r≤n.r\cdot{}^{n-1}\mathrm{P}_{r-1},\qquad1\le r\le n.

This assumes its position is otherwise unrestricted and all objects are distinct. With zero positions, requiring an object makes the count zero.

Worked example

Use factorials for a full row and permutations for a shorter row

Seven distinct cards A–G are available. Count the ways to arrange all seven in a row, and the ways to fill three labelled display positions without reuse. How many of those three-position displays contain A?

  1. For the full row, the choices decrease from seven to one:

    7!=7⋅6⋅5⋅4⋅3⋅2⋅1=5040.7!=7\cdot6\cdot5\cdot4\cdot3\cdot2\cdot1=5040.
  2. For three positions, make only three choices:

    7P3=7⋅6⋅5=210.{}^{7}\mathrm{P}_{3}=7\cdot6\cdot5=210.
  3. The factorial form cancels the unused part of the product:

    7!(7−3)!=7⋅6⋅5⋅4!4!=210.\frac{7!}{(7-3)!}=\frac{7\cdot6\cdot5\cdot4!}{4!}=210.
  4. If A is required, choose its position, then fill the other two positions from the six remaining cards:

    3⋅6P2=3⋅6⋅5=90.3\cdot{}^{6}\mathrm{P}_{2}=3\cdot6\cdot5=90.
  5. Do not divide by 3!3!: ABC and BAC are different displays. The four unchosen cards are not arranged anywhere.

If reuse is allowed and each of rr positions can contain any of n≥1n\ge1 symbols, there are nrn^r strings. State the repetition rule first. Distinct labelled roles also have an order: choosing a chair and a secretary is different from selecting an unordered pair.

Your turn

Six distinct badges are available, including a badge labelled A. Count four-position displays without reuse, first without any further restriction and then requiring badge A. Also state how many arrangements fill zero positions and how many fill seven positions without reuse.

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Section 3 of 5 · Core · about 14 min

How do I handle positions, separation and relative order?

Place named objects with fixed positions first. If kk different objects occupy kk distinct prescribed positions and no other restrictions remain, arrange the other n−kn-k objects in (n−k)!(n-k)! ways. Conflicting instructions, such as two different objects both occupying one position, give zero arrangements.

For forbidden positions, count permitted cases directly or subtract forbidden arrangements from the unrestricted total. If two forbidden cases overlap, subtracting both removes the overlap twice; restore it once. Check whether a named object has a specific end or may occupy either end.

Place five distinct cards AA, BB, CC, DD, EE in a row. Require AA not first and BB not last.

Forbidden positions

Excluded caseCompletions
A is first4!=244!=24
B is last4!=244!=24
Both3!=63!=6

Subtract both forbidden groups, then restore the overlap. 5!−24−24+6=785!-24-24+6=78.

As a check, split the allowed rows into BB first and BB in a middle position. 4!+3×3×3!=24+54=784!+3\times3\times3!=24+54=78.

With A not first and B not last, separate B first from B in a middle position. The two cases have different continuation counts.

Worked example

Fix positions and separate forbidden-position cases

Arrange five distinct cards A, B, C, D and E in a row. (a) Count arrangements with A third and B at either end. (b) In a separate problem, count arrangements with A not first and B not last.

  1. (a) A has one fixed position. Choose either end for B, then arrange the other three cards:

    2⋅3!=12.2\cdot3!=12.

    “B at either end” allows two choices; “B last” would allow only one.

  2. (b) If B is first, A is automatically not first. The remaining four cards have 4!=244!=24 arrangements.

  3. If B is not first or last, it occupies one of three middle positions. A then has three available positions other than first. The remaining cards have 3!3! arrangements:

    3⋅3⋅3!=54.3\cdot3\cdot3!=54.
  4. 24+54=78.24+54=78.

    These B-position cases are disjoint. A second method checks the answer:

    5!−4!−4!+3!=120−24−24+6=78.5!-4!-4!+3!=120-24-24+6=78.

    Subtract the cases with A first and those with B last, then add back their overlap because it was subtracted twice.

Your turn

Four distinct cards P, Q, R and S are arranged in a row. First count arrangements with P not first and Q not last. In a separate arrangement problem, fix P in the second position and Q in the last position; count the possibilities.

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Exact separation: if exactly gg objects lie between two named objects, their positions differ by g+1g+1. In an otherwise unrestricted row of n≥2n\ge2 distinct objects, there are n−g−1n-g-1 choices for the left position, two orientations of the named objects, then (n−2)!(n-2)! arrangements of the rest:

2(n−g−1)(n−2)!,0≤g≤n−2.2(n-g-1)(n-2)!,\qquad0\le g\le n-2.

The counts are integers. An impossible gap gives zero; if the order of the two named objects is also fixed, omit the factor two.

Relative order: for kk named objects in an unrestricted full row, one specified relative order occurs in n!k!\frac{n!}{k!} arrangements, for integers 1≤k≤n1\le k\le n. With other restrictions, this division is justified only if swapping those kk labels preserves all the restrictions.

Worked example

Count an exact gap and a specified relative order

Six distinct cards A–F are arranged in a row. (a) How many arrangements have exactly two cards between A and B? (b) In a separate problem with no other restrictions, how many arrangements have A before B and B before C?

  1. (a) The positions of A and B differ by three. The left and right position pairs are (1,4),(2,5),(3,6)(1,4),(2,5),(3,6). Each permits AB or BA, while the other four cards can be arranged freely:

    3⋅2⋅4!=144.3\cdot2\cdot4!=144.
  2. (b) A, B and C have 3!=63!=6 possible relative orders. Relabelling these three cards takes any one order to any other without breaking a condition, so all six orders occur equally often.

    6!3!=120.\frac{6!}{3!}=120.
  3. The second condition fixes only relative order, not positions or adjacency. Do not apply the division by 3!3! if another restriction treats A, B and C differently.

Your turn

Four distinct cards P, Q, R and S are arranged in a row. In one problem, exactly one card must lie between P and Q. In a separate problem, P must occur before Q and Q before R, with no other restriction. Count each set of arrangements.

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Block preview: if kk named distinct objects must be consecutive, with no other restriction, treat them as one unit. Arrange the n−k+1n-k+1 units and then the objects inside the block:

(n−k+1)! k!,1≤k≤n.(n-k+1)!\,k!,\qquad1\le k\le n.

If their internal order is fixed, that block has one internal arrangement instead. The next topic develops blocks, repeated symbols and methods for keeping objects apart.

Section 4 of 5 · Core · about 8 min

Why do digit questions need separate cases?

A number with a stated number of digits cannot begin with zero. A code may begin with zero only if its rules allow it. Check separately whether digits may repeat.

Fill a restrictive position first when that simplifies the remaining choices. An even number ends in 0,2,4,60,2,4,6 or 88; a multiple of five ends in 00 or 55, using only available digits. Without repetition, choosing zero at the end removes no nonzero first-digit option; choosing another even digit does. Split these cases before multiplying.

If the first digit must also lie in a restricted set, check whether each chosen final digit belongs to that set. Only then does it remove a possible first choice.

Choose the units digit of a four-digit even number formed from 0,…,60,\ldots,6 with no repeated digits.

Choice counts by position

Units digitThousandsHundredsTensTotal
006655441×6×5×4=1201\times6\times5\times4=120
2,4,62,4,65555443×5×5×4=3003\times5\times5\times4=300

In the second case the leading digit must avoid both zero and the chosen units digit. 120+300=420120+300=420.

The last digit controls how many nonzero first digits remain. The middle positions are filled after both end digits have been chosen.

Worked example

Split the final digit into zero and nonzero cases

How many four-digit even numbers can be formed from 0,1,2,3,4,5,60,1,2,3,4,5,6 without repeated digits? How many are possible if repetition is allowed instead?

  1. Without repetition, the final digit is 0,2,40,2,4 or 66. Ending in zero leaves all six nonzero digits available for the first position. The two middle positions then have five and four choices:

    1⋅6⋅5⋅4=120.1\cdot6\cdot5\cdot4=120.
  2. Ending in 2,42,4 or 66 uses a nonzero digit. For each of these three endings, only five nonzero first digits remain. The middle positions still have five and four choices:

    3⋅5⋅5⋅4=300.3\cdot5\cdot5\cdot4=300.
  3. 120+300=420.120+300=420.

    The last-digit cases cannot overlap, and every even ending has been included.

  4. With repetition allowed, the first position has six nonzero choices, each middle position has seven choices, and the last has four even choices:

    6⋅7⋅7⋅4=1176.6\cdot7\cdot7\cdot4=1176.

    Repeated digits are permitted in this second experiment; it is not a permutation of distinct cards.

Your turn

Use digits 0,1,2,3,40,1,2,3,4 to form three-digit odd numbers. Find the number possible without repeated digits, then the number possible if repetition is allowed.

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Section 5 of 5 · Core · about 9 min

How do counts give probabilities or recover an unknown size?

A counting ratio gives a probability when the complete outcomes in its denominator are equally likely:

P(E)=number of permitted outcomes in Enumber of outcomes in the sample space.P(E)=\frac{\text{number of permitted outcomes in }E}{\text{number of outcomes in the sample space}}.

If a condition FF is given, restrict both counts to that same condition:

P(E∣F)=#(E∩F)#F,#F>0.P(E\mid F)=\frac{\#(E\cap F)}{\#F},\qquad\#F>0.

Here #\# means “number of”. A sequential procedure that chooses among currently available options need not make all valid final arrangements equally likely when different choices have different numbers of completions. Use the sampling rule stated in the question.

Worked example

Change the denominator when a condition is given

The five distinct cards A–E are arranged uniformly at random in a row. Find the probability that A is not first and B is not last. Then find the probability that A is not first given that B is not last.

  1. All 5!=1205!=120 arrangements are equally likely. The arrangements meeting both restrictions number

    5!−4!−4!+3!=78.5!-4!-4!+3!=78.
  2. P(A not first and B not last)=78120=1320.P(\text{A not first and B not last})=\frac{78}{120}=\frac{13}{20}.
  3. Given B is not last, restrict the equally likely sample space to

    5!−4!=965!-4!=96

    arrangements. Of these, the same 7878 also have A not first.

  4. P(A not first∣B not last)=7896=1316.P(\text{A not first}\mid\text{B not last})=\frac{78}{96}=\frac{13}{16}.

For an unknown number of objects, translate the verbal count into products or factorials, state the integer range, then solve. Cancel only factors known to be nonzero. Recheck the original count and every restriction; never round a noninteger solution into a possible stock.

Worked example

Recover the number of distinct objects

There are n≥3n\ge3 distinct objects. The number of ordered arrangements of three objects without reuse is four times the number of ordered arrangements of two objects. Find nn.

  1. Translate the stated counts into descending products:

    nP3=4⋅nP2⟹n(n−1)(n−2)=4n(n−1).{}^{n}\mathrm{P}_{3}=4\cdot{}^{n}\mathrm{P}_{2}\quad\Longrightarrow\quad n(n-1)(n-2)=4n(n-1).
  2. Because n≥3n\ge3, the factor n(n−1)n(n-1) is positive and may be cancelled:

    n−2=4⟹n=6.n-2=4\quad\Longrightarrow\quad n=6.
  3. The answer is an allowed integer. Check the original counts:

    6P3=120,6P2=30,120=4⋅30.{}^{6}\mathrm{P}_{3}=120,\qquad{}^{6}\mathrm{P}_{2}=30,\qquad120=4\cdot30.

Your turn

Six distinct cards P, Q, R, S, T and U are arranged uniformly at random in a row. Given that Q is not last, find the probability that P is first. Enter the count of arrangements satisfying the condition, the count also having P first, and the conditional probability.

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact value or round to 3 significant figures.

Explore the five-card example below. Turn either forbidden-position rule on or off, inspect the valid labelled rows, and compare the count with all 120120 equally likely arrangements.

Worked examples

Practise the method

Core practice

Question 1 of 4

0 / 4 checked in this collection

Question list

Core practice

Fresh variants

Exam-style

An ordered programme and a selected set

3 marks

Choose 3 of 6 different items. Find the number of ordered programmes, the number of unordered selections, and the number of programmes per selection.

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Full answer-format guide

Exact numbers: 3/2, sqrt(5), 2-sqrt(3), pi/6, 3*pi/2. Sets: {1,4}. Intervals: (3,5]; a round bracket excludes the endpoint. Infinity: inf; union: U; no solutions: empty. Separate coordinate pairs or triples with semicolons. Expressions: 2x^2+3x-1; equations: x^2=3x+1 or the polynomial equal to zero. Factors: x-1 ; x+2. Parameter fraction: numerator ; denominator. List integer answers individually.

Review the method

Progress stays in this browser. Create an account to save it or sign in.

Extra practice from this lesson

A rule changes the number of continuations

A two-symbol code consists of one letter from A, B, C, D followed by one digit from 00 to 55. A cannot be followed by 00; B must be followed by an even digit, including 00. C and D may be followed by any of the six digits. Count all unrestricted codes and the valid codes. If a valid code is chosen uniformly, find the probability that its letter is A.

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact value or round to 3 significant figures.

A named talk in a partial programme

There are eight distinct talks, including X. A programme has five ordered places with no repeated talk. Count all programmes, programmes with X first, and programmes containing X anywhere. If all five-talk programmes are equally likely, find the probability that X is included.

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact value or round to 3 significant figures.

Fix the most restricted places first

Seven different people, including A and B, stand in a line. Count arrangements with A in an interior position, arrangements with A interior and B fourth, and arrangements with A interior and B at either end. Given a uniformly random arrangement with A interior, find the probability that B is at an end.

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact value or round to 3 significant figures.

Divisibility and zero need separate cases

Five-digit numbers are formed using digits 0,1,2,3,4,5,6,70,1,2,3,4,5,6,7 without repetition. Count those ending in zero, those ending in five, and all multiples of five. If a five-digit number from this set is chosen uniformly, find the probability it is a multiple of five. Finally count five-digit multiples of five from the same digits when repetition is allowed.

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact value or round to 3 significant figures.

Enter an exact number, for example 3/2 or 2-sqrt(3).

Distance, adjacency and relative order are different

Eight distinct cards include A, B and C. Count linear arrangements with exactly two cards between A and B, with A before B before C, and with A adjacent to B. In a uniformly random arrangement, given that A is before B, find the probability that exactly two cards lie between them.

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact value or round to 3 significant figures.

Select and arrange

From seven different posters choose three. Give the number of selections and the number of ordered displays.

Enter an exact number, for example 3/2 or 2-sqrt(3).

Enter an exact number, for example 3/2 or 2-sqrt(3).

Treat zero separately

Use distinct digits from {0,1,2,3,4}\{0,1,2,3,4\} to make a three-digit even integer. How many are possible?

Enter an exact number, for example 3/2 or 2-sqrt(3).

Join two neighbours

Six different pupils stand in a line. How many orders put Amira and Ben together?

Enter an exact number, for example 3/2 or 2-sqrt(3).

Fix a relative order

Six different books are put in a row. How many orders have the history book somewhere before the geography book?

Enter an exact number, for example 3/2 or 2-sqrt(3).

Apply it · original exam-style problems

Show your working on paper and compare it with the worked solution and marking guidance.

Start after this lesson

Reverse the conditioning event carefully 8 marks

A six-digit number is chosen uniformly from all six-digit numbers formed using 0,1,2,3,4,5,6,70,1,2,3,4,5,6,7 without repetition. Let O mean that the number is odd, and H mean that its first digit is greater than 33. Find the number of odd numbers and the number satisfying both O and H. Then find P(H∣O)P(H\mid O) and P(O∣H)P(O\mid H).

Hint

Count the first and last digits before the four middle places. For the joint event split the final digit into 1,31,3 and 5,75,7, because the latter use up an allowed first digit.

Worked solution
  1. There are four odd final digits. Each leaves six nonzero first choices and six remaining digits for four ordered middle positions:

    N(O)=4×6×6P4=8640.N(O)=4\times6\times{}^{6}P_4=8640.
  2. For O and H, a final 11 or 33 leaves four high first digits. A final 55 or 77 leaves only three:

    N(O∩H)=2×4×360+2×3×360=5040.N(O\cap H)=2\times4\times360+2\times3\times360=5040.
  3. P(H∣O)=50408640=712.P(H\mid O)=\frac{5040}{8640}=\frac{7}{12}.
  4. For H alone, choose the first digit from 4,5,6,74,5,6,7, then fill five ordered positions from seven remaining digits:

    N(H)=4⋅7P5=10080,P(O∣H)=504010080=12.N(H)=4\cdot{}^{7}P_5=10080,\qquad P(O\mid H)=\frac{5040}{10080}=\frac{1}{2}.

    The two conditional probabilities have different denominators.

Marking guidance
  • 1 mark: exclude a leading zero when counting odd numbers.
  • 1 mark: count the four ordered middle digits correctly.
  • 1 mark: split the joint event into the two disjoint final-digit cases.
  • 1 mark: count both cases with the correct first choices.
  • 1 mark: obtain the joint total.
  • 1 mark: calculate the first conditional with the odd-number denominator.
  • 1 mark: count the conditioning set H.
  • 1 mark: calculate the reversed conditional with its own denominator.
Recover the size and combine two restrictions 9 marks

There are nn distinct objects, including A, B and C, where n≥3n\ge3 is an integer. The number of full linear arrangements is 5656 times the number of full arrangements of a specified set of n−2n-2 of the objects. Find nn.

For this value of nn, count rows with A before B before C. Also count rows in which A is before B with exactly one object between them. Of these latter rows, how many additionally have C after B? Hence find the conditional probability that C is after B given that A is before B with exactly one object between them, for a uniformly random full row.

Hint

Expand only enough of n!n! to cancel (n−2)!(n-2)!. For the final joint count, let A occupy position jj; then B occupies j+2j+2, so the number of places available after B depends on jj.

Worked solution
  1. n!=56(n−2)!⟹n(n−1)=56.n!=56(n-2)!\quad\Longrightarrow\quad n(n-1)=56.

    The factorial being cancelled is positive on the stated domain.

    (n−8)(n+7)=0.(n-8)(n+7)=0.

    Only n=8n=8 is an integer in the allowed domain. Check: 8!=56(6!)8!=56(6!).

  2. In an unrestricted eight-object row, one of the six equally frequent relative orders of A, B and C is allowed:

    8!3!=6720.\frac{8!}{3!}=6720.
  3. For exactly one object between A and B with A first, choose A’s position jj from 11 to 66. B is then fixed at j+2j+2. The remaining six objects can be arranged freely:

    6(6!)=4320.6(6!)=4320.
  4. If C must also follow B, the available positions for C are 5,4,3,2,1,05,4,3,2,1,0 as jj runs from 11 to 66. After choosing C’s position, fill the remaining five places:

    (5+4+3+2+1+0)5!=15(120)=1800.(5+4+3+2+1+0)5!=15(120)=1800.
  5. P(C after B∣A before B with one between)=18004320=512.P(\text{C after B}\mid\text{A before B with one between})=\frac{1800}{4320}=\frac{5}{12}.

    The gap restriction breaks the simple three-object relative-order symmetry; count its permitted positions directly.

Marking guidance
  • 1 mark: form the factorial equation from the specified smaller set.
  • 1 mark: cancel a positive factorial and solve the quadratic.
  • 1 mark: retain and check the admissible size.
  • 1 mark: count the unrestricted relative-order event.
  • 1 mark: identify the six possible ordered position pairs for the gap.
  • 1 mark: obtain the gap count.
  • 1 mark: use the varying number of later positions for C.
  • 1 mark: sum disjoint cases and obtain the joint count.
  • 1 mark: divide by the correct conditional sample-space count.

Come back to what needs practice

Quick revision sheet (A4)

Your review plan starts after your first check.

Question bank and saved work