Probability & Combinatorics
Theory and questions for topic based enrichment activities/teaching
Compiled by www.drfrostmaths.com
Contents
Prerequisites ................................................................................................................................................................................................................ 2
Questions ..................................................................................................................................................................................................................... 3
Introductory ............................................................................................................................................................................................................. 3
General Questions ................................................................................................................................................................................................... 4
Senior Maths Challenge ........................................................................................................................................................................................... 7
British Maths Olympiad ........................................................................................................................................................................................... 9
Key Theory ................................................................................................................................................................................................................. 11
Advanced Theory ....................................................................................................................................................................................................... 16
Solutions..................................................................................................................................................................................................................... 19
Introductory ........................................................................................................................................................................................................... 19
General Questions ................................................................................................................................................................................................. 23
Senior Maths Challenge ......................................................................................................................................................................................... 47
British Maths Olympiad Solutions ......................................................................................................................................................................... 52
Making effective use of Wolfram Alpha .................................................................................................................................................................... 68
1
Prerequisites
None of the ‘warm up’ questions or any of the general questions on combinations/arrangements require any existing A Level (or even
GCSE) knowledge. The required theory can be found in the ‘Key Theory’ section.
A few of the general questions require prior knowledge of the following:
o Conditional probability: p(x|y)
o Knowing that the probability of two independent events can be found by multiplying their individual probabilities.
o The distinction between discrete and continuous probability distributions.
o Calculating the expected value E[X] of a random variable X, using the formula
for a discrete distribution, and
for a continuous distribution.
o The Binomial Distribution.
2
Questions
Introductory
(of which some are more difficult than others!)
1.
2.
3.
4.
5.
6.
How many ways are there of arranging eight different books on a shelf?
How many ways are there of arranging eight different books on a shelf, if you must keep the two red ones next to each other?
How many ways are there of arranging eight different books on a shelf, if you must keep the two red ones separate?
How many ways are there of arranging eight different books on a shelf, if you must keep the four red ones next to each other?
How many ways are there of arranging eight different books on a shelf, if you must keep the four red ones separate?
How many ways are there of arranging eight different books on a shelf, if you must keep the four red ones separate but in alphabetical
order by author?
7. How many ways are there of arranging fourteen different books on a shelf, if you must keep the five red ones separate?
8. How many ways are there of arranging the letters of the alphabet so that the vowels are not next to each other?
9. How many ways are there of arranging the letters of the alphabet so that the vowels are not next to each other but are in alphabetical
order?
10. How many ways are there of writing a five-letter word with no letters the same?
11. How many ways are there of writing a five-letter word with no adjacent letters the same?
12. How many ways are there of making a selection from a bowl containing an apple, an orange and a plum?
13. How many ways are there of making a selection from a bowl containing a lemon, a lime, a kumquat, a mango and a passion fruit?
14. How many ways are there of making a selection from a bowl containing three apples?
15. How many ways are there of making a selection from a bowl containing five apples and three oranges?
16. How many ways are there of making a selection from a bowl containing three pineapples, four melons and six mangoes?
17. How many ways are there of arranging three pineapples, four melons and six mangoes in a line?
3
General Questions
1. A frog has n lily pads in front of it in a line, and it needs to
reach the last lily pad. The frog can either hop to the lily pad
in front of it each time, or skip the lily pad in front and hop
to the one after it. How many ways F(n) are there of
reaching the nth lily pad? (in terms of possible sequences of
hops and skips)
2. Repeat the above problem if the frog can jump any number
of lily pads each time.
3. If there’s 49 different numbers in the lottery and you win
£10 for matching 3 numbers correctly out of 6, what is the
chance of winning £10?
4. How many ways are there of arranging the letters of HELLO
or BANANA?
5. How many ways are there of arranging n (indistinguishable)
plastic bags, if bags can be put inside each other or
alongside? (for example, for 3 bags, we could have them
individually, have one inside another and one individually,
and so on)
6. 8 people go to a cinema and sit in line. 3 of them are sisters
who want to sit together.
(a) How many ways are there of seating the 8 people?
(b) How many ways are there of seating the 8 people if the
sisters aren’t allowed to sit together?
7. Repeat the above problem if the 8 seats are arranged in a
circle.
8. An examiner invigilates an exam in which 1500 students are
applying for 150 places at a school. The examiner is
responsible for invigilating a room of 25 students. What is
the chance that all of them get a place?
9. Suppose that n balls are placed at random into n boxes. Find
the probability that there is exactly one empty box.
10. You are captured by insane mathematicians and forced to
play Russian Roulette. You are given a gun with n slots in the
barrel and 1 bullet, and shoot n times (rotating the barrel
between shots so the position of the bullet is random each
time). What’s the probability that you survive as n becomes
infinitely large?
11. a) Mary tosses two coins and John tosses one coin. What is
the probability that Mary gets strictly more heads than
John? Answer the same question if Mary tosses three coins
and John tosses two.
b) Make a conjecture for the corresponding probability
when Mary tosses n + 1 coins and John tosses n. Now prove
your conjecture.
c) If John tosses n coins and Mary also tosses n coins, what’s
the probability that John gets strictly more heads than
Mary? You may find the identity
useful.
12. Parliament contains a proportion p of Conservative
members, who are incapable of changing their minds about
anything, and a proportion 1 − p of Labour members, who
change their minds completely at random, with probability
r, between successive votes on the same issue. A randomly
chosen member is observed to have voted twice in
4
succession in the same way. What is the probability that this
member will vote in the same way next time?
13. How many distinct ways are there of colouring the sides of a
cube using 6 colours? Cubes that can be rotated to look the
same as each other are not counted as distinct.
14. Given 23 people in the room, what’s the probability that at
least two of them share a birthday? (you can assume there
are 365 days in a year)
15. If you throw 6 die, what is the probability of getting a 1, 2, 3,
4, 5 and 6? (the ordering does not matter)
16. If you throw 6 die, what is the probability of getting a run of
exactly four? e.g. 1, 2, 3, 4 or 2, 3, 4, 5, etc. (again, the
ordering does not matter)
17. I have two identical packs of cards. I take each pack and
shuffle it separately, placing them both face down in the
table. I then proceed to play a game of snap with myself.
(Being a mathematician I have no friends.) I compare the
top card from each pile, and then compare the second card
from each pile, ... and so on. What is the probability that I
continue in this way all the way down the piles, and never
find an exact match in the 52 pairs of cards?
18. What’s the difference expected if 2 people each think of a
real number in the range 0 to 100?
19. a) How many ways are there of pairing 2n people at a party?
b) Suppose Bob arrives late to the party. Suppose everyone
is repaired (inevitably leaving one person alone!). How
many possible pairings are there now?
20. In an experiment to investigate animal behaviour rats have
to make a choice between 4 doors of different colours. If
they make the right choice they find food; if they make the
wrong choice they get an electric shock. If an incorrect
choice is made, the animal returns to its starting point and
tries again, and this continues until a correct choice is made.
If p(x) is the probability that a correct choice is made at the
xth attempt, find p(x) if
i. each door is equally likely to be chosen at each trial, and
all trials are mutually independent;
ii. at each trial the rat chooses with equal probability
between the doors which have not been tried
previously, no choice ever being repeated;
iii. the rat never chooses the same door on two successive
trials, but otherwise chooses at random.
Which strategy would be the best one for the rat to adopt?
21. How could you simulate the throw of a fair die using a fair
coin?
22. How could you simulate the throw of a fair coin using an
unfair coin? (i.e. with some fixed probability of heads not
equal to 0.5)
23. A decimal between 0 and 1 can be represented in binary by
using the kth digit after the decimal point to represent
whether (1/2)k appears when we express the number as a
sum of powers of 1/2. So 0.101 for example represents 1/2
+ 1/8. Using this fact, find a way in which we could use a fair
coin to model an unfair coin with any given probability p of
heads.
24. 2n objects of each of three kinds are given to two persons,
so that each person gets 3n objects. Show that this can be
done in 3n2 + 3n + 1 ways.
5
25. How many sets of 3 numbers each can be formed from the
numbers {1, 2, 3, …, 20} if no two consecutive numbers are
to be in a set?
26. How many orderings are there for a deck of 52 cards if all
the cards of the same suit are together?
27. You start at the point (0,0) and want to move to the point
(n,n). At each step you can move 1 unit right or up only.
How many ways are there of getting to the destination? (b)
Since we know that all paths must cross one (and only one)
point on the diagonal line between (0,n) and (n,0), show
that the identity
holds.
28. How many squares (of any size) are there in a grid of (n x n)
squares?
29. How many rectangles (of any size) are there in a grid of
(n x n) squares?
30. How many triangles (of any size) are in the pictured shape,
when there are n triangles at the base of the big
triangle?
n=3
31. How many ways are there of arranging:
a. How many ways are there of arranging n distinct
beads on a bracelet with a capacity of k beads
(where k n and k > 2)?
b. 4 red (indistinguishable) beads and 4 yellow beads
on a bracelet.
c. 5 red beads and 5 yellow beads on a bracelet.
6
Senior Maths Challenge
Level 2
1. The engineering company, Sparks and Tensor, has a
complicated system of conveyor belts in its factory.
Components must travel along these belts in the directions
shown by the arrows.
A
D
B
E
C
F
How many different routes are there from A to F along the
conveyor belts?
A
4
B
5
C
6
D
7
E
8
2. How many numbers from 12 to 12345 inclusive have digits
which are consecutive and in increasing order, reading from
left to right?
A
10
B
13
C
18
D
22
E
25
Level 3
1. The cards in a set of 36 are numbered 1 to 36. The cards are
shuffled and four cards are dealt.
What are the chances of them being dealt in descending
order?
A
1 in 2 B 1 in 8
C
1 in 16
D 1 in 24
E
1 in 36
Level 4
1. In how many different ways can I circle letters in the grid
shown so that there is exactly one circled letter in each row
and exactly one circled letter in each column?
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
A
D
15
100
B
E
24
120
C
60
2. A hockey team consists of 1 goalkeeper, 4 defenders, 4
midfielders and 2 forwards. There are 4 substitutes: 1
goalkeeper, 1 defender, 1 midfielder and 1 forward. A
substitute may only replace a player of the same category
eg: midfielder for midfielder.
Given that a maximum of 3 substitutes may be used and
that there are still 11 players on the pitch at the end, how
many different teams could finish the game?
A
110 B
118 C
121
D
125 E
132
7
3. The diagram shows five discs connected by five line
segments. Three colours are available to colour these discs.
In how many different ways is it possible to colour all five
discs if discs which are connected by a line segment are to
have different colours?
A
D
6
36
B
E
12
48
C
30
4. The year 1789 (when the French Revolution started) has
three and no more than three adjacent digits (7, 8 and 9)
which are consecutive integers in increasing order.
How many years between 1000 and 9999 have this
property?
A
130 B
142 C
151
D
169 E
180
Level 5
1. A postman's sack contains five letters, one each for the five
houses in Cayley Close.
Mischievously, he posts one letter through each door
without looking to see if it is the
correct address.
In how many different ways could he do this so that exactly
two of the five houses receive the correct letters?
A
5
B
10
C
20
D
30
E
60
2. Given an unlimited supply of 50p, £1 and £2 coins, in how
many different ways is it
possible to make a sum of £100?
A
1326 B
2500 C
2601 D
5050 E
10 000
3. A bracelet is to be made by threading four identical red
beads and four identical yellow beads onto a hoop.
How many different bracelets can be made?
A
4
B
8
C
12
D
18
E
24
8
British Maths Olympiad
1. Isaac has a large supply of counters, and places one in each
of the 1 x 1 squares of an 8 x 8 chessboard. Each counter is
either red, white or blue. A particular pattern of coloured
counters is called an arrangement. Determine whether
there are more arrangements which contain an even
number of red counters or more arrangements which
contain an odd number of red counters. Note that 0 is an
even number.
2. Consider a standard 8 x 8 chessboard consisting of 64 small
squares coloured in the usual pattern, so 32 are black and
32 are white. A zig-zag path across the board is a collection
of eight white squares, one in each row, which meet at their
corners. How many zig-zag paths are there.
3. The number 916238457 is an example of a nine-digit
number which contains each of the digits 1 to 9 exactly
once. It also has the property that the digits 1 to 5 occur in
their natural order, while the digits 1 to 6 do not. How many
such numbers are there?
4. The seven dwarfs walk to work each morning in single file.
As they go, they sing their famous song, “High - low - high low, it’s off to work we go . . . ”. Each day they line up so
that no three successive dwarfs are either increasing or
decreasing in height. Thus, the line-up must go up-down-updown- · · · or down-up-down-up- · · · . If they all have
different heights, for how many days they go to work like
this if they insist on using a different order each day? What
if Snow White always came along too?
5. (a) Determine, with careful explanation, how many ways 2n
people can be paired off to form n teams of 2.
(b) Prove that {(mn)!}2 is divisible by (m!)n+1(n!)m+1 for all
positive integers m, n.
6. The Dwarfs in the Land-under-the-Mountain have just
adopted a completely decimal currency system based on
the Pippin, with gold coins to the value of 1 Pippin, 10
Pippins, 100 Pippins and 1000 Pippins. In how many ways is
it possible for a Dwarf to pay, in exact coinage, a bill of 1997
Pippins?
7. A booking office at a railway station sells tickets to 200
destinations. One day, tickets were issued to 3800
passengers. Show that (i) there are (at least) 6 destinations
at which the passenger arrival numbers are the same; (ii)
the statement in (i) becomes false if ‘6’ is replaced by ‘7’.
8. The seven dwarfs decide to form four teams to compete in
the Millennium Quiz. Of course, the sizes of the teams will
not all be equal. For instance, one team might consist of Doc
alone, one of Dopey alone, one of Sleepy, Happy & Grumpy,
and one of Bashful & Sneezy. In how many ways can the
four teams be made up? (The order of the teams or of the
dwarfs within the teams does not matter, but each dwarf
must be in exactly one of the teams.) Suppose Snow-White
agreed to take part as well. In how many ways could the
four teams then be formed?
9
9. Twelve people are seated around a circular table. In how
many ways can six pairs of people engage in handshakes so
that no arms cross? (Nobody is allowed to shake hands with
more than one person at once.)
10. A set of positive integers is defined to be wicked if it
contains no three consecutive integers. We count the empty
set, which contains no elements at all, as a wicked set. Find
the number of wicked subsets of the set {1, 2, 3, 4, 5, 6, 7, 8,
9, 10}.
11. Adrian teaches a class of six pairs of twins. He wishes to set
up teams for a quiz, but wants to avoid putting any pair of
twins into the same team. Subject to this condition: i) In
how many ways can he split them into two teams of six? ii)
In how many ways can he split them into three teams of
four?
12. In the land of Hexagonia, the six cities are connected by a
rail network such that there is a direct rail line connecting
each pair of cities. On Sundays, some lines may be closed for
repair. The passengers’ rail charter stipulates that any city
must be accessible by rail from any other (not necessarily
directly) at all times. In how many different ways can some
of the lines be closed subject to this condition?
13. Isaac attempts all six questions on an Olympiad paper in
order. Each question is marked on a scale from 0 to 10. He
never scores more in a later question than in any earlier
question. How many different possible sequences of six
marks can he achieve?
14. A bridge deal is defined as the distribution of 52 playing
cards among 4 players, so each player gets 13 cards each. In
a bridge deal, what is the probability that exactly one player
has a complete suit?
10
Key Theory
Key term: Combinatorics
The number of ways of arranging n items.
Key term: Factorial, n!
The number of ways of filling k slots,
where each item can be one of n items.
The number of ways of putting n items
into r slots (where r n)
The number of ways of choosing r items
from n (where the order doesn’t matter)
nCr (n “choose” r) or
Explanation
‘Enumerative combinatorics’ is counting the number of arrangements of some structure, whether it be the
number of possible lottery combinations, the number of seating arrangements, etc. Combinatorics is used
extensively in probability (e.g. the probability of getting 1, 2, 3, 4, 5, 6 in a game of Yahtzee), algebra (in
Binomial expansion for example) amongst many other fields.
Suppose we were arranging 5 items in a line, and were interested in the number of possible configurations.
There’s 5 empty slots to put each of the items in. In the first slot, we could choose any of the 5 items. For the
next slot, we have 4 items to choose, and so on. We end up with 5 x 4 x 3 x 2 x 1 combinations.
We can represent this using 5! (known as 5 “factorial”). In general n! = n x (n-1) x ... x 2 x 1
Some laws of factorials you should definitely learn:
0! = 1
1! = 1
(n+1)n! = (n+1)!
Suppose we threw 4 die and put them in a line. How many combinations are there? There’s 6 possibilities for
the first die, 6 for the second, and so on, giving us 64 possibilities.
In general, for k ‘slots’ for which we can put n items in each, where we’re allowed duplicates (i.e. the same
number can appear in multiple slots), there’s nk combinations.
Suppose we have 6 items but now only 2 slots. Then there’s 6 items to choose for the first slot, and 5 for the
second, yielding 6 x 5 combinations. This is the same as 6! / 4!, and in general there’s n! / (n-r)! Combinations.
On a calculator, we can evaluate this using the “nPr” button, where the P stands for ‘permutation’.
Suppose there’s 6 items and 4 slots. We know from above there’s 6! / 2! ways of putting items into these
slots. But now let’s say we’re not interested in the ordering of these items, i.e. we’re effectively interested in
the number of ways of ‘choosing’ a set of 4 items from 6. For each ordered list of items we can get, 4! of these
are equivalent. For example, if the 6 items are A, B, C, D, E and F, and we have <A, C, D, F> in a line, then <C,
A, D, F> is equivalent to this (since we’re unconcerned with order), as is <D, C, F, A>, etc. We know there’s 4!
ways of arranging the 4 items. We therefore divide the number of combinations by 4! to cater for this
duplication, giving a final result of 6! / (2! x 4!).
In general, the number of ways of choosing r items from n items is n! / (r! x (n-r)!). On a calculator we can use
11
the button nCr (said “n choose r”) but the formal mathematical notation is
, known as a Binomial
Coefficient. Make sure you remember the formula for this, because we can often simplify the factorials when
we multiply it together with other expressions.
This allows us for example to calculate the probability of winning the lottery. There’s
ways of choosing 6
numbers from 49 (given the order of the numbers doesn’t matter), and only 1 set of unordered numbers can
Contrasting these 4 combinatory
operations.
match the winning numbers, so there’s a 1 in
chance of winning.
Some binomials to remember of-by-heart:
,
,
,
,
We’ve seen 4 formulae for calculating the number of combinations for some setup. Let’s compare and
contrast them:
For the nk formulae, where we’re filling n slots with k items, items can be duplicated. The order in
which the items occur is also significant, so for example, rolling 1-3-2-4 with a die is distinctive from 13-2-4.
The n! and nPk allowed us to arrange a number of items, the second one a more general form of the
first allowing us to pick and arrange k items from the n, rather than arranging all of them as in n!. In
this case, the order of the items does matter, but unlike the nk case, we don’t allow duplicates.
Distinguishable vs indistinguishable
objects
is similar to nPk, except that now the ordering doesn’t matter. It therefore represents the number
of ways of choosing k items from n rather than arranging them.
In combinatorics, objects come in two flavours.
Distinguishable objects are ones where we can establish their individual identity.
Indistinguishable objects conversely are ones where the arrangements of similar objects are ignored
because the objects are for all intensive purposes assumed to be identical.
Consider for example the number of ways of arranging 3 blue and 5 red balls in a line. If the balls are
distinguishable, then we can tell which of the blue balls is which. They’ll simply be 8! arrangements.
If we blue balls are indistinguishable however (as with the red balls), then there’s 8! / 3!5! arrangements
(there’s an explanation for this in the solutions for questions such as ‘arrangements of the letters in
HELLO/BANANA’).
Problems involving distinguishable objects tend to be easier to solve, and involve far more arrangements. And
often we have to discern ourselves whether objects are distinguishable and indistinguishable unless it’s
explicitly stated.
12
Ordered vs unordered
Whenever problems involve arrangements of objects ‘in a line’, or ‘in a circle’ or similar, the objects are
clearly ordered. In other problems, the ordering of the items does not matter. The lottery is a clear example
of this, as the ordering of the balls does not matter when considering winning tickets.
Sometimes there multiple ways of tackling a problem, whether we consider only unordered sequences, or use
an ordered sequence and account for all orderings such that the ordering doesn’t matter.
Let’s go back to the lottery example, where we’re finding the probability of getting all 6 numbers.
We could just consider the size of the sample space to be all unordered sequences, which is
only 1 unordered sequence for which our winning ticket could match, so there’s a 1 /
. There’s
chance.
But we could have instead considered ordered sequences. There’s 49P3 = 49! / 43! combinations of lottery
numbers when we consider the order in which the numbers appear from the machine. Then for a winning
ticket, there’s 6! ways of arranging the numbers that all still result in a win (because we know the order of our
numbers doesn’t matter in terms of winning). So the probability this time can be expressed as 6! / 49P3. When
we simplify, this works out to be exactly the same probability.
Calculating a probability by considering
the total number of outcomes and the
outcomes of interest
In this particular example, the first method is cleaner and preferable. But there are circumstances, particular
when we have a mixture of ordered and unordered objects, or distinguishable and indistinguishable (since
objects being indistinguishable in a line imply their order doesn’t matter), that we’d have to use something
akin to the second method. This will become clearer when you’ve attempted many combinatoric problems.
There are sometimes multiple ways of approaching problems that require calculating of a probability.
Sometimes we might be considered the probability of each individual independent event and multiply them
together. But sometimes it might be much easier to consider the number of possible outcomes using
combinatorics, and then finding the number of possible outcomes we’re interested in.
Sometimes we might be able to find out both of these trivially. For example, the probability of choosing a
spade from a pack is 13/52, because there’s 52 possible outcomes, and 13 outcomes which meet our
requirement.
To give a harder example, consider the probability of three men picking different numbers when they each
pick a number between 1 and 10.
13
The more probabilistic approach: The chance of the first man picking a number not clashing with any
previous men we considered is 1 (because he’s the first person we’re considering!). The chance that
the second man doesn’t pick a number that clashes with the first is 9/10 (because there’s 9 numbers
left he can pick such that he doesn’t clash). And similarly the chance the last person’s number doesn’t
clash is 8/10. We get 1 x (9/10) x (8/10) = 72 / 100.
The more combinatory approach: Instead, we could have considered there to be 3 ordered slots
representing the 3 men’s numbers. 10P3 gives us the possible arrangements of 3 distinct numbers into
these ordered slots. And the total number of possible slots fillings (i.e. the size of the sample space) is
103, because there’s 10 possible numbers the first could have picked, the second could have picked,
and the third could have picked. This gives us (10!/7!) / 103 = (10 x 9 x 8) / 103 = 72 / 100. Surprise
surprise, the same answer!
Note that in the second approach, it would have been incorrect to consider the possible ways of picking 3
unique numbers from 10 using
Key terms: Recurrence relations, base
case
, because the 3 men are distinguishable objects. We’re implicitly
imagining them as if they were in a line, so it’s an ordered type problem.
Sometimes we can define the number of combinations for a problem of size n in terms of the number of ways
for a smaller problem. Take the game of Towers of Hanoi for example:
http://en.wikipedia.org/wiki/Towers_of_hanoi. To get n discs from the start peg to the target peg, we solve
the slightly smaller problem of moving n-1 disc from the start to the spare peg, move the largest disc from the
start peg to the target peg, then again solve the smaller problem of moving the n-1 pegs from the spare peg
to the target peg. The number of moves F(n) for n discs is therefore:
This is known as a recurrence relation, because we’ve defined the problem in terms of a smaller one.
We can continue expanding this, because
and so on. But eventually we’ll get to a
‘base case’, i.e. a small problem where we can no longer use our recurrence relation. Moving 1 disc from a
given peg to a target peg is just 1 move, so F(1) = 1. We can use the base case combined with the recurrence
relations to compute the number of moves for different n:
n
1
2
3
4
F(n)
1
(2 x 1) + 1 = 3
(2 x 3) + 1 = 7
(2 x 7) + 1 = 15
14
Key term: Closed form
Labelled vs Unlabelled
In some cases, it’s possible to convert a recurrence relation into an expression involving just simple arithmetic
operations (additions, subtractions, multiplications, divisions, powers, nth roots) in addition to simple
functions like sin, cos and log. Such an expression is known as being in closed form. x = sin(x) for example has
no ‘closed form solution’, because there’s no way in which we can express x as a closed form expression not
involving itself.
For the Towers of Hanoi example, you may have spotted that F(n) = 2n – 1. So there was a way to convert the
recurrence relation to a closed form expression. However, other recurrence relations, amongst many other
expressions (e.g. some integrals, sums to infinity, etc.), cannot be simplified.
is not closed form for
example.
As a side note, there’s a field in mathematics known as ‘Galois Theory’ which is concerned with proving that
no closed form exists for certain expressions.
Another way of saying that objects are “distinguishable” vs “indistinguishable”. Terminology typically used in
graph-based problems, consisting of nodes and edges.
15
Advanced Theory
Baye’s Theorem
Explanation
Baye’s Theorem applies in scenarios where we’ve observed something, but are interested in the probability of
the cause (which is unknown). For example, in the medical profession we might be interested in the
probability a patient has cancer given some kind of visible symptom.
If E is the event representing the evidence, and C the cause, then Baye’s Theorem is as follows:
This gives us a distribution over possible causes given some fixed evidence. Since the evidence is fixed, P(E)
remains constant as we consider different causes C=c. Therefore
is proportional to
and we can avoid having the find the probability of the evidence using:
where k is the constant of proportion. We can work k out because we know
just by the
basic definition of a probability distribution. Therefore, we can think of k as a normalisation constant which
scales our probabilities to ensure they add up to 1.
Example (from Wikipedia): Suppose someone told you they had a nice conversation with someone on the
train. Not knowing anything else about this conversation, the probability that they were speaking to a woman
is 50%. Now suppose they also told you that this person had long hair. It is now more likely they were
speaking to a woman, since most long-haired people are women.
We know in general that 75% of women have long hair, and 30% of men have long hair.
Let W be the event that the person was a woman, and L that they had long hair. Using our figures:
P(W) = 0.5, P(M) = 0.5, P(L|W) = 0.75 and P(L|M) = 0.3.
Then
We similarly have to work out that it was a man in order to normalise our probability;
16
Then
Composition
So there’s a 71% chance the person was a woman.
A composition is a way of writing an integer n as sum of positive whole numbers (and strictly positive,
because we don’t allow 0 in the sum).
So 1 + 3 +1 is a composition of 5, and 3 + 1 + 1 is a separate composition, as the ordering of the numbers
matters.
So how many compositions are there of n? Consider writing out n as n ones, with spaces in between to insert
either a comma or a plus:
Compositions of 5
1 , 1 + 1 , 1 + 1 1, 2, 2
1 + 1 , 1 + 1 + 1 2, 3
By using the + to get some integer, and the commas to separate our integers in the composition, we get all
possible compositions. There’s (n-1) slots to put commas and pluses in, and each slot can take 2 values
(comma or +), so there’s 2n-1 compositions of n.
Situations where a composition might be useful:
The number ways we can allocate seating capacity to the carriages of a train, given the total capacity
of the train is 500, and we’re allowed to choose the number of carriages.
We’ve so far not specified how many terms there must be in the addition. We might be interested for
example in how many ways n can be made up of k numbers added together. We say this is a composition of n
into k parts. So a composition of 5 into 2 parts might be 4 + 1 or 2 + 3, but not 2 + 1 + 1.
To get the number of compositions into k parts, we use the same argument involving slots again, but this
time, in between the 1s, we choose k-1 slots to put commas in (which ensures we’ll end up with k numbers in
the composition), and fill the rest of the slots with +. This gives us
compositions into k parts.
This allows us to consider problems like so:
17
Weak composition
The number of ways of assigning capacity to 5 carriages of a train, presuming the capacity of each
carriage is at least 1, and the total capacity of the train is 500.
The number of ways of putting k items into n boxes, where the boxes are not allowed to be empty.
If we allow the numbers in a composition to be 0, then we have a weak composition of n. But this is not
useful on its own, because we could have infinite 0s in the sum. But if we again restrict the number of items in
the weak composition to k, then we say we have a weak composition of n into k parts. This essentially gives
us the number of solutions xi such that:
for
. So for example, the weak compositions of 5 into 3 parts are:
5=5+0+0
=4+1+0
= 4 + 0 + 1 and so on.
It gives us solutions to problems like:
The number of ways of putting n balls in k boxes, but where this time boxes are allowed to be empty.
See Q9.
Going back to the train example, the number of ways that 500 people can get onto 5 carriages of a
train, in terms of the number of people in each carriage (carriages are allowed to be empty!)
The number of possible weak compositions of n into k parts is
Partition
. The proof is in the model
solution for Q9 on boxes.
A partition is the same as a composition, except that the ordering of the numbers no longer matters.
So the partitions of 5 are:
5=5
= 4 + 1 (which is considered the same as 1+4 this time)
=3+2
= 3 + 1 + 1, and so on.
Unfortunately, unlike compositions, there is no nice closed-form formulae for working out the number of
partitions of n. We instead have to rely on a recurrence relation (see
http://en.wikipedia.org/wiki/Partition_(number_theory) for details).
For the plastic bag question (Q5), it may be useful to use a partition.
18
Solutions
Introductory
1. How many ways are there of arranging eight
different books on a shelf?
2. How many ways are there of arranging eight
different books on a shelf, if you must keep the
two red ones next to each other?
Solution
8! (see Key Theory)
Arrangement problems of this type often occur. When we have different categories of objects (in
this case, red and non-red), we adopt the following strategy:
1. If we imagine the line as a series of ‘slots’ we can put objects in, then first we assign the
slots categories according to the conditions imposed, and find the number of ways of
assigning these categories. In this case, we want to nominate two adjacent slots for red
books and the other 6 for non-red books. There’s 7 ways we can do this just by observation.
2. We then consider the possible arrangements of objects in each category. In this case,
there’s 2! ways of arranging the red books (the question explicitly says they are
‘distinguishable’) and 6! ways of arranging the non-red books.
So in total, we have 2! x 6! x 7 = 10,080 ways.
3. How many ways are there of arranging eight
different books on a shelf, if you must keep the
two red ones separate?
Important point: In general, we should check that we haven’t accidentally duplicated arrangements.
But we’re OK here, because steps 1 and 2 combined of our strategy are guaranteed to generate
unique sequences (i.e. an arrangement of objects after step 2 can only have resulted from one
category allocation from a step 1), so it’s valid to consider the possible category allocations and the
arrangements inside these categories independently. This sounds pedantic, but taking care to avoid
duplicates will save a lot of woe in more involved questions.
Another ‘classic’ type of question, which has a number of different ways of solving.
Here’s the easiest:
In our ‘step 1’ of allocating the red/non-red categories to slots on the bookcase, start by
putting the 6 non-red slots in a line. We then want to insert red slots, such that they don’t
appear together. If we consider the 7 ‘gaps’ both between the non-red slots and either side
19
of all the slots, then if we consider all the ways of arranging the 2 red-slots in these gaps,
then we guarantee they’re kept apart. There’s
We now have a sequence of 8 slots for us to put the actual books in. There’s again 6! ways
to arrange the non-red books in the non-red slots, and 2! ways to arrange the red books in
the red slots.
So in total, we get
4. How many ways are there of arranging eight
different books on a shelf, if you must keep the
four red ones next to each other?
5. How many ways are there of arranging eight
different books on a shelf, if you must keep the
four red ones separate?
of arranging the red slots in these gaps.
= 30,240 ways.
We apply the same principle as before. There’s 5 possible ways in which we can assigned red-slots
such that they remain together. So the number of ways is 5 x 6! x 2! = 432,000 ways.
Again, same principle. Start with the 4 non-red slots, then we have
ways of inserting the red
slots to get a sequence of 8 categorised slots where the red slots are all apart. So the number of
ways Is
4!4! = 5760 ways.
Important Teaching Note: You might think that a method of solving this is to subtract the number of
ways of keeping the red books together from the total number of possible arrangements of books,
seemingly leaving the possibilities in which the red books are apart. The flaw here is assuming that
the scenarios of red books all being apart and all being together are true complements of each
other. But they aren’t: saying that the books don’t appear all together in one block allows
possibilities where some of the red books might still be together.
We have a similar situation to above, except that we no longer allow the red books to be in any
6. How many ways are there of arranging eight
different books on a shelf, if you must keep the
order. We drop one of the 4!’s, giving us
4! = 240 ways.
four red ones separate but in alphabetical order by
author?
7. How many ways are there of arranging fourteen Using our previous reasoning, we could give a general formula for finding the number of ways of
different books on a shelf, if you must keep the five arranging n books where there’s k red books that need to be kept separately as:
red ones separate?
Using this, we get
= 10,973,491,200 ways.
20
8. How many ways are there of arranging the
letters of the alphabet so that the vowels are not
next to each other?
9. How many ways are there of arranging the
letters of the alphabet so that the vowels are not
next to each other but are in alphabetical order?
10. How many ways are there of writing a fiveletter word with no letters the same?
11. How many ways are there of writing a fiveletter word with no adjacent letters the same?
12. How many ways are there of making a selection
from a bowl containing an apple, an orange and a
plum?
Same as before. Using the formula above, we get
= 1.61 x 1026 ways.
We don’t arrange the 5 vowels once we have vowel/non-vowel slots, so
= 1.35 x 1024 ways.
26
P5
The first letter can be anything (i.e. 26 possibilities). The second can be anything other than this (25),
and the same for all subsequent letters. 26 x 254 = 10,156,210 ways.
There’s two ways of doing this:
1. We find all the ways of selecting 1 item from 3, or 2 items from 3, or picking all 3 items. This
gives
.
2. Alternatively, each of the apple, orange and plum can be picked or not picked. That gives us
2 x 2 x 2 = 23 ways. But we want to exclude the possibility of none being picked. What gives
23 – 1 = 7.
A side note: By equating these two methods, we’ve essentially just proven that
Or if we include the case of no objects being picked:
13. How many ways are there of making a selection
from a bowl containing a lemon, a lime, a
kumquat, a mango and a passion fruit?
14. How many ways are there of making a selection
from a bowl containing three apples?
15. How many ways are there of making a selection
from a bowl containing five apples and three
oranges?
16. How many ways are there of making a selection
from a bowl containing three pineapples, four
melons and six mangoes?
.
. Good stuff!
5
2 – 1.
Presuming that the apples are indistinguishable, then just 3. i.e. We can pick one apple, two apples
or three apples.
Let’s presume that the apples are indistinguishable, the oranges are indistinguishable, and the order
in which we pick the fruit from the bowl doesn’t matter. Then we can pick between 0 and 5 apples,
and between 0 and 3 oranges. But we need to discount the case where no fruit is taken. So that’s (6
x 4) - 1 = 23.
By the same argument, we get (4 x 5 x 7) - 1 = 139.
21
17. How many ways are there of arranging three
pineapples, four melons and six mangoes in a line?
There’s 13 pieces of fruit in total, and thus 13! Ways of arranging them if all the pieces of fruit are
distinguishable. However, we don’t care about the order of the pineapples, so each 3! arrangements
are equivalent, and similarly we account for the melons and mangoes. That gives 13! / 3!4!6! ways.
See Q4 in General Questions.
22
General Questions
1. A frog has n lily pads in front of it in
a line, and it needs to reach the last lily
pad. The frog can either hop to the lily
pad in front of it each time, or skip the
lily pad in front and hop to the one
after it.
How many ways F(n) are there of
reaching the nth lily pad? (in terms of
possible sequences of hops and skips)
Solution
Let’s first consider the ‘base cases’ (i.e. the cases for the first few values of n). When n
= 1, there’s only 1 way of getting to the final lily pad (a single hop).
When n = 2, there’s 2 ways of getting to the final lily pad (two single hops or a skip).
Source
Classic Problem
We want to build up a recursive definition for the number of hops with n lily pads
presuming we’ve already solved the problem for smaller values of n.
If the frog jumps to the next lily pad, there’s n-1 remaining pads, and the number of
ways of getting to the final pad is F(n-1).
Similarly, if the frog skips a pad, there’s then F(n-2) ways of getting from this pad to the
final one.
If we can say that the sequences of jumps of the frog in these two cases don’t overlap
(i.e. are disjoint), then F(n) = F(n-1) + F(n-2).
But we know the sequences are different, because in the first case the sequence of
jumps will start with a single hop, and in the second case they’ll start with a skip.
So the solution is F(1) = 1, F(2) = 1, F(n) = F(n-1) + F(n-2), or we could have alternatively
defined the base cases as F(0) = 1 and F(1) = 1 (since arguably n=2 is not a base case
since it uses our recurrence relation).
This is the Fibonacci sequence! The closed-form formula can be found here:
http://en.wikipedia.org/wiki/Fibonacci_number#Closed-form_expression
Teaching points: The easiest way to spot patterns is to deal with small examples. Once
the solution is presented, identify that the definition of F(n) is a recurrence relation, i.e.
it decomposes into smaller problems which in turn must also be solved (but we can
repeatedly apply the recurrence relation until we get to a base case).
23
2. Repeat the above problem if the
frog can jump any number of lily pads
each time.
3. If there’s 49 different numbers in
the lottery and you win £10 for
matching 3 numbers correctly out of 6,
what is the chance of winning £10?
For all but the last lily pad, each can either be jumped on or not. So there’s 2n-1 ways.
Recall that we can calculate a probability by finding the number of ways in which our
event of interest can occur, and dividing it by the number of possible events.
We already know there’s
Classic problem
sets of numbers that can occur in total.
Let’s focus on the 6 numbers we’ve chosen, and consider all the possible 6 announced
numbers in which 3 of our numbers match.
First consider the possible sets of 3 numbers which matched the winning ones. There’s
of these. But then the remaining 3 non-matching numbers could be anything that
are not winning numbers (otherwise we’d have matched more than 3 numbers).
There’s 43 non-winning numbers (49-6), and we’re ‘choosing’ 3 of these, giving
.
This gives us:
4. How many ways are there of
arranging the letters of HELLO or
BANANA?
This distribution (for different numbers of matching numbers, i.e. 0 to 6 matches) is
known as the hypergeometric distribution
(http://en.wikipedia.org/wiki/Hypergeometric_distribution).
The key here is repeated letters. While there’s 5! ways of arranging the letters of
HELLO presuming they’re all separate letters, each arrangement is duplicated 2!
because of the number of ways of generating the L. So there’s 5! / 2! = 60 ways.
Similarly, each arrangement of BANANA is duplicated 3! x 2! ways because of the
arrangements of As and Ns. This gives 6! / (3! X 2!) = 60 ways in total.
Classic problem
24
5. How many ways are there of
arranging n (indistinguishable) plastic
bags, if bags can be put inside each
other or alongside?
JAF’s solution: This is a difficult and open-ended problem! I’ll use () to indicate a bag,
with (()) to indicate one bag inside another and ()() to indicate two (empty) bags
alongside each other.
n=1
() -> 1
n=2: ()(), (()) -> 2
n=3: ()()(), (())(), (()()), ((())) -> 4
n=4: ()()()(), (())()(), (())(()), ((()))(), (()())(), (()()()), ((())()), ((()())), (((()))) -> 9
n = 5: -> 20
Note that if the ordering of the bags mattered (for example “(()) ()” was different to “()
(())”, then this is equivalent to the problem of the number of possible
parenthesis/bracketing embeddings, which can be described using the Catalan
Numbers
(http://en.wikipedia.org/wiki/Catalan_number#Applications_in_combinatorics).
However, in this problem the ordering doesn’t matter.
JAF
The problem alas doesn’t have a nice closed-form solution. However, we can form a
recurrence relation (albeit an inelegant one). To arrange n bags, we could first consider
the number of bags we can actually observe (with the rest arranged inside these bags).
We can use a partition for this (see ‘Advanced Theory’). This operation is useful
because it gives us all the ways of splitting the bags into various clusters of bags (where
one bag is visible for each cluster enclosing the others inside it). See diagram:
One partition of 10 bags is 4 + 3 + 2 + 1.
Arrange 1 bag inside
Arrange 3 bags inside
Arrange 2 bags inside
No bags inside
25
Once we’ve got a number of bags in each cluster (say ki in the ith cluster), then we can
recursively use our formula (say a function F), to say how many arrangements there
are for the ki bags in that cluster, notably F(ki-1), because there’s 1 observable bag in
the cluster and k-1 bags to arrange inside of it. How many combinations are there in
total? We might be inclined to think it’s just the product of
for the different
number of bags ki in each cluster, but there’s a problem: Suppose we have 2 clusters
and 3 bags in each. Then we can’t consider the number of bags in each cluster
independently, because (()()) ((())) is equivalent to ((())) (()()). So if for the two clusters
there’s 2 ways of organising the 3 bags in each one (because F(3-1) = 2), and we call
each way a and b, then we could have {a,a}, {a,b} or {b,b} (since {b,a} would be the
same as {b,a}). If there’s say s’ slots where we have the same number c of possible
arrangements in each, then we can get the total combinations N(s’,c) for these slots
using another recurrence equation, which I worked out to be
where in the base cases N(1,c) = c and N(s’,1) =1 (I’ll leave you to work out why).
To get the final formula, I define the following things:
F(n) is the number of ways of arranging n bags.
P(n) gives us a partition of the number n as previously described.
D(p) gives us the distinct quantities of bags in a partition p, so
gives
us {1,3}. This allows us to consider slots with the same number of bags at the
same time.
C(i,p) gives us the number of times the number i appears in the partition p, so
gives 2 because the 1 appears twice.
N(s,c), as previously described, gives us the number of ways of arranging bags
amongst s bag clusters with the same number of bags in each cluster, given we
have c ways of arranging this number of bags in an individual cluster.
My final formula is therefore:
with the base cases F(0) = 1 and F(1) = 1 (the latter is not strictly necessary). To give an
example, let’s find F(5), presuming we’ve already found F(1) up to F(4). Let’s consider
26
each partition in turn:
Partition
Working
5 (all 5 bags combined in D gives us 5, and C gives us 1 (because
one bag)
we have one 5).
N(1, F(5-1)) = F(5-1) = 9
Total Ways
9
4 + 1 (4 bags combined
in one and one
separate)
4
3+2
3+1+1
2+2+1
2+1+1+1
1+1+1+1+1
D gives us 1 and 4 (the distinct
numbers here). The corresponding C
values are 1 and 1.
N(1, F(4-3)) x N(1, F(1-1)) = F(3) x F(0)
=4x1=4
D gives us 2 and 3. Corresponding C
are 1 and 1.
N(1, F(3-1)) x N(1, F(2-1)) = F(2) x F(1)
=2x1
D gives us 1 and 3. The C for the
former is 2 (two occurrences) and 1
for the latter.
N(2, F(1-1)) x N(1, F(3-1)) = 2 x 1
D gives 1 and 2, with C for these 1 and
2.
N(1, F(0)) x N(2, F(1)) = 1 x 1 = 1
N(3, F(0)) x N(1, F(1)) = 1 x 1 = 1
N(5, F(0)) = 1
2
2
1
1
1
So F(5) = 9 + 4 + 2 + 2 + 1 + 1 + 1 = 20.
I admit that I find my particular solution ‘unsatisfying’, even if it works. Using the rather
helpful “Online Encyclopaedia of Integer Sequences” and typing in the first few
numbers, I was able to subsequently find papers on this sequence:
http://oeis.org/A000081 . This gives a slightly simpler recurrence relation that doesn’t
require you to partition n.
27
6) 8 people go to a cinema and sit in
line. 3 of them are sisters who want to
sit together.
(c) How many ways are there
of seating the 8 people?
(d) How many ways are there
of seating the 8 people if
the sisters aren’t allowed
to sit together?
7. Repeat the above problem where
the 8 seats are arranged in a circle
These are identical to the problems involving red books being kept together and apart.
(a) The sisters must sit together, and there’s 6 ways in which the block of sisters
can occur. But this just indicates the sister and non-sister seats, not specifically
who sits in them. There’s 3! ways of arranging the sisters in the sister seats and
5! ways of arranging the non sisters. So 6 x 5! x 3! = 4320 ways.
(b) Start by allocating 5 seats for non-sisters. There’s 6 places each sister could sit,
either sitting between two non-sisters, or at either end of the row. There’s
ways in which the 3 sister seats could be allocated. Now we’ve determined the
sister and non-sister seats, we have 3! ways of arranging the sisters in sister
seats and 5! for non-sister seats. So 120 x 5! x 3! = 14,400. There’s alternative
ways of getting the same answer.
(a) The only difference is that the block of 3 sisters can now occur in 8 positions
(i.e. the block can start in any of the 8 seats). So 8 x 5! x 3! = 5760.
(b) Allocate the 5 non-sister seats in the circle first. Then there’s
8. An examiner invigilates an exam in
which 1500 students are applying for
150 places at a school. The examiner is
responsible for invigilating a room of
25 students. What is the chance that
all of them get a place?
TES Forums
ways to
allocate the 3 sister seats between the non-sisters (again ensuring the sisters
don’t sit together). This gives us 10 x 5! x 3! = 7200.
There’s two possible methods here, one involving just probabilities, and one involving
combinatorics:
1. That first student in the room has a chance of 150/1500 of getting in. The
second has a chance of 149/1499 (because if the first student has got an offer
there’s one less student and one less offer to consider – this is sampling
without replacement). This continues until we have the probability 126/1476
of the 25th student getting in. This is (150! / 125!) / (1500! / 1475!) = (150! x
1475!) / (125! x 1500!) which is 1.5 x 10-26, i.e. a 1 in 7 x 1025 chance. That’s
rather low!
2. We can instead find the total number of offer allocations, and then find how
many of those involve offers being assigned to all 25 of the students in the
room. There’s
JAF (but is a classic type
of problem)
JAF (thought up while
invigilating an 11+
exam)
ways of allocating 150 offers to the 1500 students. And
in the scenario where all 25 of the students have offers, there’s
ways
of allocating the remaining offers to the students not in the room. So we get
28
. By simplifying we can see this is equivalent to the first solution.
We might wonder how valid it is to consider sampling without replacement, i.e.
attaching a probability 150/1500 to each student getting an offer, and considering
9. Suppose that n balls are placed at
random into n boxes. Find the
probability that
there is exactly one empty box.
these independently, giving a
chance, which is 1 x 10-25. We could use a
Binomial Distribution to find the probability of each number of people in the room
giving offers). But alas, the approximation is not accurate enough.
JAF’s solution: Note first the assumptions in the question: that the balls are
indistinguishable, but the boxes are. Given the boxes are distinguishable, we consider
them as being ordered.
If there’s exactly one empty box, then all other boxes must have exactly 1 ball except
one that has 2 balls. There’s n different boxes the empty box could be, and thus n-1
boxes the box with 2 balls could be.
The next question is the total number of possible allocation of balls to boxes. The best
approach here is to consider the arrangements of ‘barriers’ separating the balls (i.e.
the walls of the boxes) and the balls. If n=3, we could represent the balls all being in
the first box as OOO||, and a ball in each box as O|O|O. We have n balls and n-1
‘walls’, so have 2n-1 slots to put either a wall or a ball in. Then it’s simply a matter of
finding the number of ways of arranging n-1 walls amongst 2n-1 slots (or equivalently,
n balls amongst 2n-1 slots), which is
10. You are captured by insane
mathematicians and forced to play
Russian Roulette. You are given a gun
with n slots in the barrel and 1 bullet,
and shoot n times (rotating the barrel
between shots so the position of the
. Our final probability is then:
The ways of arranging n balls amongst n boxes (and in general, amongst k boxes) is
known as a weak composition of n into k. See ‘Advanced Theory’.
The probability of surviving on each shot is 1 – (1/n). The probability of surviving n
shots is
. We’re interested in
Cambridge 1st Year
Probability Course
(from Sir Timothy
Gowers’s website)
.
Classic Problem
(repackaged by JAF!)
The answer is in fact 1 in e. So see why, we can use the standard result
(the proof of which is worth looking up!). Using k = -1, we get the result as
desired.
29
bullet is random each time). What’s
the probability that you survive as n
becomes infinitely large?
11. a) Mary tosses two coins and John
tosses one coin. What is the
probability that Mary gets strictly
more heads than John? Answer the
same question if Mary tosses three
coins and John tosses two.
The result equivalently answers questions like “what’s the chance I’ll never win the
lottery, given the chance of winning is 1 in 14m and I play 14m times”. Given 14m is a
large number, the chance is pretty much 1 in e.
The easier way: Suppose we have a probability p that John and Mary get the same
number of heads on n throws. We never have to actually work out this probability!
Then:
p(A gets strictly more heads with n+1 throws) = p(A gets strictly more heads than B on
n throws) + p(A gets some number of heads after n throws, then throws a heads on
n+1 throw)
b) Make a conjecture for the
corresponding probability when Mary
tosses n + 1 coins and John tosses n.
Now prove your conjecture.
We can find the first probability by using 1-p to say that one gets more heads than the
other; then we can divide by 2 by symmetry.
Cambridge 1st Year
Probability Course
(from Sir Timothy
Gowers’s website)
This gives
The much harder way: The probability is 1/2 every time. When John tosses 3 coins for
example and Mary two, we can make a table of all the ways in which John can get
more heads than Mary:
John #heads
3
3
3
2
2
1
Mary #heads
2
1
0
1
0
0
Total ways
1
1
1
3
3
3
1
2
1
2
1
1
Total:
1
2
1
6
3
3
16
The third and fourth columns respectively give the number of ways of John getting his
number of heads in his 3 throws and Mary getting her number of heads. The total for
each row is then just the product of these. The grand total is 16.
30
Since there’s 5 throws combined from John and Mary, there’s 25 = 32 possible
outcomes. 16/32 = 1/2.
Now we need to prove it’s always 1/2 if John tosses n+1 times and Mary n times. By
using the structure of the table above as a guide, we get:
11c) If John tosses n coins and Mary
also tosses n coins, what’s the
probability that John gets strictly more
heads than Mary? You may find the
identity
useful.
Where I’ve used j and m to indicate the number of heads John and Mary got. Mary is
not allowed more than j-1 heads. We know the numerator must eventually simplify to
22n, so that the fraction becomes 1/2.
After a few attempts at proof by induction to show that the above formula yields 22n, I
gave up, and instead an Oxford don friend came to the rescue:
http://spivey.oriel.ox.ac.uk/wiki/images/c/c4/Jamie.pdf
If we find the probability that both John and Mary get the same number of heads, then
we can easily get the probability that they get different numbers of heads. And by
symmetry, since the probability that Mary gets more heads the John is the same as the
other way round, we can half the probability to get the final answer.
JAF
By directly using the Binomial Distribution, the probability of a person getting k heads
in n throws is
. Then the probability of both John and Mary getting the same
number k throws is just this squared:
. We need to consider all the possible
numbers of heads that they could both get:
using the identity rather helpfully provided in the question.
by
Then by our reasoning at the start of the question, the probability that John gets more
heads is:
31
12. Parliament contains a proportion p
of Conservative members, who are
incapable of changing their minds
about anything, and a proportion 1 − p
of Labour members, who change their
minds completely at random, with
probability r, between successive
votes on the same issue. A randomly
chosen member is observed to have
voted twice in succession in the same
way. What is the probability that this
member will vote in the same way
next time?
JAF’s solution: Whenever we see something observed and are interested in the
probability of the cause (in this case, we observe the previous double voting, and are
interested in the probability of the member being L = Labour or C = Conversative), we
use Baye’s Theorem (see ‘Key Theory’).
p(C | sameVote) = k p(sameVote | C) x p(C)
= k x 1 x p = kp
P(L | sameVote) = k p(sameVote | L) x p(L)
= k x (1 – r) x (1 – p)
We can find k:
kp + k(1-r)(1-p) = 1
=>
k = 1 / (p + (1-r)(1-p))
Given we have the distribution over the party member’s identity given their previous
voting, we can now work out how they’ll vote next:
p(sameAgain | sameVote)
= p(sameAgain, C | sameVote) + p(sameAgain, L | sameVote)
= p(sameAgain | C)p(C | sameVote) + p(sameAgain | L)p(L | sameVote)
13. How many distinct ways are there
of colouring the sides of a cube using 6
colours? Cubes that can be rotated to
look the same as each other are not
counted as distinct.
Cambridge 1st Year
Probability Course
(from Sir Timothy
Gowers’s website)
(1)
(2)
In (1), we said that the probability of voting the same way is can be split into the two
independent events of voting the same way as a Conservative member and voting the
same way as a Labour member. Each is a joint probability, the first for example of
voting the same way as a Conservative member, and of being a Conversative member
(given our previous evidence).
30 ways. We need a method to assign colours to sides such that we avoid duplicate
cubes when rotating. Here’s one method: First pick a colour to put on one side. There’s
5 colours to put on the opposite face. We then arrange the remaining 4 colours around
the remaining faces (4! ways), but have to divide by 4 because by rotating the cube
(with the axis the line going between the faces with the first two assigned colours) we
get equivalent arrangements. That gives us 5 x 4! / 4 = 30 ways.
Classic Problem
32
14. Given 23 people in the room,
what’s the probability that at least two
of them share a birthday? (you can
assume there are 365 days in a year)
Close to a half; remarkable given such a small number of people! This is a well-known
problem called the Birthday Problem (http://en.wikipedia.org/wiki/Birthday_problem).
We want to avoid having to calculate the probability of 2 people sharing a birthday,
and 3 people sharing a birthday, and so on (the question states we’re interested in at
least 2 people sharing a birthday).
But we can find the probability of no one sharing a birthday, and subtracting this
answer from 1 gives us the probability we want, because P(no one shares) + P(at least
two share) = 1.
We consider each person at a time, finding the probability of that person not sharing a
birthday with any of the people previously considered.
When we consider the first person, there’s a 100% chance they don’t share a birthday
because we haven’t considered other people yet. When we consider the second,
there’s a 364/365 chance they don’t share a birthday with the first person, because
364 out of 365 days don’t occur on the first person’s birthday. Similarly for the third
man we get 363/365, and so on, until for the 23rd man we get 343/365.
This gives us a probability of 0.507 once we multiply these probabilities together and
subtract from 1.
Classic Problem
In general, for n people, there’s a
chance that at least 2 share the same
n
birthday (where Pr is the ‘permutation’ function defined in the ‘Key Theory’ section).
This makes sense when you think about it: there’s 365n total ways in which the n
people’s birthdays could occur (365 possible days for the first person, 365 for the
second, etc.). And we’re interested for how many of these assignments no birthdays
clash. For the n people, 365Pn is by definition the number of ways of assigning the
numbers 1 to 365 to n slots without duplicates. Which is the same as allocating distinct
birthdays to the n people.
15. If you throw 6 dice, what is the
probability of getting a 1, 2, 3, 4, 5 and
6? (the ordering does not matter)
Note that we didn’t use 365Cn instead of 365Pn, because the people in the room are
distinguishable, i.e. person A having a birthday on Jan 1st and person B on Jan 2nd is a
distinct possibility than the case where the birthdays are the other way around, so the
ordering of birthdays does matter.
Consider 6 ordered slots in which we put our numbers. There’s 66 possible outcomes in
total. And there’s 6! ways of arranging 1, 2, 3, 4, 5 and 6 into the slots. So there’s a
probability.
JAF
33
16. If you throw 6 dice, what is the
probability of getting a run of exactly
four? e.g. 1, 2, 3, 4 or 2, 3, 4, 5, etc.
Teaching point: Students might attempt to consider just distinct lists of numbers (e.g.
1-2-3-4-5-6 being just one case, and ignoring ordering) instead of considering each dice
as a distinguishable object. But this would be incorrect, because (a) the dice are
distinguishable (i.e. we can see which dice is which), so we should imagine them being
in a line where their ordering does matter (i.e. 1-1-3-4-5-6 IS a distinct case from 3-11-5-4-6) and (b) we can’t consider the number of outcomes in terms of distinct
quantities of each number because each outcome is not equally likely to be seen, e.g.
six 1s is less likely to be seen than 3 twos and 4 threes. It’s only if they were equally
likely that we could conflate all the ways of seeing 3 twos and 4 threes into just one
outcome.
Note firstly that the question implicitly excludes getting a run of 5 or 6.
This question is all about being incredibly careful avoiding duplication of possibilities,
whilst ensuring all possibilities are covered.
JAF
My strategy was this: First to find unordered lists of numbers that could possible fill the
dice ‘slots’, then for each work out how many ways each of these can be arranged into
concrete ordered sequences of numbers. For example, one list of numbers might be 2,
2, 3, 4, 5, 5 (giving the run 2-3-4-5). Then it’s a case of finding the number of ways
these numbers could actually occur amongst our (distinguishable) 6 dice.
For example, I started with the run of four being 1 2 3 4. Neither of the two remaining
numbers are allowed to be 5 (otherwise we’d have a run of five), but they could
duplicate any of the numbers in the range 1-4. There’s 4 ways for example in which
one of the remaining numbers could be a 6 and the other one of 1-4 (remembering at
this point we’re not considering order). Then using the same approach we used to find
the arrangements of letters in words with duplicate letters (see the ‘HELLO’/’BANANA’
question), we have 6!/2! arrangements of these numbers because one number is
duplicated.
Here’s a summary table of number of possible ways of getting a run 1-4:
Remaining Dice
Arrangements
Total
One dice a 6, the other 1-4 6! / 2! = 360
1440
(duplicating a number in
the run): 4 ways
34
Both dices a 6 (1 way)
Both dice in range 1-4, but
not the same.
ways of allocating the two
numbers.
Both dice in range 1-4, and
the same (4 ways)
6! / 2! = 360
6! / 2!2! = 180
360
1080
6! /3! = 120
480
Giving a total of 3360 ways. Notice I’ve been careful in ensuring that each row
represents a unique choice of (unordered) numbers.
Now for the run 2-3-4-5. This is easier, because we know the two remaining numbers
can’t be either 1 or 6 (or again we’d have a longer run than four numbers).
Remaining Dice
Both 2-5, but different
(again 6 ways)
Both 2-5, but the same
(again 4 ways)
Arrangements
6! / 2!2! = 180
Total
1080
6! / 3! = 120
480
Which is 1560.
By symmetry, the number of ways of getting a run 3-4-5-6 is 3360.
The total number of sequences involving a run of 4 is therefore (3360 x 2) + 1560 =
8280.
The probability is therefore
= 0.177, because there are 66 possible sequences as
outcomes. A similar process can be used to find a run of various different numbers. We
already know from the previous question that there’s 6! ways of getting a run of 6 on
the dice (1-2-3-4-5-6). There’s 6 ways of getting a run of 1 (all the numbers have to be
the same!) All possible throws of 6 dice have some ‘run’, even if it’s small. So we have
the sum of possibilities for runs of 1, 2, 3, 4, 5 and 6 add up to 66, i.e. the total number
of possible outcomes.
35
17. I have two identical packs of cards.
I take each pack and shuffle it
separately, placing them both face
down in the table. I then proceed to
play a game of snap with myself.
(Being a mathematician I have no
friends.) I compare the top card from
each pile, and then compare the
second card from each pile, ... and so
on. What is the probability that I
continue in this way all the way down
the piles, and never find an exact
match in the 52 pairs of cards?
JAF’s solution: Let’s consider some smaller examples first.
Mathmo.net
For just two cards in each pack, we can easily see the probability is 1/2, because if we
survive the first pair then we know the remaining pair will be different cards.
Imagine we reduce each pack to 3 cards: {A, 2, 3}. There’s clearly a 2/3 chance of
surviving the first draw of cards – suppose these were Ace from the first pack and 2
from the second, leaving 2 3 in the first pack and Ace 3 in the second.
There’s a 3/4 chance of being OK now, because only one of the 4 possibilities (2-Ace,
2-3, 3-2, 3-3) leads to the same cards. Then on the third draw, things become
complicated because the previous draw determines this one. If we previously drew a 21 pair, we’d be left with the 3-3. So of the previous 3 possibilities that resulted in
drawing different cards, 2 of these would have resulted in success on the last draw, i.e.
2/3. The chance for 3 cards is therefore 2/3 x 3/4 x 2/3 = 1/3.
But using this card by card approach becomes stupidly hairy once we consider 4 cards
or more. It looks like the chance might be 1/n (where n is the number of cards), but
how do we show this?
We can use the tried-and-tested strategy of finding the total outcomes and outcomes
we’re interested in. Imagine the first deck is fixed: then there’s n! possible ways of
arranging the second deck. Of these, we’re interested how many arrangements in
which there’s no card which is in the same position in the first desk. For the first card,
there’s n-1 cards this could be to avoid being the same. For the second there’s n-2, and
so on, until for the second last card, there’s 1 way in which we can choose the card,
which determines the last card. That’s (n-1)! ways in total.
So the probability is
18. What’s the difference expected if 2
people each think of a real number in
the range 0 to 100?
.
We have two random variables here, say X and Y to represent the number chosen by
the first and second person. We’re interested in |X-Y|, the difference between the two
(using the modulus function to ensure the difference is always positive). The question
is asking us to calculate E[|X-Y|]. This requires us to work out p(|X-Y|).
JAF
36
The difference between the two numbers is clearly at most 100 and at least 0. Consider
first something in between: the possible ways of it happening (if say the difference is d)
is where we imagine two points d apart sliding from 0 and d to 100-d and d,
representing all the possible pairs of points with this difference (I’m ignoring the
ordering of the points here, because I’ll be consistent in the other cases). The amount
this window can ‘slide’ is 100-d.
As the difference increases, the amount we can slide the window linearly decreases,
because 100-d is obviously linear. In the extremes, when d=100, we don’t have any
‘sliding’ (i.e. we only have one point 0 and the other 100). Since the probability of a
given difference is proportional to the range of points with this difference (if we have
twice as many possible pairs of points for example, then the probability is double),
then we’ve got our probability distribution:
p(|x-y|)
|x-y|
100
Given the shape, the probability when |x-y|=0 must be 1/50, because for continuous
distributions, the area under the graph must be 1 (and we have a triangle). Remember
that for continuous distributions, the probability here is actually probability density.
The equation (using the equation of a straight line) is p(x) = (1/50) – (1/5000)x
Using this distribution, what’s then the average |X-Y|? We can use the general
definition of E[..] for a continuous variable to finish off the job:
37
19 a) How many ways are there of
pairing 2n people at a party?
b) Suppose Bob arrives late to the
party. Suppose everyone is repaired
(inevitably leaving one person alone!).
How many possible pairings are there
now?
JAF’s solution:
a) I first found the number of ways of choosing the first person in each pair. There’s
ways of choosing these people. We can then allocate/arrange the remaining n
people to them in n! ways. However, this leads to duplicates: if for example we’d
paired a guy Bob with a lady Sue, our method may have picked Bob first then allocated
Sue, or vice versa. Each of the n pairs is duplicated, so we need to divide by 2n to
account for this. This gives us the following number of orderings:
MathsHelper.co.uk
b) We now have 2n+1 people. As before, we select n people to be the first person in
each pair, but now chosen in
ways. Of the n+1 people left, there’s
ways in which to select people to be paired up with them, and again n! ways to
allocate these people to pairs. Eliminating duplication once more, we get:
20. In an experiment to investigate
animal behaviour rats have to make a
choice between 4 doors of different
colours. If they make the right choice
they find food; if they make the wrong
choice they get an electric shock. If an
incorrect choice is made, the animal
returns to its starting point and tries
again, and this continues until a
i) This first part is an example of a geometric distribution, because at each trial there’s
some fixed probability some process will end, otherwise we repeat. If the rat is
successful on the xth attempt, then there were x-1 unsuccessful attempts, each with
3/4 probability. Then finally on the xth attempt the rat picks the correct door with
probability 1/4. This give us:
Note that this is a distribution, since we’re considering all possible values of x, with the
38
correct choice is made. If p(x) is the
probability that a correct choice is
made at the xth attempt, find p(x) if
i.
each door is equally likely
to be chosen at each trial,
and all trials are mutually
independent;
ii.
at each trial the rat
chooses with equal
probability between the
doors which have not been
tried previously, no choice
ever being repeated;
iii.
the rat never chooses the
same door on two
successive trials, but
otherwise chooses at
random.
Which strategy would be the best one
for the rat to adopt?
probability for each one.
ii) If x=1, the probability of picking the correct door is 1/4 as before. If x = 2, the rat
would have initially picked the wrong door with probability 3/4, then the right door
with probability 1/3 (since we’re not allowed to repeat the choice from before, so
there’s one less door). This gives 1/3. For x = 3, we get 1/4 x 2/3 x 1/2 = 1/4. And
similarly for x = 4 we get a probability of 4.
Thus:
iii) When x = 1, the rat picks the correct door immediately again with probability 1/4.
When x = 2, he initially picks incorrectly with probability 3/4, then picks correctly with
probability 1/3 from the 3 remaining doors, giving 1/4.
When any x however, the rat picks the first door incorrectly with probability 3/4, all
subsequent doors before the last incorrectly with probability 2/3 (since the only
requirement is that the rat is not allowed to pick the previous door), and lastly the
correct door with probability 1/3. The 3/4 and the 1/3 multiply to give 1/4, and we’re
multiplying by 2/3 x-2 times. So:
If X represents our random variable of the number of doors the rat chooses and then
wins, we can compare E[X] for the 3 different strategies – the one with the lowest
values is best because the rat’s expected number of choices before getting food is the
least.
For the first strategy:
because the expected value of the geometric distribution is just the reciprocal of the
39
probability of ‘success’ (this is a standard result). For a proof see http://adorioresearch.org/wordpress/?p=516
For the second strategy:
For the third strategy (using the general formula of expectation):
(The proof for the infinite sum being equal to 6 uses the ‘standard formula’:
, see my enrichment puzzles/theory for arithmetic/geometric
21. How could you simulate the throw
of a fair die using a fair coin?
22. How could you simulate the throw
of a fair coin using an unfair coin? (i.e.
with some fixed probability of heads
not equal to 0.5)
series).
The best strategy is therefore the second one.
An alternative way of assessing the value of each strategy is to calculate the cumulative
distribution function of each strategy. We could then compare for different x the
probability that the rat would have picked the right door by that point.
Throw the coin 3 times, for which there’s 8 distinct events. For the first 6 of these (i.e.
TTT, TTH, THT, etc.), use these sequences to represent the throw of 1 to 6 respectively.
If we get one of the remaining 2 combinations, then just throw again and repeat.
Use a similar principle to above. Suppose the probability of getting a heads on the
unfair coin is p (and thus 1-p of getting tails). If we toss the coin twice, then there’s a
(1-p)2 chance of TT, p(1-p) of getting HT, p(1-p) of getting TH and p2 of getting HH.
We have two outcomes here with the same probability! This means we can use it to
construct a situation similar to before:
Classic Problem (told to
me by a friend at
university)
Classic Problem (told to
me by a friend at
university)
40
a. Throw the coin twice. If it gives HT, declare ‘Heads’. If it gives TH, declare
‘Tails’.
b. Otherwise, flip the coin twice again and repeat.
23. A decimal between 0 and 1 can be
represented in binary by using the kth
digit after the decimal point to
represent whether (1/2)k appears
when we express the number as a sum
of powers of 1/2. So 0.101 for example
represents 1/2 + 1/8. Using this fact,
find a way in which we could use a fair
coin to model an unfair coin with any
given probability p of heads.
24) 2n objects of each of three kinds
are given to two persons, so that each
person gets 3n objects. Show that this
can be done in 3n2 + 3n + 1 ways.
Teaching Notes: The key to both this question and the last is that we’re trying to use
the item we have to produce a desired number of outcomes in which the probability is
the same, and ignoring the excess events. For Q21, we managed to find 6 events with
equal probability so that we could simulate a fair coin. And we managed the same for
Q22.
We need some way of constructing a probabilistic process in which the probability of
each event is (1/2)k. Suppose we throw a fair coin repeatedly until we see a tails. If
we’ve thrown the coin k times, then the probability is just (1/2)k.
Classic Problem
If we want to construct a process in which we model a unfair coin with probability of
heads being 0.101 = 1/2 + 1/8 for example, then we can do this by throwing our fair
coin and announcing “Heads” if the first tails on our fair coin either appears on the first
throw OR appears on the third throw, which gives the desired probability.
In general, we throw our fair coin until we see a tails, note how many times k we’ve
thrown the coin, then look at the kth digit of the binary representation of our unfair
coin’s probability. If the digit is a 1, we announce “Heads”, otherwise we announce
“Tails”.
It’s best to see what happens with a small example. Note that if we choose the 3n
objects for one person, the other person’s objects are determined (by whatever’s left).
This means we only need to consider the number of ways one person can have 3n
objects. Let’s consider the possible numbers of each object when n = 4:
Type 1
4
4
4
3
Type 2
2
1
0
3
Type 3
0
1
2
0
Type 1
1
1
1
1
Type 2
4
3
2
1
Type 3
1
2
3
4
41
3
3
3
2
2
2
2
2
2
1
0
4
3
2
1
0
1
2
3
0
1
2
3
4
0
0
0
4
3
2
2
3
4
The numbers of ways for each quantity of the first type of object is 3, 4, 5, 4, 3. More
generally, we can see by observation it’ll be a symmetrical: (n+1) + (n+2) + … +
(n+(n+1)) + … + (n+2) + (n+1). If we look at the arithmetic sequence for the first half of
this sum (excluding the biggest value in the middle), by use of the appropriate formula
25) How many sets of 3 numbers each
can be formed from the numbers {1, 2,
3, …, 20} if no two consecutive
numbers are to be in a set?
26) How many orderings are there for
a deck of 52 cards if all the cards of the
same suit are together?
we get
. For the second half we get the same, giving us n(3n+1) in total so far.
The middle term is 2n+1. So in total we have 3n2 + 3n + 1.
Note first that a ‘set’ only contains distinct items.
Just consider this problem in the same way as those where we avoid putting items
together in a line. By the same principle, start with 17 ordered ‘slots’ to put the
numbers not into the set in. Then there’s 18 places in which we could insert the 3 slots
in which numbers in the set will go (in between the numbers not in the set or at either
end). There’s
ways of choosing these places. At this point, we don’t need to
consider possible arrangements of numbers in the ‘in set’ and ‘not in set’ slots,
because our numbers are ordered. That gives
ways.
Teaching points: Highlight the link with question 6 and 9 in the warm up questions.
The only difference is that all items are ordered.
Another typical “give the slots a category then arrange the items of each category”
question. If all the clubs, spades, diamonds and hearts are together, then we have 4
simple blocks of suits. There’s 4! ways of ordering these four suits in the pack. Once
we’ve determined which card is which suit, then there’s 13! ways of arranging all the
clubs, 13! ways of arranging the spades, etc. That gives: 4!(13!)4
42
27) (a) You start at the point (0,0) and
want to move to the point (n,n). At
each step you can move 1 unit right or
up only. How many ways are there of
getting to the destination?
(b) Since we know that all paths must
cross one (and only one) point on the
diagonal line between (0,n) and (n,0),
show that the identity
holds.
(a) If we’re moving n squares across and n squares up (and we’re only allowed to move
right and up), then the path length will be 2n squares. We know that n of these
movements will be right movement, and n of these up movements. If we have 2n
ordered slots to put movements in, there’s
ways to choose the slots the n right
movements go in.
Classic Problem
(b) Each of the diagonal points have the form (k, n-k). Consider the number of paths
between (0,0) and (k,n-k), and then the number of paths between (k,n-k) and (n,n). It
takes k+(n-k) = n movements to get to from (0,0) to (k,n-k), and k of these movements
are right movements, so there’s
paths. Similarly, there’s n movements from (k,n-k)
to (n,n) of which k are up movements. So there’s again
paths. So the total number
of paths between (0,0) and (n,n) that go through the halfway point (k,n-k) is
. Since
we know that (i) all the paths from (0,0) to (n,n) must go through one of the points,
and that also a path can only go through one of these diagonals, it’s valid to just add
the number of paths that go through each of the diagonals. i.e.
28) How many squares (of any size) are
there in a grid of (n x n) squares?
29) How many rectangles (of any size)
are there in a grid of (n x n) squares?
.
See http://www.proofwiki.org/wiki/Sum_of_Squares_of_Binomial_Coefficients
There’s n2 squares of unit width, (n-1)2 squares of size 2, and so on, until we have
(n-(n-1))2 = 1 big square of size n (i.e. the entire grid). The sum of the first n square
numbers (using the standard formula) is
.
The number of rectangles width w and height h is (n-w+1)(n-h+1) given we can slide
the rectangle down from the top by n-h squares and similarly across.
Then when we consider all sizes of rectangles:
Classic Problem
Classic Problem
43
30) How many triangles (of any size)
are in the pictured shape, when there
are n triangles at the base of the big
triangle?
The second line was because you can see in the first line that as w varies from 1 to n,
(n-w+1) varies from n to 1, and similarly for h; this is the same summation, but just
reversed. The third line is achieved by factoring out w, the fourth just by then factoring
out the inner sum, and the last line by using the general formula for the sum of 1 to n.
It’s best to split this problem into finding triangles pointing up of different sizes, then
those pointing down of different sizes:
Classic Problem
Pointing up: By trying a few low values of n, we can quickly see that the number of
triangles of size 1 is the nth triangular number, the number of triangles of size 2 is the
(n-1)th triangular number, until we get to the biggest triangle of size n, of which there
is only 1. We’re adding the first n triangular numbers (known as the nth tetrahedric
number, because we can stack the increasingly small triangles to form a tetrahedron):
the formula for this (which I looked up!) is
Pointing down: This is harder, because the new largest down triangle only appears for
even numbers of n. We’re therefore going to have to find two formulas: one for even
n, and one for odd n.
For odd n, I got 0, 3, 10+3 and 21+10+3 triangles for n=1,3,5,7 respectively. Since the
formula for a triangular number is quadratic, and we seem to have some sums of
alternating triangular numbers here, we can be confident that the formula we want
will be cubic. By substituting n=1,3,5,7 into an3 + bn2 + cn + d, we get the following
simultaneous equations:
a+b+c+d=0
27a + 9b + 3c + d = 3
125a + 25b + 5c + d = 13
44
343a + 49b + 7c + d = 34
Solving gives us a = (1/12), b = (1/8), c = -(1/12), d = -(1/8).
We repeat this process for even n to find another cubic formula.
The total number of triangles is then (by adding up and down triangles):
31a) How many ways are there of
arranging n distinct beads on a
bracelet with a capacity of k beads
(where k n and k > 2)?
31b) How many ways are there of
arranging: 4 red beads and 4 yellow
beads on a bracelet.
If we initially consider all the ways of arranging the n beads into the k bead slots, we
simply get nPk. But we can rotate the bracelet k times. So for each k possibilities there is
only 1 distinct case. Similarly, we could flip the bracelet over to yield a different
arrangement, so we eliminate half the cases.
This gives us nPk / 2k.
This question is more difficult than the sisters in a circle question because (a) each of
the red beads is indistinguishable, as with the yellow beads and (b) while before the
seats were ordered and distinguishable, here the bracelet can be rotated and flipped
to yield the same arrangement.
Classic Problem
Classic Problem
However, like the strategy adopted with various previous problems, we place the
objects of one type first and then see how we can arrange the remaining objects
around them. Let’s say we put the 4 red beads on the necklace first. We have 4 slots
between these red beads in which we can insert our yellow beads.
We could either put 1 yellow bead in each of the four slots, or put 2 yellow beads
together and another 2 beads together elsewhere, and so on. We’re effectively
therefore finding the number of partitions of 4 yellow beads, and then considering how
the components of each partition can be divided into the 4 slots such that we account
for rotation and reflection. For 4 = 2+2 for example, representing two clusters of 2
yellow beads, they could either appear in opposite slots (2 + 0 + 2 + 0, yielding
45
31c) How many ways are there of
arranging: 5 red beads and 5 yellow
beads on a bracelet.
YYRRYYRR) or in adjacent slots (2 + 2 + 0 + 0, yielding YYRYYRRR).
This gives 8 possible arrangements of yellow beads between the red ones: (4 + 0 + 0 +
0), (3 + 1 + 0 + 0), (3 + 0 + 1 + 0), (2 + 2 + 0 + 0), (2 + 0 + 2 + 0), (2 + 1 + 1 + 0), (2 + 0 + 1
+ 0) and (1 + 1 + 1 + 1). The first of these represents all red and yellow beads clustered
together. The last represents the red and yellow beads alternating.
We might at this point wonder if there’s some nice closed-form solution that doesn’t
involve a summation. Alas there is not.
The problem in general however of assigning up to m colours to beads of an n-bead
necklace (known as a m-colouring) is a well studied problem in combinatorics. For our
example here, we want to fix the number of each colour of bead rather than leave
these quantities unconstrained.
This Wikipedia article discusses the problem in general and the formula required. It’s
something to potentially investigate and would make good university personal
statement fodder: http://en.wikipedia.org/wiki/Necklace_%28combinatorics%29 By
‘strings’, the article is referring to possible sequences of beads. And by ‘alphabet’, it
means the different colours of beads. To find out more about these kinds of problems
in general, you’d need to look up cyclic groups, Burnside’s Lemma, and Polya
enumeration methods.
I’ve been careful to use the term ‘bracelet’ here, because in combinatoric terms
‘necklace’ usually counts the ways of arranging beads in a circle when observed a
particular way up (e.g. when hanging around a neck!), and ‘bracelet’ considers
arrangements as the same when you flip it over. Using the method in (b), I found the
following number of ways for each partition:
Partition of 5
5
4+1
3+2
3+1+1
Ways
1
2
2
3
Partition of 5
2+2+1
2+1+1+1
1+1+1+1+1
Ways
3
2
1
Which gives 14 ways in total.
46
Senior Maths Challenge
Level 2
1
2
Question
The engineering company, Sparks and Tensor, has a complicated
system of conveyor belts in its factory. Components must travel
along these belts in the directions shown by the arrows.
B
C
A
E
F
D
How many different routes are there from A to F along the
conveyor belts?
A
4
B
5
C
6
D
7
E
8
How many numbers from 12 to 12345 inclusive have digits which
are consecutive and in increasing order, reading from left to
right?
A
10
B
13
C
18
D
22
E
25
Solution
Answer B
Point F must be reached directly from B, C or E. There is one route
from A to B, one route from A to C, and there are three routes from A
to E. So the number of possible routes is 1 + 1 + 3 = 5.
Ref
2003 Q6
Answer D
There are eight 2-digit numbers which satisfy the required condition
(12, 23, … , 89), seven 3-digit numbers (123, 234, … , 789), six 4-digit
numbers (1234, 2345, … , 6789) and one 5-digit number (12345).
2004 Q9
Solution
Answer D
The number of different arrangements of the four cards which are
dealt is 4 × 3 × 2 × 1 = 24. In only one of these will the four cards be
in descending order.
Ref
2002 Q13
Level 3
1
Question
The cards in a set of 36 are numbered 1 to 36. The cards are
shuffled and four cards are dealt.
What are the chances of them being dealt in descending
order?
A
1 in 2
B 1 in 8
C
1 in 16 D 1 in 24
E
1 in 36
47
Level 4
1
Question
In how many different ways can I circle letters in the grid shown so
that there is exactly one circled letter in each row and exactly one
circled letter in each column?
A
D
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
15
100
B
E
24
120
C
Solution
Answer E
In the first row, any one of 5 letters could be circled. In the second
row, any one of 4 letters could be circled since one column has
now been occupied. Similarly, in the third row, any one of three
letters could be circled and so on. The number of different ways is
therefore
5 × 4 × 3 × 2 × 1 = 120.
Ref
1999 Q11
60
2
A hockey team consists of 1 goalkeeper, 4 defenders, 4 midfielders
and 2 forwards. There are 4 substitutes: 1 goalkeeper, 1 defender, 1
midfielder and 1 forward. A substitute may only replace a player of
the same category eg: midfielder for midfielder.
Given that a maximum of 3 substitutes may be used and that there
are still 11 players on the pitch at the end, how many different
teams could finish the game?
A
110
B
118
C
121
D
125
E
132
Answer B
Firstly, we note that of the players on the pitch at the end of the
game, the goalkeeper is one of two players; the four defenders
form one of five different possible combinations, as do the four
midfielders, and the two forwards form one of three different
possible combinations. So, if up to four substitutes were allowed,
the number of different teams which could finish the game would
be 2 × 5 × 5 × 3, that is 150.
From this number we must subtract the number of these teams
which require four substitutions to be made. This is 1 × 4 × 4 × 2,
that is 32, so the required number of teams is 118.
2005 Q16
3
The diagram shows five discs connected by five line segments. Three
colours are available to colour these discs.
In how many different ways is it possible to colour all five discs if
discs which are connected by a line segment are to have different
Answer D
2006 Q13
48
E
colours?
C
A
D
A
D
3
6
36
B
E
12
48
C
30
The year 1789 (when the French Revolution started) has three and
no more than three adjacent digits (7, 8 and 9) which are
consecutive integers in increasing order.
How many years between 1000 and 9999 have this property?
A
130
B
142
C
151
D
169
E
180
B
Disc A may have any one of three colours and, for each of these,
disc B may have two colours. So these two discs may be coloured
in six different ways. If discs C and D have the same colour, then
they may be coloured in two different ways and, for each of these,
disc E may have two colours. So the discs may be coloured in 24
different ways if C and D are the same colour. However, if discs C
and D are different colours, then C may have one of two colours,
but the colours of discs D and E are then determined. So the discs
may be coloured in 12 different ways if C and D are different
colours. In total, therefore, the discs may be coloured in 36
different ways.
Answer A
There are 9 years of the form 123n as n may be any digit other
than 4. Similarly, there are 9 years each of the forms 234n, 345n,
456n, 567n, and 678n, but 10 years of the form 789n as, in this
case, n may be any digit. There are also 9 years of the form n 012
and 9 of the form n123, as in both cases n may be any digit other
than 0. However, there are 8 years of the form n234 as in this case
cannot be 0 or 1. Similarly, there are 8 years each of the forms
n345, 456, n567, n678 and n789.
So the total numbers of years is 1 × 10 + 8 × 9 + 6 × 8 = 130.
2007 Q18
49
Level 5
Question
A postman's sack contains five letters, one each for the five houses in
Cayley Close.
Mischievously, he posts one letter through each door without looking
to see if it is the
correct address.
In how many different ways could he do this so that exactly two of the
five houses receive the correct letters?
A
5
B
10
C
20
D
30
E
60
Solution
Answer C
Let the letters be p, q, r, s, t and the corresponding houses be P, Q,
R, S, T. The number of ways of correctly putting in two letters is
5!
10 . For the third letter, there are just two wrong choices
2!3!
and then the others are fixed. (If p, q have been correctly
delivered, then clearly r can go to S or T. If r is put to S then t must
go to R and s to T. If r is put to T then t must go to S and s to R.) So
there are just 2 × 10 = 20 ways.
Ref
2001
Q21
2
Given an unlimited supply of 50p, £1 and £2 coins, in how many
different ways is it
possible to make a sum of £100?
A
1326 B
2500 C
2601
D
5050 E
10 000
Answer C
To count the number of ways, it is necessary to have a structure.
One strategy is to consider the number of £2 coins and then £1
coins; the balance can be made up with 50p coins.
Number of £2 coins
50
49
48
…
0
Maximum number of £1 coins 0
2
4
…
100
Ways 1
3
5
…
101
1
Total ways = 1 + 3 + 5 + … + 101 = 2 × 51(1 + 101) = 51 × 51 = 2601
2003
Q22
3
A bracelet is to be made by threading four identical red beads and
four identical yellow beads onto a hoop.
How many different bracelets can be made?
A
4
B
8
C
12
D
18
E
24
Answer B
In this solution, the notation p / q / r / s / … represents p beads of
one colour, followed by q beads of the other colour, followed by r
beads of the first colour, followed by s beads of the second colour
etc.
Since the colours alternate, there must be an even number of
these sections of beads. If there are just two sections, then the
necklace is 4/4 and there is only one such necklace. If there are
four, then each colour is split either 2, 2 or 3, 1. So the possibilities
2007
Q21
1
50
are 2/3/2/1 (which can occur in two ways, with the 3 being one
colour or the other) or 2/2/2/2 (which can occur in one way) or
3/3/1/1(also one way). Note that 3/2/1/2 appears to be another
possibility, but is the same as 2/3/2/1 rotated.
If there are six sections, then each colour must be split into 2, 1, 1
and the possibilities are 2/2/1/1/1/1 (one way) or 2/1/1/2/1/1
(one way). Finally, if there are eight, then the only possible
necklace is 1/1/1/1/1/1/1/1. In total that gives 8 necklaces.
51
British Maths Olympiad Solutions
Important Initial Teaching Note: Some of these questions highlight the huge advantage of being familiar with a broad range of strategies for a
particular field of problems. Some questions required identifying a recurrence relation in a similar way to say the frog question in Q1, and
many use similar principles, or even make direct use well-known combinatoric problems. Practicing these kinds of problems gradually builds up
an intuition to look at these kinds of problems and quickly envisage the potential strategies that may help in solving the question.
One final tip: Sometimes (where possible), dealing with a smaller version of the problem can help spot the pattern.
One legal related notice: While model solutions can be purchased online for BMO problems, I have not looked at these. All solutions are my
own.
1
Question
Isaac has a large supply of counters, and places
one in each of the 1 x 1 squares of an 8 x 8
chessboard. Each counter is either red, white or
blue. A particular pattern of coloured counters is
called an arrangement. Determine whether there
are more arrangements which contain an even
number of red counters or more arrangements
which contain an odd number of red counters.
Note that 0 is an even number.
Solution
JAF’s solution: A sensible first starting step is to solve the problem for a
reduced case, for example a 2 x 2 board. We get the following analysis:
Number of
red counters
Combinations of
non-red counters
Ways of this number of red
counters being arranged
0
24
16
1
23
32
2
22
24
3
21
8
4
20
1
Ref
2010
Total
That gives us 32 + 8 = 40 arrangements for an odd number of red counters,
and 16 + 24 + 1 = 41 arrangements for an even number counters. Do we
again get more arrangements with even numbers of red counters for an 8 x
8 board?
52
Looking at the pattern of these rows, we could always try some other
smaller instances which don’t necessarily have to be for a square number of
board squares. For example for just two squares, by the same approach we
get 5 arrangements for even numbers of red squares and 4 for odd.
By this point, you might have spotted that we always have one more even
arrangement than we do odd arrangements. More specifically, we have 3n
arrangements in total (if there’s n squares on the board),
even
arrangements and
odd arrangements.
We now have the answer (and this may well get full marks in the exam), but
we haven’t technically proven this is always the case. We may want to prove
that
and that when we sum for even and odd values of i
we get
and
how this might be done.
respectively. You may wish to research
Key generic points for solving questions like this:
We solved a smaller version of the problem to try and identify the
pattern.
We used combinatoric analysis to work out the number of
arrangements for each number of red counters.
By studying a few extra small examples, we could identify the
pattern in the final number of arrangements for odd and even red
counters.
2
Consider a standard 8 x 8 chessboard consisting
of 64 small squares coloured in the usual pattern,
so 32 are black and 32 are white. A zig-zag path
across the board is a collection of eight white
squares, one in each row, which meet at their
corners. How many zig-zag paths are there.
JAF’s solution: I formed a recurrence relation, where the number of moves
for each square for the nth row is in terms for the number of moves for each
square in the (n-1)th row. Taking first the base case of the 1st row, as well as
the 2nd row:
1
1
1
1
2
2
2
2008
1
53
Similarly to the frog problem, we can see that the number of paths from the
2nd row is simply the sum of the number of paths of the two diagonal
squares in the next row. It’s valid to add them because we certainly know
the two diagonal squares each have unique paths, and that creating new
paths from them by appending the current square on the front of each path
sequence generates a new unique path (i.e. we’ve avoided creating
duplicate paths). For squares at the edge of the table, we just use the
number of paths in the diagonal square (almost imagining there’s a ‘0’
diagonally off the edge of the table).
Filling the entire board using this recurrence, we get:
1
1
1
2
3
3
7
2
6
14
29
54
89
2
8
25
1
4
15
35
35
2
4
10
10
1
6
20
49
103
20
69
Adding together all the paths from each of the bottom squares, we get 296
paths.
I checked my answer online (partly because my experience tells me that
solving a problem too quickly means that I’ve probably missed some kind of
catch), and found some interesting discussion in terms of generalising the
problem: http://www.polyomino.org.uk/publications/2008/bmo1-2009q1.pdf
To summarise the generic strategy if you see problems like this in future:
Identify if the problem has some kind of recurrence formula. This
can sometimes be identified by considering smaller versions of the
problem.
Start with the values for the base case(s) and build up your values
54
from there. Programmers will recognise this approach as a ‘dynamic
programming’ approach (see below) to recursive problems.
3
4
Extra Teaching Note: Given this is a recurrence problem, mathematicians
who are also enthusiastic programmers may want to write a program which
generates all paths using the dynamic programming paradigm (i.e. starting
generating smaller paths from the top of the board rather than recursively
from the bottom of the board, which would repeat a lot of work).
The number 916238457 is an example of a nineJAF’s solution: Again, simple if you’re well-practiced at arrangement
digit number which contains each of the digits 1
problems involving distinct items in a line, with the potential for some very
to 9 exactly once. It also has the property that the quick marks (you have over 30 minutes per question on average in the BMO
digits 1 to 5 occur in their natural order, while the – with practice questions like this won’t take you more than a couple of
digits 1 to 6 do not. How many such numbers are minutes).
there?
One way is to start with the 1 2 3 4 5 in that order. We want to now insert
the other numbers into the sequence. We can insert the number 6 in five
different places such that it doesn’t come after the 5. We have
of then
picking six out of the nine number slots to put these numbers in. Finally, we
have 3! arrangements of the 7, 8 and 9 into the three remaining slots.
That gives
The seven dwarfs walk to work each morning in
single file. As they go, they sing their famous
song, “High - low - high -low, it’s off to work we
go . . . ”. Each day they line up so that no three
successive dwarfs are either increasing or
decreasing in height. Thus, the line-up must go
An alternative strategy is to start by inserting the 9 into the sequence (which
can go in 9 places), then the 8 (which can go in 8 of the remaining places),
then the 7 (in 7 places). The 6 is not allowed to go in the last slot of the
remaining places, so there’s 5 places it can go. Then the other numbers are
fixed because 1 to 5 have to be ordered.
That gives
.
Not yet attempted, but this is known as an ‘Alternating Permutation’, where
the magnitudes of the items form a zigzag pattern.
http://mathworld.wolfram.com/AlternatingPermutation.html
The number of alternating permutations is known as a Euler Zigzag Number:
http://mathworld.wolfram.com/EulerZigzagNumber.html
2006
1995
55
5
up-down-up-down- · · · or down-up-down-up- · · ·
. If they all have different heights, for how many
days they go to work like this if they insist on
using a different order each day? What if Snow
White always came along too?
(a) Determine, with careful explanation, how
many ways 2n people can be paired off to form n
teams of 2.
(b) Prove that {(mn)!}2 is divisible by
(m!)n+1(n!)m+1 for all
positive integers m, n.
a) This was Q19 in the ‘General Questions’. The answer was
b) JAF’s solution: I used induction!
Base case: Let m=n=1. Then 1!2 =1 is divisible by 1!21!2 = 1.
Inductive case: Suppose that for a given m and n that {(mn)!}2 is divisible by
(m!)n+1(n!)m+1. Then we need to show it’s also true for m+1 and n (and we’d
have to show it’s also true for m and n+1, allowing us to get all pairs of
integers, although this will be the same by symmetry).
1995 Round 2
{[(m+1)n]!}2 = {(mn + n)!}2 = {(mn)!}2 x (mn + 1)2 x (mn+2)2 x ... x (mn + n)2.
We need to show that this is divisible by (m+1)!n+1(n!)m+2, i.e. that it is
divisible by (m+1)!n+1, and is divisible by (n!)m+2.
Let’s start with the latter, where we’re showing it’s divisible by (n!)m+2 =
n!(n!)m+1 . We can see in the expansion that {(m+1)n!}2 has a factor of (n!)m+1
, so we’re now just trying to find a factor of n! within the remaining factors
of {(m+1)n!}2. These remaining factors are a sequence of n integers
multiplied together (each squared). At least one of them must therefore
have factors for each of the numbers 1 to n. So n! must divide all (mn + 1)2 x
(mn+2)2 x ... x (mn + n)2 combined.
(This is where I got a bit stuck – Come back later) Next we have to show the
former, that {[(m+1)n]!}2 is divisible by (m+1)!n+1 = (m+1)n+1m!n+1 [by using
the recursive definition of the factorial function]. It’s divisible by m!n+1 by
induction due to the earlier expansion of {(m+1)n!}2, so we now just have to
show it’s also divisible by (m+1)n+1...
56
6
The Dwarfs in the Land-under-the-Mountain have
just adopted a completely decimal currency
system based on the Pippin, with gold coins to
the value of 1 Pippin, 10 Pippins, 100 Pippins and
1000 Pippins. In how many ways is it possible for
a Dwarf to pay, in exact coinage, a bill of 1997
Pippins?
JAF’s solution: I don’t really see this as differing much from similar questions
of this form that appear on SMC papers from time to time, involving making
up a given quantity with certain coins (although usually there’s one type of
coin less).
1997
First note that we don’t need to consider the number of gold coins with
value 1 Pippin, as these are fixed by whatever quantity of the other coins we
have (e.g. if we were just making up 12 Pippins, then it’s clear there’s only 2
ways we make this up, as we can have a 10 Pippin coin and make the rest up
with 1s, or no 10 Pippin coins and make the rest up with 1s). It allows us to
focus on the number of 1000, 100 and 10 Pippin coins that give us amounts
less than 1997.
First take the case where there IS a 1000 Pippin coin. This table considers
the number of 100 Pippin coins we might have, and therefore the range of
quantities of 10 Pippin coins we have:
Num 1000
1
1
...
1
Num 100
0
1
Num 10
0 to 99
0 to 89
Total ways
100
90
9
0 to 9
10
That give us 100 + 90 + ... + 10 ways = 10(10 + 9 + 8 + ... + 1) = 10([10 x 11]/2)
= 550 ways (using the standard formula for the sum of 1 to n to get this total
quickly).
We can do the same when we don’t have a 1000 Pippin coin:
Num 1000 Num 100 Num 10
Total ways
0
0
0 to 199 200
0
1
0 to 189 190
...
0
19
0 to 9
10
57
Which gives us 200 + 190 + ... + 10 = 10[20 + 19 + ... + 1] = 10([20 x 21]/2) =
2100 ways.
7
A booking office at a railway station sells tickets
to 200 destinations. One day, tickets were issued
to 3800 passengers. Show that (i) there are (at
least) 6 destinations at which the passenger
arrival numbers are the same; (ii) the statement
in (i) becomes false if ‘6’ is replaced by ‘7’.
This gives 2650 ways in total.
JAF’s solution: First note that the average number of tickets to each
destination is 19. When I first saw this question, my immediate initial
intuition was that I in some way had to use the pigeonhole principle. I use
each ‘pigeon hole’ to represent a quantity of passengers and letters to
represent each railway destination. So to put a “Euston” letter in the “355”
pigeon hole for example means that 355 passengers have bought tickets for
Euston. The number of letters in a pigeon hole, say with number 35, is
therefore represents the number of stations where 35 people have bought
tickets to that station.
1998 Round 2
We want to distribute letters to pigeon holes in a way which minimises the
largest number of letters in a given pigeon hole, because this therefore
minimises the number of stations with the same number of passengers. Our
strategy is to try and spread our letters into as many pigeon holes as
possible. We could do this by putting one letter in each of the pigeon holes 0
to 38 first. This ensures the average passengers at each station is 19, while
using a large spread of passenger quantities for each station. We can’t do
better than this, because if we used a quantity of passengers at a station of
greater than 38, then we’d have to have more letters in the 0-18 range to
keep the average down, resulting in a greater concentration of letters in this
range.
The sum of 0 to 38 is 741 (again using the standard formula for the sum of 1
to n). So each time we put one letter in each of the 0-38 pigeon holes, we
have 741 passengers accounted for. If we continue putting 1 letter in each of
these pigeon holes, once we have 5 letters in each, we have 3705
passengers accounted for, leaving 95 tickets. We then spread these out over
the remaining pigeon holes, say for example 17, 18, 19, 20 and 21. These
five quantities will have 6 stations with this quantity, while all other pigeon
58
holes will have 5 stations with this quantity. So one pigeon hole must have
at least 6 letters, and thus at least 6 stations must have the same quantities
of passengers.
8
The seven dwarfs decide to form four teams to
compete in the Millennium Quiz. Of course, the
sizes of the teams will not all be equal. For
instance, one team might consist of Doc alone,
one of Dopey alone, one of Sleepy, Happy &
Grumpy, and one of Bashful & Sneezy. In how
many ways can the four teams be made up? (The
order of the teams or of the dwarfs within the
teams does not matter, but each dwarf must be
in exactly one of the teams.) Suppose SnowWhite agreed to take part as well. In how many
ways could the four teams then be formed?
(ii) We’ve already answered this. We’ve found a way in which the maximum
number of letters in a pigeon hole can be 6.
JAF’s solution: I encountered a similar problem to this in my teaching
experiences at Oxford. I was giving classes for a masters course called
‘Information Retrieval’, where we went through problem sheets set by the
lecturer. One aspect of the theory was how we could determine different
topics such as “sport” and “music” for different documents, based on
properties that related these documents. By treating the document as
coordinates (where the dimensions for example could be different counts of
words), documents could then be ‘clustered’ into groups based on how close
these points were, and subsequently a group could represent some ‘topic’.
2000
How points (representing
documents say) would be
‘clustered’ into 3 clusters.
One question on the problem sheet was how many possible ‘clusterings’
there were of n documents into k topics, meaning the number of ways of
59
assigning each of the k topics to the documents. The answer sheet I had
been provided with actually had the incorrect answer: kn / k!, the argument
being that each of the n documents had k possible clusters it could belong
to, and we had to divide by k! because the ordering of these clusters did not
matter (i.e. assuming the clusters are unlabelled).
There’s two reasons why this answer is wrong. Firstly, it’s clear in general
that k! usually does not divide kn, since the numerator only has factors of k,
whereas the denominator has other factors if k>2. So this couldn’t possibly
be correct. Secondly, the conceptual problem is that some of the clusters
could be empty. kn includes for example possibilities where all the points
have been labelled with the same cluster, which would mean that the other
clusters contain no points, and thus the case is invalid.
With our dwarves problem, it would similarly be incorrect to say that the
answer is 47/4!, where we’re saying each of the dwarves could be assigned
to 4 different teams, before dividing by 4! to say that the ordering of the
teams does not matter.
So how then can we do it? There’s a few different ways, but my strategy was
to consider possible capacities of each team, and then to assign dwarves to
teams of these capacities:
For example, one team might have 4, and each of the remaining teams
would just have 1 member. Or we could have 3 on one team, 2 in another
and 1 in the remaining two (as in the example provided in the question). The
possible quantities are 4+1+1+1, 3+2+1+1 and 2+2+2+1.
Suppose for the moment that the teams are distinguishable, so that we call
them Teams A, B, C and D. For 4+1+1+1, there’s 4 ways in which these four
team quantities could be assigned to the 4 teams. For 3+2+1+1, there’s 12
ways. And for 2+2+2+1 there’s 4 ways.
Once we’ve got the size of each team, then we can actually put players into
teams! If say Team A has size 4 and the other teams size 1, then team
labelling of dwarfs might be AAAABCD or AAABACD and so on. We know
60
from Q4 in the ‘General Questions’ set that there’s 7!/4! possible
assignments of dwarves to teams of these capacities (i.e. the ordering of the
dwarves inside the team does not matter). This table covers all these
possibilities:
Team Sizes
Num ways in which
capacities could be
assigned to teams
Num ways in which
dwarves can be assigned to
teams of this capacity.
Total
4+1+1+1
4
7!/4! = 210
840
3+2+1+1
12
7!/3!2! = 420
5040
2+2+2+1
4
7!/2!2!2! = 630
2520
That gives a total of 8400 assignments. But as stated, the ordering of teams
does not matter, e.g. AABBCCDDA is equivalent to BBCCDDAAB. So for each
unique assignment we would have seen 4! labellings. 8400 / 4! = 350 ways.
What if Snow White got involved? Adjusting our table:
9
Twelve people are seated around a circular table.
In how many ways can six pairs of people engage
in handshakes so that no arms cross? (Nobody is
allowed to shake hands with more than one
person at once.)
Team Sizes
Num ways in which
capacities could be
assigned to teams
Num ways in which
dwarves can be assigned to
teams of this capacity.
Total
5+1+1+1
4+2+1+1
3+3+1+1
3+2+2+1
2+2+2+2
4
12
6
12
1
8!/5! = 336
8!/4!2! = 840
8!/3!3! = 1120
8!/3!2!2! = 1680
8!/2!2!2!2! = 2520
1344
10080
6720
20160
2520
giving a total of 40824. And when accounting for the lack of ordering in
teams, we get 40824 / 4! = 1701. Dwarftastic.
JAF’s solution: Perhaps one of my favourite questions on this topic!
By sketching out a 12-agon, I could quickly see that a person could only
shake someone’s hand if there are an even number of people to the left and
right of his shake (since those on his left-hand-side can’t shake hands with
those on his RHS because the shakes would crossover, and if there’s an odd
number of people to one side of them, then they can’t all be paired). So a
2001
61
given person can shake hands with the person 1 to his left, or 3 to his left, or
5 to his left, or 7 to his left, or 9 to his left, or 11 to his left. For each of these
cases, we’ve essentially reduced the problem into two equivalent ones
smaller in size: As indicated on the diagram, if for example he shakes the
hand with the person 3 to his left, then there’s 2 people to the left of his
handshake who can shake hands in different ways (obviously only 1 way),
and independently 8 people to the right of his handshake who can shake
hands in a circle-like arrangement.
Handshake
People to RHS
of shake. An
equivalent
problem of
size 8.
People to LHS
of shake. An
equivalent
problem of
size 2.
This gives us the recurrence relation (where i represents the number of
people to the left of someone’s shake):
That is, we focus on a particular person, consider different numbers of
people he might have to the left of his shake (which might be 0, if they shake
the hand of the person immediately to their left), and we can then consider
the possibilities independently of possible shakes of people to their left and
62
people to their right.
F(2) = 1, since if there’s 2 people there’s only one possible way they can
shake! But we could make our base case F(0) = 1, because then our
recursion relation works (since if we have 0 people to the left and 10 to the
right say, that we want to make sure F(0)F(10) = F(10), i.e. we would just
consider arrangements to the right.
We can then work out F(12):
F(4) = F(0)F(2) + F(2)F(0) = 1x1 + 1x1 = 2 (which by observation we
can see is correct).
F(6) = F(0)F(4) + F(2)F(2) + F(4)F(0) = 1x2 + 1x1 + 2x1 = 5
F(8) = F(0)F(6) + F(2)F(4) + F(4)F(2) + F(6)F(0) = 1x5 + 1x2 + 2x1 + 5x1
= 14
F(10) = F(0)F(8) + F(2)F(6) + F(4)F(4) + F(6)F(2) + F(8)F(0) = 1x14 + 1x5
+ 2x2 + 5x1 + 14x1 = 42
F(12) = F(0)F(10) + F(2)F(8) + F(4)F(6) + F(6)F(4) + F(8)F(2) + F(10)F(0)
= 1x42 + 1x14 + 2x5 + 5x2 + 14x1 + 42x1 = 132
So the answer is 132 ways.
10
A set of positive integers is defined to be wicked
if it contains no three consecutive integers. We
count the empty set, which contains no elements
at all, as a wicked set. Find the number of wicked
subsets of the set {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}.
By putting these numbers into www.oeis.org , I discovered that these are in
fact the Catalan numbers http://en.wikipedia.org/wiki/Catalan_numbers,
numbers I had encountered in other combinatorial contexts, but not this
one! The Wikipedia article contains this specific example (although
presented more geometrically).
Not yet attempted.
2003/04
63
11
Adrian teaches a class of six pairs of twins. He
wishes to set up teams for a quiz, but wants to
avoid putting any pair of twins into the same
team. Subject to this condition: i) In how many
ways can he split them into two teams of six? ii)
In how many ways can he split them into three
teams of four?
12
In the land of Hexagonia, the six cities are
connected by a rail network such that there is a
direct rail line connecting each pair of cities. On
Sundays, some lines may be closed for repair. The
passengers’ rail charter stipulates that any city
must be accessible by rail from any other (not
necessarily directly) at all times. In how many
different ways can some of the lines be closed
subject to this condition?
i)
Team 1 must contain one person from each of the pairs of twins.
There’s 2 ways in which we can pick a person from each pair, so
26 ways in total of picking people for Team 1. But we have to
consider duplicates – had all the people in Team 1 actually been
in Team 2 instead, it would have been considered the same
arrangement (i.e. the teams themselves are indistinguishable
even if the people in each team are obviously distinguishable).
So that gives 25 = 32 ways.
ii)
There’s
ways of choosing the pairs for which we’re
going to use 1 person from each to form Team 1. From each pair
we can choose one twin, so that’s 15 x 24 = 240 ways.
For Team 2, we have four individuals, and two pairs left to
choose from. But we have to be careful now, because if we
picked say the 4 individuals to form the next team, we’d have
two pairs of twins left to form the final team, which is not
permitted. We have to ensure therefore that one person from
each of the remaining intact pairs is chosen for Team 2 (22
ways). There’s then
ways in which we can choose from
the individuals to fill up the rest of the team. That gives 22 x 6 =
24 ways.
Team 3 is then fixed because we have 4 people left. So in total
we 240 x 24 = 5760 ways. But again, the teams are
‘indistinguishable’, so we have to divide by 3! to account for the
possible relabellings of teams. That gives 960 ways.
Not yet attempted, but answers can be found here: http://oeis.org/A001187
and http://en.wikipedia.org/wiki/Graph_enumeration
f(5) = 728 and f(6) = 26704
2005/06
2006/07 Round 2
64
13
Isaac attempts all six questions on an Olympiad
paper in order. Each question is marked on a
scale from 0 to 10. He never scores more in a
later question than in any earlier question. How
many different possible sequences of six marks
can he achieve?
JAF’s solution: We can view the problem in a recursive way: If we’re looking
at the last k questions and we got n marks on the previous question, then
we can between 0 and n marks for this question, say i marks, then we’ve got
a similar smaller problem in which there’s k-1 remaining questions and a
maximum mark of i for the first of these. That gives us the recursion
relation:
where the base case is be
2009/10
(because 0 is also a mark!)
We’re looking for F(10, 6). We can construct a table and gradually build the
values up. Soon after I started filling it up, it was clear that
, (which can easily be shown from the recursion
relation above since
) which makes filling the table much easier:
k=1 2
3
4
5
6
n=0
1
1
1
1
1
1
1
2
3
4
5
6
7
2
3
6
10
15
21
28
3
4 10
20
35
56
84
4
5 15
35
70
126
210
5
6 21
56
126
252
462
6
7 28
84
210
462
924
7
8 36 120
330
792 1716
8
9 45 165
495 1287 3003
9
10 55 220
715 2002 5005
10
11 66 286 1001 3003 8008
The answer is therefore 8008 ways.
Note that the second column here is the triangular numbers and the third
column the tetrahedral numbers (see Q30 in the General Questions set for
another example of this).
65
14
A bridge deal is defined as the distribution of 52
playing cards among 4 players, so each player
gets 13 cards each. In a bridge deal, what is the
probability that exactly one player has a
complete suit?
JAF’s (tentative) solution: Imagine the 52 cards in a line, such that the first
13 belong to the first player and so on. There’s clearly 52! ways in total of
arranging the cards.
Now we’re interested in the number of ways in which (exactly) one player
can get the same suit.
1974 Q5
We could start our expression by picking a person to have the full suit, then
picking the suit itself, and then arranging their cards as well as everyone
else’s (in a similar way to which we arranged the red books and non-red
books in the Warmup Questions).
That gives us
.
However, this includes the possibilities that 2 people get a full suit, or even 4
people get a full suit, because when we arranged the 39 cards not belonging
to our chosen person, we didn’t prevent it just happening to give another
person a full suit. We therefore need to deduct the cases in which exactly 2
people get a full suit, as well as the cases where 4 people get a full suit (note
that exactly 3 people obviously can’t get a full suit).
The number of ways of all people getting full suits is as follows: We first
arrange the suits amongst the people in 4! ways (i.e. deciding who has all
clubs, etc.), then consider the arrangements of each persons’ cards. That
gives
ways.
The number of ways of exactly 2 people getting full suits can be found in a
similar way to before. Choose 2 of the people to have full suits, and choose
the two suits for them (where the order of the suits does matter). The
former can be done in
ways and the latter in 4P2 = 12 ways. We then
arrange the two players’ cards separately in
ways and the other
people’s cards in 26! ways. In total that’s
ways.
But this includes the possibilities where all 4 people get full suits, so we
actually have
ways.
66
That gives us the total ways:
ways.
So the probability is:
67
Making effective use of Wolfram Alpha
www.wolframalpha.com is a free online mathematics calculator (amongst other things) that can compute all sorts of calculations that a
calculator could not, in addition to sketching graphs. Here are things you can type in relevant to this topic:
What to type
nCr(4,2)
nPr(4,2)
4^2
4*2
partitions of 4
compositions of 4
compositions of 4 into 2 parts
4!
(n-1)! / n!
sum of nCr(4,i) from i=0 to 4
sum 2^i * nCr(n,i) for i = 0 to n
What it does
Finds
Finds 4P2.
Calculates 42.
* here represents multiplication.
Lists all partitions of 4.
Lists all compositions of 4. (It can’t however seem to do weak compositions)
As you would expect!
4!
Will simplify the expression for you, giving you 1/n
Will calculate the result of a summation (or will attempt to simplify if you’re
summing over an expression involving variable(s)). In this example, it’ll give
you a result of 16.
Identifies just how powerful Wolfram Alpha is! Here, the output will be a
simplified expression in terms of the variable n.
68
© Copyright 2026 Paperzz