# Why self-service machines give such awful change

Unexpected item in bagging areAAAARGGGHH here’s 90p change in pennies

"Oh I'll just pay with a tenner; it'll be fine." Sainsbury's self-checkouts. Image: SchuminWeb, CC BY 2.0

You’ve got this down. You’ve bagged your groceries, swiped your Nectar card, and you’ve paid with a fiver. You’re due 55p change. Surely you’ll get a 50p and 5p coin, right? Nice and light in your pocket.

Wrong!

Self-checkout fans will know that you really get 20p, 20p, 5p, 5p, 5p.

Why?!

Last week, we advocated a new £1.23 coin in place of the new pound coin in order to reduce the number of coins you get in change. The answer to this self-service riddle is related.

## Why do self-service checkouts give so much change?

Although supermarket self-checkouts accept all circulating coins, customers normally find that they only give out six possible coins as change. Normally these are

1p — 2p — 5p — 20p — £1 — £2.

They don’t give out 10p or 50p coins.

This is because self-checkout machines don’t reuse coins they are given. Instead, all the coins you put in are collected into a bucket [the brand that Sainsbury’s use call it a recycling acceptor: pdf]. The machines have separate tubes for coins as change, which are filled by staff with coins which have been checked by the bank as genuine.

The mechanisms for these tubes are expensive and prone to jamming. Combine this with the fact that many machines are based on US designs, where there are far fewer denominations of coin:

1¢ — 5¢ — 10¢ — 25¢ — \$1,

you end up with machines with fewer coin tubes than types of coin.

This means that 99p in change (for example) requires nine coins with the current choice of coins to fill the machine with. But there’s a better choice of six coins. Suppose a machine has only n coin tubes to give out change. Which coins should it pick?

Coin tubes Coins Number expected
2 1p, 20p 21.5
3 1p, 20p, 50p 10.9
4 1p, 5p, 20p, £1 7.5
5 1p, 5p, 20p, 50p, £2 6.2
6 (self-checkout) 1p, 2p, 5p, 20p, £1, £2 (current) 5.9
1p, 2p, 5p, 20p, 50p, £2 (improvement) 5.4
7 1p, 2p, 5p, 10p, 20p, 50p, £2 or
1p, 2p, 5p, 20p, 50p, £1, £2
5.0

The message here is that £1 and 10p coins are less efficient than any other coin. The £1 coin, for example, is made up of only two 50ps, and it’s only half of £2.

So the self-checkout machines almost have it right: but if we’re going to use self-checkout machines with a small number of slots to give out change, we should swap the £1 coin tube for the 50p coin tube: then 99p is only six coins, instead of nine.

There is a good reason to keep £1 coins though: if you run out of £5 notes—a very common occurrence given that cash machines only give out £10 and £20 notes—you want to keep back your £2 coins for that. Maybe they have it right after all.

Speaking of Americans…

## Are quarters better than 20-cent coins?

Euro 20c vs Canadian 25¢. Fight!

Nearly all currencies have coin denominations starting with 1s and 5s. The differences can be found in between.

20-cent coins are favoured by most modern currencies (UK, Euro, most Commonwealth), whereas some older ones favour the 25-cent coin (US/Canada, Denmark, Thailand, pre-Euro Netherlands).

Is one more efficient than the other?

Coins Number expected Weight expected
1p, 2p, 5p, 10p, 20p, 50p, £1, £2 4.61 32.8g
1p, 2p, 5p, 10p, 25p, 50p, £1, £2 4.61 33.6g

Answer: they are equally efficient! Although, if you made a 25p coin weigh the same as a 20p coin, the expected weight is a little higher. (Fun fact: the UK used to have a 25p coin… but it was the same size/weight as the £5 coin.)

## Programming this yourself

As with the £1.23 post, I am doing this all with a bit of Python code I found on StackExchange:

def get_min_coins(coins, target_amount):
n = len(coins)
min_coins = [0] + [sys.maxint] * target_amount
for i in range(1, n + 1):
for j in range(coins[i - 1], target_amount + 1):
min_coins[j] = min(min_coins[j - coins[i - 1]] + 1, min_coins[j])
return min_coins


This is nice code because it avoids the lazy approach (‘greedy algorithm’) of trying the highest coin first and then dealing with the remainder. Such a lazy approach is quick but fails if you have coins of 1p, 3p, 4p and want to make 6p. The lazy approach would give you 4p, 1p, 1p; but of course the best option is 3p, 3p.

Have a play with the code yourself. Do share below if you find anything interesting.

## Bonus: How does the new £1 coin square off against the old one?

Adam is an assistant professor at Durham University, where he investigates weird, non-Newtonian fluids. If he’s not talking about the maths of chocolate fountains he is probably thinking about fonts, helping Professor Dirichlet answer your personal problems, and/or listening to BBC Radio 2.

• ### On the cover: VisualPDE.com

Ben Walker, Adam Townsend & Andrew Krause invite you to play with their fun online PDE visualiser
• ### My favourite LaTeX package

The Chalkdust editors share some of their favourites
• ### Page 3 model: Cows

How big is the biggest cow?
• ### Chalkdust issue 11 puzzle hunt #5

Adam Townsend sets the fifth and final puzzle. Can you solve it?
• ### Review: Mathematical socks 2

More sartorial inquisition for your feet
• ### Review of The Maths Behind by Colin Beveridge

Should you ask Santa for 'Ice Col' Beveridge's encyclopedic tome this festive period?