It happens a million times a day.  Somebody pays cash for something and gets change.  But there are rules, and Raymond's friend seems to like to break those rules.  Luckily for Raymond's friend, one of the rules is the customer is always right... or as Mr. Krabs would say, the money is always right.  This blog post is about a couple of the more mathematical rules.

Rule for the cashier: you must give "canonical" change.

Whether to honor requests for non-canonical change is a complicated morass I will not attempt to tackle in this blog post as too much depends on context.  But the initial offering must be canonical.

By "canonical change", I mean the cashier must give change using the smallest possible number of canonical coins and bills.  For example, (one quarter + one nickel) is a rendering of $0.30 using only two coins, while (three dimes) is three coins, so a cashier must never give change that includes three dimes.

By "canonical coins and bills" I mean (in the U.S.) this precise list:

  • penny
  • nickel
  • dime
  • quarter
  • $1 bill
  • $5 bill
  • $10 bill
  • $20 bill
I discuss usage of non-canonical (unusual) coins and bills later.

Rule 1 for the customer: "Tap, tap, no takebacks"

The tender and canonical change cannot intersect.

Don't give the cashier anything they would just hand back to you directly.

This is the rule that Raymond's friend broke - it just wastes everyone's time to play musical chairs with the money.
Actually, this rule is just a corollary of the more general rule:

Rule 2 for the customer: "No side transactions."

No subset of the tender can have the same value as any subset of canonical change for that tender.

Don't give the cashier anything that they would just hand back to you in coalesced form.

If you want to consolidate your change, go to a bank or use one of those big machines.

Corollary 1: it is always OK to pay with a single large bill.
Corollary 2: it is always OK to give exact change.

Unusual denominations:

The two-dollar bill, the dollar coin (in any of its forms), the half-dollar coin, and bills higher than $20 are "unusual" denominations that complicate the situation slightly.

Rule for the cashier: Unusual denominations stay in the drawer.

Accept them (unless there are security rules at your place of business) but they are explicitly not part of any canonical change.

Rule for the customer: Go right ahead.

You can pay with an unusual denomination provided that you do not break the "no side transactions" rule or any large-denomination security rule at the business in question.

Examples:

In the following examples, "total" is the amount owed; "tender" is the amount the customer gives to the cashier; and "change" is what the cashier gives back to the customer.

Total Tender Change Notes
$5.20 $5 bill + $2 bill $1 bill + three quarters + one nickel OK - cashier correctly accepted the $2
$5.20

$5 bill + $1 bill

two quarters + three dimes Cashier gave out more coins than necessary
$5.20 $5 bill + $1 bill half-dollar + one quarter + one nickel Cashier gave out non-canonical half-dollar
$5.20 $5 bill + four quarters three quarters + one nickel Customer gave three "takeback" quarters
$5.20 $5 bill + quarter + nickel dime OK
$5.20 $5 bill + quarter + five pennies dime OK
$5.20 $5 bill + quarter + ten pennies dime + nickel Customer got nickel for five pennies in "side transaction"

In the last row, you can think of the "side transaction" as either five pennies for a nickel or ten pennies for a dime. I prefer the former.