Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

An eight-year old (Grade 3) told me about the "hardest problem" they had to solve on their math test yesterday. Here's the question:

There is a number less than 40, that when divided by 5 leaves a remainder of 3, and when divided by 6 leaves a remainder of 2.

He was very proud to have solved it himself :)

I immediately thought this might be a nice way to introduce him to simple algebra but when we reached home, I realised I couldn't come up with a way to express the problem.

My thoughts were along the lines of:

z = 5x + 3
z = 6y + 2

But then what can you do with

5x + 3 = 6y + 2

except for reaching

y = (5x + 1) / 6

and I have a feeling I'm going down a horribly wrong path.

Is there a "simple" way to solve this problem with algebra?

share|cite|improve this question
It seems to me like your strategy is fine. In your last equation, you just evaluate at values of $x$ and see when you get an integer $y$. So $x=1, y = 1, z = 8$ will work. – Thomas Apr 5 '12 at 12:31
There are actually two numbers less than 40 (and greater than 0) that satisfy those equations. – Chris Taylor Apr 5 '12 at 12:35
Chinese Remainder Theorem! (Look up the...) – user1729 Apr 5 '12 at 12:43
up vote 3 down vote accepted

When you write $y = (5x + 1) / 6$ your bad feeling is justified, because you could plug in an integer value for $x$ and get a non-integer value for $y$. Disaster!

One trick is to avoid any non-integer values by multiplying all coefficients of arbitrary values up to the least common multiple. For example, with

$$d = 5x + 3$$ $$d = 6y + 2$$

you have arbitrary numbers $x$ and $y$ in your solution, related through $d$. Their coefficients are $5$ and $6$, with least common multiple $30$, so if we multiply up:

$$6d = 30x + 18$$ $$5d = 30y + 10$$

you can subtract one from the other to get

$$d = 30(x-y) + 8$$

which is valid for all integer values of $x$ and $y$, so we may as well write them as a single variable:

$$d = 30m + 8$$

from which it is easily seen that 8, 38, 68, 98... are all solutions, and the ones between 0 and 40 are 8 and 38.

share|cite|improve this answer
This certainly seems much more straightforward to explain, although perhaps not quite at Grade 3.. at least I understand how to solve it now. I was hoping for something like your final line, but would have missed reducing the (x-y) to a single variable. Thanks! – Jedidja Apr 5 '12 at 13:27

$5x = 6y-1 = 6(y-1)+6-1 = 6(y-1)+5$. Hence $y-1$ is a multiple of $5$, $y=5t+1$, $x=6t+1$, and finally $z=30t+8$. If $z<40$, then $t=0$ and $t=1$ work and give $z=8$ and $z=38$.

The hard part is to conclude from $5x-5=6(y-1)$ that $y-1$ is a multiple of $5$. This is no longer algebra...

In the more general case, $z=5x+a=6y+b$, you can proceed as follows (which is different from the above ad-hoc solution): $6y+b=5x+a=6x-x+a$ and so 6 divides $x-a+b$ and so $x=6t+a-b$. The rest is similar.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.