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

Cancellation Property of Modular

Arithmetic
Property
Given a positive integer n and integers k, u, and v:
If k is relatively prime to n then
ku

kv (mod n)

may be simplified by canceling k from each side leaving.


u

v (mod n)

ku

kv (mod n)

Proof

ku - kv
k*(u - v)

(mod n)
(mod n)

k*(u - v) = j*n (for some integer j)


However, since the left hand side is a product of two integers one of which, k, is
stated as being relatively prime to n. The consequence of this is that all of the
factors of n must be contained in the integer represented by (u-v). Hence (u-v) must
be divisible by n and therefore:
(u - v)
u

(mod n)
v (mod n)

Important Note
Notice that the condition that k be relatively prime to n is critically relevant. For
example:
60

90 (mod 15)

Which can be written as


10*6

10*9 (mod 15)

However, the factor 10 cannot be cancelled from each side because 10 and 15 are
not relatively prime. This underscores the fact that normal arithmetic division is an
undefined operation in modular arithmetic. Don't do it. Ever. Even when it might
appear obvious what the answer is. For instance, in the above example, if you want
to "divide" both sides by 10, do so by multiplying both sides by the modulo-15
multiplicative inverse of 10. What you will discover in attempting to do so is that
10 has no multiplicative inverse in the modulo-15 world!
It is therefore important to remember that the property developed here is a
cancellation property and not a division operation.

Cancellation Law: Can cancel a in ab = ac (mod m) if gcd(a, m) = 1


Proof: If ab = ac (mod m) then m | (ab-ac) [defn of equality mod m], i.e. m | a(b-c).
Ifgcd(a, m) = 1 then m|a, so m | (b-c), i.e. b=c (mod m).
Note: if gcd(a, m) > 1 then we can't always cancel, e.g. 21=24 (mod 6), but can't
cancel the 2's

Fermat's Little Theorem: ap-1 = 1 (mod p) if p prime, gcd(a, p) = 1


Proof: If p is prime and gcd(a,p) = 1 then the
numbers 1a, 2a, ... (p-1)a are distinct (mod p)
since if n1a = n2a (mod p) then n1 = n2 (mod p)
by the Cancellation Law. Since none of
1a, 2a, ... (p-1)a are zero (mod p) and there are
only (p-1) distinct non-zero numbers (mod p),
the numbers 1a, 2a, ... (p-1)a must be
congruent to 1, 2, ... p-1 in some order.
Multiply all these congruences together to get:

a 2a (mod 5) 3a (mod 5) 4a (mod 5)


1
2
3
4
2

a2a...(p-1)a = 12...(p-1) (mod p)


ap-1(p-1)! = (p-1)! (mod p)
ap-1 = 1 (mod p)

(since gcd((p-1)!, p) = 1 the Cancellation Law


applies.

a a2 (mod 5) a3 (mod 5) a4 (mod 5)


1
1
1
1
2

You might also like