Hello and welcome to Maths with Jay
Here we're looking at modular arithmetic
Initially we're just concentrating on
modulo 12
That's because it will be easier for you to visualise
as you're already familiar with a similar sort of clock
I guess you've noticed there's a couple of differences:
you can see that instead of a 12 there's a 0
at the top of the clock and also there's only one hand -
most clocks have two if not three hands
but in modular arithmetic
we only need to concern ourselves with whole numbers
so we only need the equivalent of an hour hand
so no need for a minute hand and we certainly don't need a second hand.
So we're only going to be interested in the hour hand pointing directly at a number
so for example it's currently pointing
directly the number two. So this is a bit like a clock
where the time is showing 2 o'clock and you would know that
in three hours time it would be 5 o'clock
Now this corresponds to the calculation
in modular arithmetic of 2 plus 3
so this corresponds to adding three
on to 2 and getting five
Now modular arithmetic isn't quite the same as ordinary arithmetic
in the same way as when you look at a 12-hour clock you see that the time is
5 o'clock,
you know that it could either represent five o'clock in the middle of the night
(or early in the morning) or 5 o'clock in the early evening or in the late afternoons - there's
two 5 o'clocks aren't there? And in some sense, those two things and not quite the same
as each other
and yet in another sense as far as looking at the clock is concerned
those two things look exactly the same.
Now what we do in modular
arithmetic is we don't use the equals symbol, but we use the
congruent symbol - the symbol for "congruent to"
so here I'm writing that two plus three
is congruent to 5
and in brackets I'm writing mod 12; the "mod 12"
just tells us that we're working in modulo 12, that
we've got a clock with 12 numbers on it, so that's fairly straightforward
So now lets add four onto 5, five plus four
is nine just as if we were adding four hours on to 5 o'clock we would get
9 o'clock, so five plus four is congruent to 9
(mod 12) and now if we add
5 on to 9 we get
two, so nine plus five
is two, so nine plus five is congruent
to 2 (mod 12) so that's like saying five hours after
9 o'clock is 2 o'clock. What happens if we add 12
on to 2? Well
we end up at two again, so two plus 12 is
14 and 14 is congruent to 2 so that's a bit like thinking of the
24-hour clock where we've got 14:00 hours being the same as
2 p.m. But we could take it further
and for example add 30 on to 2
So in ordinary arithmetic we get 32
but here you can see that two plus 30
is congruent to 8 (mod 12)
And if we add 5 on to 8 we get
one (mod 12) We could start off
with a really big number like 29 and add 72 onto that
What we could do here
is say, well, 29 is congruent to 5, 72
is congruent to 0 so when we add those two together
we get an answer of 5.
Alternatively you could add together 29 and 72 first
and then work out what they would be congruent to
So rather than whizzing round and round and round this clock, a faster way to do this would be to
think, well,
we can always divide the number by 12 and just keep the
remainder, so here with the 29: 29 divided by 12
is two remainder 5. 72
divided by 12: well that goes in exactly so there's no remainder so the
remainders
are 5 and 0. The same sort of thing will work for much bigger numbers
So if we wanted to add 243
and 85 together, we can see that 243
divided by 12 is going to have a remainder of three because 240 is a multiple of
12
And 85:
we know that 84 is seven times 12 so the remainder there is one
so 243 plus 85
is going to be congruent to 3 plus one
or just four (mod 12). So here we've just been looking at
addition in modulo 12 where we've been
thinking about adding on, going clockwise around the clock
Next time we'll look at subtraction
which will involve going anti-clockwise