Modular Arithmetic Theorems



On this page my goal is to explain and prove some important theorems in modular arithmetic in hopes for you to gain a better understanding of why the theorems are important and how they work.

Important Theorems in Modular Arithmetic


Theorem 1

If a ≡ b (mod m) and c ≡ d (mod m), then (a + c) ≡ (b + d) (mod m)

Given a ≡ b (mod m) and c ≡ d (mod m), we know by the Congruence definition that a ≡ b (mod m) implies m ∣ (a-b) and c ≡ d (mod m) implies m ∣ (c-d). Then by definition of divides, which states for some integers x, y, and z, x ∣ y if xz=y, we know for some integers k and j ,

mk=(a-b) and mj=(c-d)

Which implies that,

mk+mj=(a-b) +(c-d) => m(k+j)= (a+c)-(b+d)

Since k+j is an integer because the set of all integers is closed under addition we know by the congruence definition that m(k+j)= (a+c)-(b+d) implies (a+c) ≡ (b+d) (mod m). Therefore, If a ≡ b (mod m) and c ≡ d (mod m), then (a + c) ≡ (b + d) (mod m). Q.E.D.

A similar process can be done to prove Theorem 2. I’ll let you try to prove Theorem 2 using what you have learned so far.

Theorem 2

If a ≡ b (mod m) and c ≡ d (mod m), then (a ⋅ c) ≡ (b ⋅ d) (mod m)

Lemma 1

For any natural numbers c and n, we have c · 10n ≡ c (mod 9).

Proof:
Given natural numbers c and n and c ⋅ 10n ≡ c (mod 9) we know that c ≡ c and 10n ≡ c (mod 9). This is because 10 ≡ 1 (mod 9), then suppose we combine the equation with itself to obtain 100 = 10 ⋅ 10 ≡ 1 ⋅ 1 ≡ 1 (mod 9). We can do this as many times as necessary, (e.g., n times), and therefore have 10n ≡ 1n ≡ 1 (mod 9) for any natural number n. Thus, by Theorem 2 we can combine c ≡ c and 10n ≡ c (mod 9) to obtain c · 10n ≡ c (mod 9). Therefore, for any natural numbers c and n, we have c · 10n ≡ c (mod 9).

This is a shortcut for knowing any congruence of c · 10n in mod 9.

Fermat’s Little Theorem:

If p is prime and p ∤ a , then ap-1 ≡ 1 mod p


Proof:
We will prove Fermat’s Little Theorem by induction. For this proof we will use the Binomial Theorem which states:

For integers a, b and n ,

(a+b)n = ∑ i=0, n (n Cr k)(a n-k )(bk) .

Where k and n are integers.

Consider, a=1 for ap-1 we know p ∤ a because p is prime and the only integer that divides 1 is itself. So 1p-1 ≡ 1 mod p is true. Assume that ap-1 ≡ 1 mod p is true. By multiplying a to both sides of ap-1 ≡ 1 mod p we obtain the expression ap ≡ a mod p . Now we want to show that based on our assumption (a+1)p-1 ≡ 1 mod p is also true. By the Binomial Theorem we know,

(a+1)p = ∑ i=0, n (p Cr k)(a p-k )(1k) .

Furthermore,


i=0, n (p Cr k)(a p-k )(1k = ap + (p Cr 1)(ap-1)(1)+ (p Cr 2)(ap-2)(12) +...+(p Cr p-1)(a)(1p-1)+1p

Note that 1 raised to the power of any integer is always 1 and that p divides into any binomial coefficient of the form, (p Cr k) because (p Cr k)=(p!)/(k!(p-k)1) indicating that (p Cr k)=p[(p-k!)/(k!(p-k)!)] => p ∣ p[(p-1!)/(k!(p-k)1)]. By translating all of our term in ap + (p Cr 1)(ap-1)(1)+ (p Cr 2)(ap-2)(12) +...+(p Cr p-1)(a)(1p-1)+1p to classes of mod p all of are middle terms go to [0] because any multiple of p is [0] in mod p . Thus, we are left with the following terms: (a+1)p = ap +1. Thus, (a+1)p ≡ ap +1 mod p
Therefore, if ap-1 ≡ 1 mod p is true then (a+1)p-1 ≡ 1 mod p is true and since we know ap-1 ≡ 1 mod p is true for a=1 we know that it is true for all integers. Q.E.D.


Importance: Fermat’s Little Theorem is important in number theory because it helps use compute powers of integers modulo prime numbers. It has a fundamental role in the application of public-key cryptography which we will dive into more deeply on the Application page.

Chinese Remainder Theorem:

Let m1 ,m2 ,…,mk be pairwise relatively prime. Then the system of simultaneous linear congruences
x ≡ c1 (mod m1 ),
x ≡ c2 (mod m2 ), …,
x ≡ ck (mod mk )

always has a solution, which is of the form x ≡ c (mod m1m2 … mk ).


Before I start this proof I would like to list some Lemmas I feel are vital for proving The Chinese Remainder Theorem:

Lemma C.1

Let m and a1, . . . , an be positive integers. If m is relatively prime to each of a1, . . . , an then it is relatively prime to their product a1 · · ·an .

Lemma C.2

Let m and a1, . . . , an be positive integers. If m is a multiple of each of a1, . . . , an, then m is a multiple of [ a1, . . . , an].

Lemma C.3

Let a1, . . . , an be positive integers. If a1, . . . , an are pairwise relatively prime (that is, (ai , aj ) = 1 for i ≠ j), then [ a1, . . . , an] = a1 · · ·an .

Proof:
Suppose pk is equal to the product of some combination of the mi’s. Then by Lemma C.1,

(pk, mk) = 1

Hence, there exist

sk, tk such that skpk + tkmk = 1 which implies skpk = 1 (mod mk)

Now we let,

x = a1p1s1 + a2s2p2 + · · · + anpnsn.

Further suppose that there exist pj such that j ≠ i then, we know that mk pj since all the mi’s are relatively prime. Now when we mod mk all the terms but the k-th term are [0] in mod mk:

x = akpksk = ak · 1 = ak (mod mk).

This shows x is a solution to the system of congruences giving us a formula for x. So now we just need to show that for two solutions to the system of congruences x and y that x = y (mod m1 · · · mn). So now we have,

x = a1 (mod m1) and y = a1 (mod m1)
x = a2 (mod m2) and y = a2 (mod m2)
.
.
.
x = an (mod mn) and y = an (mod mn)

By using a bit of algebra we see,

x = ak = y (mod mk) so (x − y) = 0 (mod mk) and by definition 3 we know mk ∣ (x − y).

Thus, (x − y) is a multiple of all the mi’s, so [m1, . . . , mn] ∣ (x − y). But the mi’s are all pairwise relatively prime by our given, so by Lemma C.3, m1 · · · mn ∣ (x − y), or x ≡ y (mod m1 · · · mn). This means that the solution to the congruences is unique. Therefore,
Let m1 ,m2 ,…,mk be pairwise relatively prime. Then the system of simultaneous linear congruences

x ≡ c1 (mod m1 ),
x ≡ c2 (mod m2 ), …,
x ≡ ck (mod mk )

always has a solution, which is of the form x ≡ c (mod m1m2 … mk ). Q.E.D.


Importance: This is a special case for Theorem 4 where the mi’s , i={1, 2, 3,..., k} , are reactively prime meaning no integer greater than one that divides them all. This Theorem allows us to easily indicate whether a system of congruences has a solution that can be found and how to find that solution. The Chinese Remainder Theorem has an important role in Cryptography which we will later discuss on the Application page.