Modulo arithmetic fundamental properties
One can easily prove that
(a + b) % k = ( (a % k) + (b % k) ) % k,
where % is the remainder operator.
To prove that assume a = pk +q, b = mk + n. And try to equate LHS and RHS.
Similarly,
(a - b) % k = ( (a % k) - (b % k) ) % k
And
(ab) % k = ( (a % k) * (b % k) ) % k
Ex 1:
6 mod 7 = -1 mod 7
This is a useful trick for exams.
If remainder is 1 less than divisor it can be rewritten as -1.
Since -1 + 7 mod 7 = 6
Similarly
13 mod 7 = -1
17 mod 9 = -1
Ex 2:
For a non-zero 'a', a mod (a + 1) is -1.
Same argument as above.
Ex 3:
Extending Ex 2, a^2 mod (a+1) = 1
Since
a^2 mod (a+1) = -1 * -1 = 1
Ex 4:
Prove that for any positive integer n:
1) n.(n+1).(2n+1) is divisible by 6.
Either n or (n+1) is even. So it's divisible by 2.
Now 3 cases for proving divisibility by 3:
a) n mod 3 = 0, then it's div by 3.
b) n mod 3 = 1 then (2n + 1) mod 3 = 2 + 1 = 0 mod 3, hence div by 3.
c) n mod 3 = 2 then (n + 1) mod 3 = 0, H.P.
2) (2n - 1). n. (2n + 1) is divisible by 3.
Similar to above. Take 3 cases as above and prove.
Ex 5:
Prove that if (x - 1) is divisible by d then x^k - 1is also divisible by d for every integer k >= 1.
Solution:
x - 1 mod d = 0
=> x = 1 mod d
=> x^k = 1^k mod d
=> x^k = 1 mod d
=> x^k - 1 mod d = 0
H.P.
So it means that (x-1) is always a factor of (x^k - 1) for every integer k >= 1.
Comments
Post a Comment