# Homework Help: A money puzzle

1. Nov 30, 2016

### musicgold

1. The problem statement, all variables and given/known data
I am trying to solve the following puzzle. The problem is that there are two unknowns and I could come up with only one equation.

A man went into a bank to cash a check. In handing over the money the cashier, by mistake, gave him dollars for cents and cents for dollars. He pocketed the money without examining it, and spent a nickel ( 5 cents) on his way home. He then found that he possessed exactly twice the amount of the check. He had no money in his pocket before going to the bank. What was the exact amount of that check?

2. Relevant equations
Let x - number of dollars and y - number of cents
check amount - $100x + y$
paid amount - $100y + x$
amount left after spending a nickel - $100y + x - 5$

So the first equation we get is:
$100y + x - 5 = 2 (100x + y)$

After solving it, we get
$y = \frac { 199x + 5 } { 98}$

3. The attempt at a solution
As there is not enough info for another equation, I tried the trial and error approach. To get a whole number the numerator has to be a multiple of 98. To have an even number in the numerator, x has to be an odd number.

I tried using a few values of x but didn't get an answer. I am not sure if I am headed in the right direction. Is there a better way of doing this?

Thanks.

2. Nov 30, 2016

### Staff: Mentor

Have you tried to plot it and remember that both x and y must be integers?

3. Nov 30, 2016

### Ray Vickson

You also have $x = \frac{98 y - 5}{199}$.

Last edited: Nov 30, 2016
4. Nov 30, 2016

### musicgold

I tried plotting the equation using Winplot but it is hard to locate a pair that satisfies the equation.

5. Nov 30, 2016

### PeroK

$199$ is a prime number. Does that help?

6. Nov 30, 2016

### Staff: Mentor

This is a linear diophantine equation because the x and y must be integers and they are related in a linear way.

https://en.wikipedia.org/wiki/Diophantine_equation

I did find a solution using a MATLAB clone (freemat.org) and you'll need to try solutions of x from 5 to 99 to find the corresponding y which can be done via google in the search bar. The MATLAB approach was faster because of its builtin vector calculating.

I'm not sure of any other way to solve it.

7. Nov 30, 2016

### PeroK

The fact that 199 is prime helps! But, I'm not sure how much for a pre-calc question.

8. Nov 30, 2016

### Staff: Mentor

This may be overkill for this problem but then again what is life for if not for learning new things:

https://en.wikipedia.org/wiki/Kuṭṭaka

9. Nov 30, 2016

### PeroK

There is an elementary solution. Hint: consider the two cases where $y < 50$ and $y \ge 50$.

Your equations are correct, but if you start again, there's a quicker way with this approach.

PS to keep things simple, assume he did have a nickel in change. I.e. $x \ge 5$.

10. Dec 24, 2016

### LCKurtz

You can also quickly brute force it with Excel.

11. Dec 25, 2016

### haruspex

If you rewrite that as $y = 2x + \frac { 3x + 5 } { 98}$, isn't a solution obvious?

12. Dec 25, 2016

### musicgold

Oh...got it. Thanks.

\$31.63.

13. Dec 25, 2016

### musicgold

Jedishfru,

The solution (31, 63) doesn't seem to follow that GCD rule. Am I missing something?

14. Dec 30, 2016

### haruspex

Applying the GCD rule to the equation you ended up with in post #1, it says the gcd of 199 and 98 must be a factor of 5. Since 199 and 98 are coprime, the gcd is 1, so it is trivially true and not useful here.
Likewise, applying it to the answer, 31 and 63 are coprime, so, again, it just says 1 divides 5.