Associated Topics || Dr. Math Home || Search Dr. Math

### Switching Dollars and Cents

```
Date: 10/07/97 at 22:32:27
From: JJ
Subject: Math - finding an equation

Let's say a woman receives a check from the IRS and goes to cash it.
The bank teller accidentally switches the dollars and cents, so what
was dollars he gives her in cents and vice versa. After she spends a
nickel (\$.05), she realizes the bank teller's mistake. After she has
spent the nickel she has twice the amount of the original IRS check.

How do I find the answer and find a system of equations? I've tried
guess and check and still haven't figured it out :(
```

```
Date: 10/09/97 at 12:21:01
From: Doctor Rob
Subject: Re: Math - finding an equation

Let D be the number of dollars, and C the number of cents the check is
made out for.  The true value of the check then is 100*D + C cents.

The dyslexic teller gives her D + 100*C cents instead. After she
spends 5 cents, she has D + 100*C - 5, which is twice 100*D + C.
This gives you one equation:

D + 100*C - 5 = 2*(100*D + C),

which can be rearranged into the form

98*C = 199*D + 5.

There is a hidden condition that you will also need:

0 <= C <= 99 and 0 <= D <= 99.

This happens because amounts of money do not have numbers of cents
more than 99 or less than zero.

Now you need to see what the smallest value of D is that makes
199*D + 5 an exact multiple of 98. D = 0 won't work, because the
remainder on dividing 5 by 98 is 5. D = 1 won't work, because the
remainder on dividing 204 by 98 is 8. For D = 2, the remainder is 11.
For D = 3, the remainder is 14.

Are you beginning to see a pattern?

D        0   1   2   3   4   5   6   7 ...
remainder  5   8  11  14  17  20 ... ... ...

Because C <= 99, you must have an answer with

D = (98*C-5)/199 <= (98*99-5)/199 < 49,

so even if you don't see the pattern, or can't figure out how to use
it, you will only have to try 49 values of D to find the right one.

I think you can do the rest.

-Doctor Rob,  The Math Forum
Check out our web site!  http://mathforum.org/dr.math/
```

```
Date: 10/09/97 at 14:48:19
From: Cody Bass
Subject: Hard word problem

Dr. Math, my teacher gave me this word problem for extra
credit. I am having problems with it. Help.

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

```

```
Date: 10/09/97 at 17:57:18
From: Doctor Tom
Subject: Re: hard word problem

Hi Cody,

Well, assuming the check originally had x dollars and y cents,
it was worth 100*x + y cents.  The amount he got was y dollars
and x cents, or 100*y + x cents.

After spending 5 cents, he had 100*y + x - 5 cents, which is
twice 100*x + y.  So

2(100x + y) = 100y + x - 5

or

200x + 2y = 100y + x - 5

or 199x - 98y = -5

which doesn't look like enough information to solve
the problem except that x and y must be whole numbers.

so 98y = 199x + 5

y = (199x + 5)/98 = 2x + (3x + 5)/98

Since x and y are whole numbers, so must be (3x + 5)/98.

Call it z = (3x+5)/98
so 98z = 3x + 5, or 3x = 98z - 5 or x = (98z - 5)/3

or x = 32z-1 + (2z-2)/3.

Since everything is a whole number, so must be (2z-2)/3.

Call it w = (2z-2)/3, so 3w = 2z-2 so z = (3w+2)/2 or
z = w + 1 + w/2.  So w/2 must be whole, or w must be even.

So try w = 2.  Then z = 4.  Then x = 129.  Then y = 262.

These answers are no good, but looking at the original equation,
if you decrease y by 199 and x by 98, the answer will still
obviously work, so do that:

y = 63 and x = 31.

Original check:  \$31.63  Recieved:  \$63.31.

Subtract a nickel:  \$63.26 = 2 times \$31.63.

Equations like this (where whole number answers are required)
are called "Diophantine equations" in honor of the Greek
Diophantus.  They are in general very hard to solve, but
linear equations like this one can be solved using exactly
the method I showed you above.  Of course, you never know
how many steps it will take to get to the answer!

-Doctor Tom,  The Math Forum
Check out our web site!  http://mathforum.org/dr.math/
```

