Frobenius Coin Problem
Frobenius Coin Problem
Frobenius Coin Problem
These supplementary notes on the Frobenius Coin Problem are intended for school teachers, year 11 or
12 students studying Specialist Mathematics, students who have studied the Noether or Polya books of
the AMT’s Enrichment series, or other interested readers with a strong background in secondary school
mathematics. It is recommended that you first attempt parts (a) to (f) of the introductory activity and
also explore the accompanying linear graphing tool, both available at http://www.amt.edu.au/mathspack.
For further hints and tips, contact mail@amt.edu.au.
We aim to prove that every total of at least 28 cents can be made from a combination of 5c and
8c coins. This statement can be written more formally as follows, where x and y represent the
numbers of each type of coin.
Theorem: For every integer n ≥ 28, there exist non-negative integers x and y such that 5x+8y = n.
Proof: We begin with the observation that the statement is true for all n satisfying 28 ≤ n ≤ 32,
since
28 = 5 × 4 + 8 × 1, 29 = 5 × 1 + 8 × 3, 30 = 5 × 6 + 8 × 0,
31 = 5 × 3 + 8 × 2, 32 = 5 × 0 + 8 × 4.
Next we assume, by strong induction, that for some k ≥ 32, the statement is true for all n satisfying
28 ≤ n ≤ k. We are required to prove that the statement is also true for n = k + 1.
Since k ≥ 32, we have 28 ≤ k − 4 < k, so the statement is true for n = k − 4 by the inductive
assumption. That is, there exist non-negative integers x′ and y ′ such that 5x′ + 8y ′ = k − 4. Letting
x = x′ + 1 and y = y ′ , which are both non-negative, we have
5x + 8y = 5(x′ + 1) + 8y ′
= (5x′ + 8y ′ ) + 5
= (k − 4) + 5
= k + 1,
so the statement is true for n = k + 1. This completes the proof by strong induction. !
Exercise A: Adapt the proof above to show that every total of 50c or more can be made from a
combination of the Eulish 6c and 11c coins.
Here we give an alternative proof based on the following strategy: if you have enough 5c coins,
replace some of them with 8c coins to increase the total value by 1 cent; if you have enough 8c
coins, you can achieve the same effect by replacing some of those instead; if you don’t have enough
of either coin, then not to worry, your total must have been less than the range of values we are
interested in anyway. The precise replacement strategy relies on the values found in part (e) of the
introductory activity.
Theorem: For every integer n ≥ 28, there exist non-negative integers x and y such that 5x+8y = n.
Proof: We begin by observing that the statement is true for n = 28, since 28 = 5 × 4 + 8 × 1.
Next we assume, by induction, that for some k ≥ 28 the statement is true for n = k. That is, there
exist non-negative integers x′ and y ′ such that 5x′ + 8y ′ = k. We are required to prove that the
statement is also true for n = k + 1.
If x′ ≥ 3, then we may let x = x′ − 3 and y = y ′ + 2, so that x and y are both non-negative. Then
5x + 8y = 5(x′ − 3) + 8(y ′ + 2)
= (5x′ + 8y ′ ) − 15 + 16
= k + 1,
so the statement is also true for n = k + 1, as required. (This argument amounts to replacing three
5c coins with two 8c coins, provided there are enough 5c coins available.)
If y ′ ≥ 3, then we may let x = x′ + 5 and y = y ′ − 3, so that x and y are both non-negative. Then
5x + 8y = 5(x′ + 5) + 8(y ′ − 3)
= (5x′ + 8y ′ ) + 25 − 24
= k + 1,
so the statement is also true for n = k + 1, as required. (This is the reverse situation, replacing
three 8c coins with five 5c coins.)
Suppose, on the other hand, that both x′ < 3 and y ′ < 3. Then, given that they are integers, we
have x′ ≤ 2 and y ′ ≤ 2 so that
k = 5x′ + 8y ′ ≤ 5 × 2 + 8 × 2 = 26.
However, this contradicts the inductive assumption that k ≥ 28. (That is, if the total is large
enough, you always have enough 5c or 8c coins available to apply at least one of the replacement
strategies above.) This completes the proof by induction. !
Exercise B: Adapt the proof above to show that every total of 50c or more can be made from a
combination of the Eulish 6c and 11c coins.
2
1.3 Consolidation
Exercise C: Choose two other coin values a and b, with no common factors greater than 1. Exper-
iment to find c, the largest impossible total (it will be less than ab). Use both the ‘adding extra
coins’ and ‘coin replacement’ strategies described above to prove the following result:
For every integer n ≥ c + 1, there exist non-negative integers x and y such that ax + by = n.
In primary or secondary school, you have most likely been introduced to the following strategy
for finding the greatest common divisor (otherwise known as the highest common factor ) of two
positive integers: determine the factorisation of each number as a product of primes (via a factor
tree, for example) and then identify the common primes. For example, 90 = 2 × 3 × 3 × 5 and
24 = 2 × 2 × 2 × 3, so gcd(90, 24) = 2 × 3 = 6.
In practice this method is terribly inefficient. The Euclidean Algorithm provides an alternative
method which does not rely on prime factorisation; in fact, in its simplest form it relies only on
repeated subtraction.
Given positive integers a and b, with a > b, gcd(a, b) is found with the Euclidean Algorithm as
follows:
• Divide a by b, taking note of the quotient q and remainder r, and rewrite the division statement
as a multiplication with remainder, namely a = bq + r.
• Replace the pair of integers (a, b) with the new pair (b, r) and repeat the above step.
• Keep repeating until the remainder is zero. The last non-zero remainder is the greatest
common divisor.
3
It is not necessary to write the division statement each time, as seen here.
184 = 54 × 3 + 22
54 = 22 × 2 + 10
22 = 10 × 2 + 2
10 = 2 × 5 + 0
so gcd(130, 54) = 2.
Given two positive integers a and b, the Extended Euclidean Algorithm provides a method for
writing gcd(a, b) as a combination of a and b. That is, it finds integer solutions (s, t) of the
equation as + bt = gcd(a, b) (known as Bezout’s identity).
The Extended Euclidean Algorithm uses the lines of working generated when calculating the great-
est common divisor. Starting with the second last line of working, write gcd(a, b) as the subject
of the equation. Then manipulate the right-hand side by substituting alternative expressions from
each preceding line, simplifying much as you would with algebraic like terms, but resisting the
temptation to simply evaluate the numerical values involved. Working from bottom to top in this
way results in a combination of the original numbers a and b, as desired.
Example: Find an integer solution (s, t) for the equation 184s + 54t = 2.
Recall the following lines of working to calculate gcd(184, 54):
184 = 54 × 3 + 22 (1)
54 = 22 × 2 + 10 (2)
22 = 10 × 2 + 2 (3)
10 = 2 × 5 + 0
Then
2 = 22 − 10 × 2 from (3)
= 22 − (54 − 22 × 2) × 2 from (2)
= 22 − 54 × 2 + 22 × 4
= 22 × 5 − 54 × 2
= (184 − 54 × 3) × 5 − 54 × 2 from (1)
= 184 × 5 − 54 × 15 − 54 × 2
= 184 × 5 + 54 × (−17),
Exercise E: Apply the Extended Euclidean Algorithm to find integer solutions of as+bt = gcd(a, b)
with the values from Exercise D. Answers can be checked at the following website:
http://people.math.sc.edu/sumner/numbertheory/euclidean/euclidean.html
4
2.3 Application to Pythagistani coin replacement
Since gcd(5, 8) = 1, we can use the Extended Euclidean Algorithm to find integer solutions of
5s + 8t = 1, as follows:
8=5×1+3 (4)
5=3×1+2 (5)
3=2×1+1 (6)
2=1×2+0
2.4 Consolidation
Exercise I: Use the coin replacement strategy to prove that every total greater than or equal to
7788 cents can be made from a combination of 119c and 67c coins. How many initial cases would
you need to check in order to apply the ‘adding extra coins’ strategy of Section 1.1?
5
3 Finding the largest impossible total
The induction argument for Pythagistani 5c and 8c coins starts with the initial total of 28 cents.
Verifying that this case is possible is simply a matter of finding a combination of coins that works.
But how can we be certain that making 27 cents is impossible? After all, the Extended Euclidean
Algorithm provides infinitely many solutions for the equation 5s + 8t = 1, and we can easily adapt
these to find infinitely many solutions for 5s + 8t = 27. It just so happens that each such solution
has a negative value for either s or t, so it does not provide the non-negative integer solution
required for the context of the coin problem.
One strategy to establish this is to exhaustively list all possibilities. For example, consider in turn
each possible number of 5c coins: there cannot be zero 5c coins, because 27 is not a multiple of
8; there cannot be one 5c coin, because 27 − 5 = 22 is not a multiple of 8, etc. This is relatively
painless for such a small total, but for larger totals this approach quickly becomes impractical.
Suppose that a non-negative integer solution (x, y) exists for the equation 5x + 8y = 27. Adding
five to both sides, rearranging and factorising, we have
5x + 8y + 5 = 32
5x + 5 = 32 − 8y
5(x + 1) = 8(4 − y).
From the uniqueness of prime factorisation (the Fundamental Theorem of Arithmetic), the fact
that 5 and 8 have no common prime factors, and the condition x + 1 ≥ 1, it follows that (4 − y)
must be a positive multiple of 5. In particular, 4 − y ≥ 5, but then y ≤ −1, which contradicts the
assumption that y is non-negative. It follows that no such non-negative solution (x, y) can exist,
so 27 cents cannot be made from 5c and 8c coins.
Exercise J: Adapt the above argument to show that a total of 49 cents cannot be made from a
combination of 6c and 11c coins, and also that 7787 cannot be made from 119c and 67c coins.
Exercise K: Suppose two coins have positive integer values a and b, where gcd(a, b) = 1. Show
that, in general, it is not possible to make a total value of ab − a − b cents using these coins.
Having established that, in general, a total of ab − a − b is impossible, we are left with one final
question: is the subsequent value of ab − a − b + 1 cents, or equivalently (a − 1)(b − 1) cents, always
possible? This expression corresponds to the initial cases that kickstarted the inductive arguments
considered so far: the total of 4 × 7 = 28 cents for 5c and 8c coins, the total of 5 × 10 = 50 cents
for 6c and 11c coins, and the total of 118 × 66 = 7788 cents for 119c and 67c coins. In the latter
example, it is far from obvious how to actually make the total of 7788 cents from a combination of
119c and 67c coins. To do so, we return to the Extended Euclidean Algorithm.
Having found the solution (s, t) = (−9, 16) of the equation 119s + 67t = 1, we proceed as follows:
7788 = 118 × 66
= (119 − 1) × (67 − 1)
= 119 × 67 − 119 − 67 + 1
= 119 × 67 − 119 − 67 + (119 × (−9) + 67 × 16)
= 119 × 67 + 119 × (−10) + 67 × 15.
6
We now have a decision to make: how to regroup the first term 119 × 67 ? To ensure that the
overall sum has non-negative coefficients, we choose to group it with the other multiple of 119:
Hence a total of 7788 cents can be made from fifty-seven 119c coins and fifteen 67c coins.
Exercise L: Use the method outlined above to show that it is possible to make a total of 6 × 9 = 54
cents from 7c and 10c coins. [Try to avoid guessing the solution first.]
To generalise the above, we need the following observation which follows from the general solution
in Exercise G: there exists an integer solution (s, t) of as + bt = 1 which satisfies 0 < s < b and
−a < t < 0.
Exercise M: With coins as in Exercise K, use the above observation to show that it is always
possible to make a total of (a − 1)(b − 1) cents.
Theorem: Suppose two coins have positive integer values a and b, respectively, where gcd(a, b) = 1.
Then making a total of ab − a − b cents is impossible, but every larger total is possible.
References
Art of Problem Solving. (2019). Chicken McNugget Theorem.
Available at: https://artofproblemsolving.com/wiki/index.php/Chicken McNugget Theorem. [Accessed
May 2019].
Mathworld. (2019). Coin Problem – from Wolfram MathWorld.
Available at: http://mathworld.wolfram.com/CoinProblem.html. [Accessed May 2019].
Hutchinson, J. (2010). An Introduction to Contemporary Mathematics. ANU.
Available at: https://maths.anu.edu.au/files/introduction contemporary mathematics.pdf. [Accessed May
2019].
Acknowledgements
I am indebted to a secondary school student of mine, Mustafa Al-Kubaisi, for sparking my interest in the
general problem of finding the largest impossible postage given two relatively prime stamp values. I also
acknowledge various colleagues at the Australian Mathematics Trust: Dr Norm Do and Dr Andrew Kepert
for pointing me in the direction of the equivalent Frobenius Coin Problem, and Bernadette Webster for
her tireless editorial advice.
Chris Wetherell, May 2019
Australian Maths Trust