Let x be the number of dollars in the check, and y be the number of cents.

Then 100y + x − 50 = 3(100x + y).

Therefore 97y − 299x = 50.

A standard solution to this type of linear Diophantine equation uses Euclid's algorithm.

The steps of the Euclidean algorithm for calculating the greatest common divisor (gcd) of 97 and 299 are as follows:

299 = 3 × 97 + 8

97 = 12 × 8 + 1

This shows that gcd(97,299) = 1.

To solve 97y − 299x = gcd(97,299) = 1, we can proceed backwards, retracing the steps of the algorithm as follows:

1 | = 97 − 8 × 12 |

= 97 − (299 − 3 × 97) × 12 | |

= 37 × 97 − 12 × 299 |

Therefore a solution to 97y − 299x = 1 is y = 37, x = 12.

Hence a solution to 97y − 299x = 50 is y = 50 × 37 = 1850, x = 50 × 12 = 600.

It can be shown that *all* integer solutions of 97y − 299x = 50 are of the form y = 1850 + 299k, x = 600 + 97k, where k is any integer.

In this case, because x and y must be between 0 and 99, we choose k = −6.

This gives y = 56, x = 18.

So the check was for $18.56.

Let x be the number of dollars in the check, and y be the number of cents. Consider the numbers of dollars and cents Ms Smith holds at various times. The original check is for x dollars and y cents. The bank teller gave her y dollars and x cents. After buying the newspaper she has y dollars and x − 50 cents. We are also told that after buying the newspaper she has three times the amount of the original check; that is, 3x dollars and 3y cents.

Clearly (y dollars plus x − 50 cents) equals (3x dollars plus 3y cents). Then, bearing in mind that x and y must both be less than 100 (for the teller's error to make sense), we equate dollars and cents.

As −50 (x − 50) 49 and 0 3y 297, there is a relatively small number of ways in which we can equate dollars and cents. (If there were many different ways, this whole approach would not be viable.) Clearly, 3y − (x − 50) must be divisible by 100. Further, by the above inequalities, −49 3y − (x − 50) 347, giving us four multiples of 100 to check.

- If 3y − (x − 50) = 0, then we must have 3x = y, giving x = −25/4, y = −75/4
- If 3y − (x − 50) = 100, then (to balance) we must have 3x − y = −1, giving x = 47/8, y = 149/8
- If 3y − (x − 50) = 200, then we must have 3x − y = −2, giving x = 18, y = 56
- If 3y − (x − 50) = 300, then we must have 3x − y = −3, giving x = 241/8, y = 747/8

There is only one integer solution; so the check was for $18.56.

Source: My Best Mathematical and Logic Puzzles (Dover Recreational Math), by Martin Gardner. Based on puzzle number 31.