```
Date: 08/27/2001 at 23:57:33
From: James Davis
Subject: Re: (no subject)

In one of the steps in Switching Dollars and Cents an equation is
simplified or altered as follows:

a) 98z = 3x + 5

b) or 3x = 98z - 5

c) or x = 98(z - 5)/3

d) or x = 32z - 1 + (2z - 2)/3.

between c) and d), where does the "5" go? Is it factored out? If so,
then how? In my problem I replaced the five with a 62 throughout and it
worked perfectly. I got an answer of x = 12 and y = 25.

12.25 * 2 + .62 = 25.12

but the last step I took seemed arbitrary. For the actual values of x
and y I got 110 and 224 respectively. I subtracted 199 from the y value
and 98 from the x value, as was mentioned in one of the examples, and
lo and behold...

I'm just not sure why this works. I am baffled.

Thanks again.
James.
```

```
Date: 08/28/2001 at 09:18:48
From: Doctor Peterson
Subject: Re: (no subject)

Hi, James.

Here are the detailed steps to get from c to d; note that you copied
the former incorrectly, and the parenthesis goes before the 98:

x = (98z - 5)/3

= [(96+2)z - (3+2)]/3          96 and 3 are largest
multiples of 3

= [(3*32+2)z - (3*1+2)]/3      32 and 1 are quotients,
2 and 2 remainders

= (3*32+2)/3 z - (3*1+2)/3     distribute division

= (32 + 2/3)z - (1+2/3)        distribute division

= 32z + 2z/3 - 1 - 2/3         distribute multiplication

= 32z - 1 + 2z/3 - 2/3         reorder

x = 32z - 1 + (2z - 2)/3         factor out the division
by 3

The main idea is that we are dividing 98 and 5 by 3:

__32_rem_2        __1_rem_2
3 ) 98            3 ) 5
96                3
--                -
2                2

98 = 3*32+2       5 = 3*1+2

You got 110 and 224 as one possible answer, but it did not fit the
requirement that x and y be less than 100. As the answer you were
following says, "if you decrease y by 199 and x by 98, the answer will
still obviously work," and you did that to get the final answer, which
is correct.

But this is not quite arbitrary. Let me show you my solution, which
makes this a little clearer:

98y = 199x + 62

y = 199/98 x + 62/98

= (2 + 3/98)x + 62/98

= 2x + (3x+62)/98

Define a = (3x+62)/98, and solve for x:

x = (98a-62)/3 = 98/3 a - 62/3 = (32 + 2/3)a - (20 + 2/3)

= (32a-20) + (2a-2)/3

Define b = (2a-2)/3, and solve for a:

a = (3b+2)/2 = 3/2 b + 1

= (1 + 1/2)b + 1 = b + 1 + b/2

Define c = b/2, and solve for b:

b = 2c

Now c can be any integer, and each of the other variables will be an
integer. So we work backward:

a = (3b+2)/2

= (6c+2)/2 = 3c + 1

x = (98a-62)/3

= (98(3c+1) - 62)/3

= (98*3c + 98 - 62)/3

= (98*3c + 36)/3

= 98c + 12

y = (199c + 62)/98

= (199(98c+12) + 62)/98

= (199*98c + 2388+62)/98

= (199*98c + 2450)/98 = 199c + 25

This tells us that x = 98c+12 and y = 199c+25 will be a solution _for
any integer c_.

In my case, c=0 gives x and y in the right range; the first time I did
this, I didn't do the division on the constant terms, so I got x =
98c+992 and y = 199c+2015, and had to find a value of c
that would put it in the right range. I did this by dividing 992 by 98
to get 10 12/98; by setting c to 10 x would be the smallest positive
value possible, and that gave the answer.

As you see, the choice of c is in fact arbitrary, apart from the fact
that I want x and y to be the smallest positive values that solve the
equation.

The process is a little arduous, even though it follows rules all the
way. I don't do these too often, and always forget exactly how to do it
because I've seen too many different ways of doing essentially the same
thing, and confuse them. But this method worked very neatly. I'll try
to remember it!

- Doctor Peterson, The Math Forum
http://mathforum.org/dr.math/
```

```
Date: 08/28/2001 at 12:25:43
From: James Davis
Subject: Re: (no subject)

Thanks a ton for all that. That definitely cleared up my questions. I
see now how the problem works and why there are so many different
methods for solving it.

James
```
Associated Topics:
High School Linear Equations
High School Puzzles
Middle School Equations
Middle School Puzzles

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search