Worked Examples

Three-Digit Codes

Three-Digit Codes
easy

A code contains three digits. Its first digit cannot be zero, but repetition is allowed. How many codes are possible?

Solution

The first digit has 9 choices, while each remaining digit has 10:

\[ 9\cdot10\cdot10=900. \]

Codes Without Repeated Digits

Codes Without Repeated Digits
easy

How many four-digit codes begin with a nonzero digit and contain no repeated digit?

Solution

The first digit has 9 choices. The second also has 9 choices: one digit has been used, but zero is now available. The last two digits have 8 and 7 choices.

\[ 9\cdot9\cdot8\cdot7=4536. \]

Exactly One Digit

Exactly One Digit
medium

A password has three characters. Each character is an uppercase English letter or a digit. How many passwords contain exactly one digit?

Solution

Split the possibilities according to the position of the digit:

\[ \begin{aligned} \text{digit first:} &&10\cdot26\cdot26,\\ \text{digit second:} &&26\cdot10\cdot26,\\ \text{digit third:} &&26\cdot26\cdot10. \end{aligned} \]

The cases do not overlap, so the answer is

\[ 3\cdot10\cdot26^2=20280. \]

Different Adjacent Colours

Different Adjacent Colours
medium

A flag has four horizontal stripes. Each stripe is red, green, or blue, and adjacent stripes must have different colours. How many flags are possible?

Solution

The first stripe has 3 choices. Each later stripe can use either of the two colours different from the stripe before it.

\[ 3\cdot2\cdot2\cdot2=24. \]

Exactly Two Equal Symbols

Exactly Two Equal Symbols
medium

A three-character string uses the symbols A, B, C, and D. How many strings have exactly two equal characters?

Solution

Choose the position of the different character in 3 ways. Choose the repeated symbol in 4 ways, then choose a different symbol for the remaining position in 3 ways.

\[ 3\cdot4\cdot3=36. \]

A Constrained PIN

A Constrained PIN
hard

A four-digit PIN contains exactly one zero and exactly one other even digit. No digit is repeated. How many such PINs exist?

Solution

Choose the position of zero in 4 ways. Choose the other even digit from \(2,4,6,8\) in 4 ways, then choose its position in 3 ways. Fill the remaining positions with two different odd digits in \(5\cdot4\) ways.

\[ 4\cdot4\cdot3\cdot5\cdot4=960. \]

Circular Colouring

Circular Colouring
hard

Four labelled seats are arranged around a circular table. Each seat is coloured red, green, or blue. Adjacent seats must have different colours. How many valid colourings are there?

Four labelled seats around a circular table 12 34
Solution

Choose colours for the first two seats in \(3\cdot2\) ways. Now consider the third seat:

  • If it has the same colour as the first seat, there is 1 choice for it and 2 choices for the fourth seat.
  • If it differs from both previous colours, there is 1 choice for it and the fourth seat is forced.

For every choice of the first two colours, the remaining seats can therefore be coloured in

\[ 1\cdot2+1\cdot1=3 \]

ways. The answer is

\[ 3\cdot2\cdot3=18. \]