Monday, July 16, 2007

Modulo Arithmetic

Number theroy starts with modulo arithmetic.
And why should we learn another kind of Arithmetic?
Wish I had an easy answer for that.Unless you are really gifted and you want to learn something of importance in theory of numbers you need to be familiar with modulo arithmetic.

So here we go....


As usual we write equations of form LHS =RHS

There's one crucial difference we always write these equations with reference to some number we call as 'modulo'
And to make it more expalanatory we write that number in bracket after the equation.
LHS=RHS (MOD N)
So we are doing arithmetic with respect to this number N we have decided to call as modulo.

Now rules of modulo equations are very simple and correspond to normal artihmetci we do.
we say that some number a=b (mod N)
if (a-b) is divisible by N
So difference of a and b be should be divisible by N
Stated equivalently a and b should leave same remainders when divided individually by N.

Say we have 5=8 (mod 3)

as 5 and 8 leave same remainder when divided by 3

or 8-5 =3 which is divisible by 3


Similarly 14=7 (mod 7)
2=4 (mod 2)
10=17 (mod 7)
10001=1(mod 1000)

One interesting thing is we can have negative numbers as well

Say 5= -3 ( mod 8)

as 5-(-3) =8 which is divisible by 8

Or if you divide 5 by 8 you get 5 as remainder .
if you divide -3 by 8 you get 5 as remainder
and 5= 8*(0)+5
as -3 = 8*(-1)+5
In first case 8 goes 0 times therefore quotient is 0 and remainder 5
and in second case 8 goes -1 times, yes negative quotients are also possible.

So in world of modulo arithmetic we are kind of always playing with remainders.
And it is incredibly powerful.


Can you think of few modulo equations and write them down ...

No comments: