Introduction to modular arithmetic


By Jim Oldfield on Sunday, July 01, 2001 - 12:10 am:

OK so I've done my STEPs and I should get over it, but here's a past paper problem that will bug me for all eternity if it never gets answered. Paper I, June 1996, Q3, asks for you to prove that:

(i). n5-n3 is divisible by 24
(ii). 22n-1 is divisible by 3
(iii). n3-1 is divisible by 9, given n-1 is divisible by 3.

OK, this is pretty easy by factorisation (a gift of a question, you could even say!), but the hints and answers said "...or this is trivial by using modular arithmetic." Of course modular arithmetic is not on the A-level syllabus, so I don't know much about it. How is it used in this question?


By Michael Doré on Sunday, July 01, 2001 - 09:38 pm:

I'm in a bit of a hurry so I'll give a very brief outline of modular arithmetic.

If a,b,n are integers with n > 1 then we say:

a = b (mod n)

if and only if a - b is a multiple of n. So we require the existence of an integer k such that:

a - b = nk

or

a = b + nk

In other words a = b (mod n) if a,b each have the same remainder when you divide them by n.

There are some important properties, which are easy to prove.

1) If a = b then a = b (mod n) for every integer n.

2) a = b (mod n) if and only if b = a (mod n)

3) If a = b (mod n) and b = c (mod n) then a = c (mod n).

4) If a = b (mod n) and c = d (mod n) then a + c = b + d (mod n).

5) If a = b (mod n) and c = d (mod n) then ac = bd (mod n).

6) If a = b (mod n) then for every natural k, ak = bk (mod n). (You can prove this one with the binomial expansion or by induction.)

Once you're happy with all this, we can discuss the application to the particular problem.


By Olof Sisask on Monday, July 02, 2001 - 12:51 am:

Can (6) follow from (5)? i.e. if you let c = a and d = b?

Olof


By Michael Doré on Monday, July 02, 2001 - 01:03 am:

Yes, that's right; that's the inductive proof.


By Olof Sisask on Monday, July 02, 2001 - 01:29 am:

Whoops, didn't realise that comes under induction.

Cheers,
Olof


By Arun Iyer on Monday, July 02, 2001 - 08:15 pm:

Thanks Michael!!
I GOT IT. (thumbs up)

Well how about you Jim?

love arun


By Michael Doré on Monday, July 09, 2001 - 09:08 pm:

Wow, that was quick; I remember it took me quite a while to get my head round the notation. Anyway, do you understand how to apply this to Q3 of STEP 1996?


By Arun Iyer on Thursday, July 12, 2001 - 06:41 pm:

my dear teacher michael,
I got Q2

Q2.
4=1(mod 3)
4n=1n(mod 3) ......property no.6

therefore
22n=1(mod 3)

I got stuck on Q1 and Q3
please help me.

love arun


By Michael Doré on Thursday, July 12, 2001 - 07:27 pm:

Yep, that's precisely the way to do ii). It makes it look incredibly easy doesn't it!

To be honest, modular arithmetic doesn't really make i) that much easier. At least not in any way I've noticed. You can split the problem up into showing:

a) n5 - n3 is a multiple of 3
b) n5 - n3 is a multiple of 8.

a) is easy - you know that either n = 0 (mod 3), n = 1 (mod 3) or n = 2 (mod 3). You can now work out n5 - n3 (mod 3) in each case by actually substituting in the value for n (mod 3). In all three cases you find n5 - n3 = 0 (mod 3):

05 - 03 = 0 (mod 3)
15 - 13 = 0 (mod 3)
25 - 23 = 24 = 0 (mod 3)

Therefore n5 - n3 = 0 (mod 3) for all n.

b) could in essence be done in the same way, but that would be pretty tedious as there are now 8 values to substitute in. Instead note that if n is even then n5,n3 are both multiples of 8, so it's easy if n is even. If n is odd then it is a well known fact that n2 = 1 (mod 8). So n5 - n3 = n3 n2 - n3 = n3 - n3 = 0 (mod 8) so we're done.

However that really wasn't made any easier by modular arithmetic.

iii) however is done very quickly with modular arithmetic. We know that n - 1 is a multiple of 3. All multiples of 3 are equal to either 0,3 or 6 (mod 9). Therefore n = 1,4 or 7 (mod 9). Simply test each case by direct substitution of the values. (You can speed up n = 7 (mod 9) case by noticing that 7 = -2 (mod 9).)

Regards,

Michael


By Arun Iyer on Thursday, July 12, 2001 - 08:08 pm:

I got it Michael.
Thanks.

Modular arithmetic is just basic algebra yet so much fun.

love arun


By Jim Oldfield on Thursday, July 12, 2001 - 09:49 pm:

Many thanks Michael, that's satisfied my craving. :-)