Processing math: 100%
Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Mathematics LibreTexts

3.1: Modulo Operation

( \newcommand{\kernel}{\mathrm{null}\,}\)

Definition: Modulo

Let m Z+.

a is congruent to b modulo m denoted as ab(modn), if a and b  have the remainder when they are divided by n, for  a,bZ.

Example 3.1.1:

Suppose n=5, then the possible remainders are 0,1,2,3, and 4, when we divide any integer by 5.

Is 611(mod5)? Yes, because 6 and 11 both belong to the same congruent/residue class 1. That is to say when 6 and 11 are divided by 5 the remainder is 1.

Is 715(mod5)? No, because 7 and 15 do not belong to the same congruent/residue class. Seven has a remainder of 2, while 15 has a remainder of 0, therefore 7 is not congruent to 15(mod5). That is 715(mod5).

Example 3.1.2: Clock arithmetic

Find 18:00, that is find 18(mod12).

Solution

18mod(12)6. 6 pm.

Properties

Let nZ+. Then

Theorem 1 :

Two integers a and b are said to be congruent modulo n, ab(modn), if all of the following are true:

a) m(ab).

b) both a and b have the same remainder when divided by n.

c) ab=kn, for some kZ.

NOTE: Possible remainders of n are 0,...,n1.

Reflexive Property

Theorem 2:

The relation " " over Z is reflexive.

Proof: Let aZ.

Then aa=0(n), and 0Z.

Hence aa(modn).

Thus congruence modulo n is Reflexive.

Symmetric Property

Theorem 3:

The relation " " over Z is symmetric.

Proof: Let a,bZ such that ab (mod n).

Then ab=kn, for some kZ.

Now ba=(k)n and kZ.

Hence ba(modn).

Thus the relation is symmetric.

Antisymmetric Property

Is the relation " " over Z antisymmetric?

Counter Example: n is fixed

choose: a=n+1,b=2n+1, then

ab(modn) and ba(modn)

but ab.

Thus the relation " "on Z is not antisymmetric.

Transitive Property

Theorem 4 :

The relation " " over Z is transitive.

Proof: Let a,b,c Z, such that ab(modn) and bc(modn).

Then a=b+kn,k Z and b=c+hn,h Z.

We shall show that ac(modn).

Consider a=b+kn=(c+hn)+kn=c+(hn+kn)=c+(h+k)n,h+k Z.

Hence ac(modn).

Thus congruence modulo n is transitive.

Theorem 5:

The relation " " over Z is an equivalence relation.

Modulo classes

Let . The relation on by ab if and only if , is an equivalence relation. The Classes of have the following equivalence classes:

.

 

Example of writing equivalence classes:

Example 3.1.3:

The equivalence classes for (mod3) are (need to show steps):

.

.

.

 

Computational aspects:

Finding "mod 5"

%%python3
print( "integer  integer mod 5")
for i in range(30):
    print(i, "       ", i%5)

Code 3.1.1 (Python):

%%python3




This page titled 3.1: Modulo Operation is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Pamini Thangarajah.

Support Center

How can we help?