NQU Mod

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

§ 2.

1 Modular Operations
You can add, subtract, multiply, and exponentiate modulos. You can also divide, but care must be taken.

Fact 2 (Adding) If a ≡ x (mod n) and b ≡ y (mod n), a + b ≡ x + y (mod n).

Proof: Since n | x − a and n | y − b, clearly n | (x + y) − (a + b). 

Subtracting is identical, so we do not discuss it further.

Fact 3 (Multiplying) If a ≡ x (mod n) and b ≡ y (mod n), ab ≡ xy (mod n).

Proof: Say a = ap n + q and x = xp n + q where q is the residue of a and x, and b = bp n + r and y = yp n + r


where r is the residue of b and y. Then

xy − ab = (xp n + q)(yp n + r) − (ap n + q)(bp n + r)


= n2 (xp yp − ap bp ) + n(xp + yp − ap − bp ) + qr − qr
= n2 (xp yp − ap bp ) + n(xp + yp − ap − bp ),

which is clearly divisible by n. 

Fact 4 (Exponentiating) For integer a, b and positive integers n, k, if a ≡ b (mod n), then ak ≡ bk
(mod n).

Proof: Note that n | a − b | ak − bk . 

As an exercise for the operations we’ve defined so far, pick your favorite ordered triple of positive integers
(a, b, n), and compute the remainder of a + b, a − b, ab, and ab1 when divided by n.

Fact 5 (Dividing) Let a, b, c be positive integers such that c | a and c | b. If a ≡ b (mod n) and gcd(a, n) =
1, then ac ≡ bc (mod n).

Be careful to remember that we must have gcd(a, n) = 1!


We present the proofs of the divisibility rules as examples.

Example 1 (9 Divisibility Rule) If n = dk dk−1 ...d1 d0 , prove that n ≡ d0 + d1 + · · · + dk (mod 9).

Solution: Note that n ≡ 100 d0 + 101 d1 + · · · + 10k dk ≡ d0 + d1 + · · · + dk (mod 9).


This works because 10k ≡ 1k ≡ 1 (mod 9). 

Example 2 (11 Divisibility Rule) If n = dk dk−1 ...d1 d0 , prove that n ≡ d0 − d1 + · · · + dk (−1)k (mod 11).

Solution: Note that n ≡ 100 d0 + 101 d1 + · · · + 10k dk ≡ d0 − d1 + · · · + dk (−1)k (mod 11).


This works because 10k ≡ (−1)k (mod 11). 
1 For large enough b, you’ll want to know Fermat’s Little Theorem!

You might also like