COMPSCI 225:
Discrete Structures in Mathematics and Computer Science

Integers and Divisibility

Definitions

Basic objects we use in this course

Link copied

Factors

Link copied

Let mm and nn be integers. Then we say that mm is a factor of nn (or a divisor of nn ), or that mm divides nn , if n=kmn = k \cdot m for some integer kk .

Prime numbers

Link copied

A prime number is a positive integer nn which has exactly two positive factors, namely 11 and nn itself.

Rational numbers

Link copied

A rational number is any number rr that can be written in the form mn\frac{m}{n} where mm and nn are integers and n>0n > 0 .

The integer mm is called the numerator and the integer nn is called the denominator of the rational number r=mnr = \frac{m}{n} .

The set of all rational numbers is denoted by Q\mathbb{Q} .


Example 2.1.Link copied

55 , 00 , 23\frac{\phantom{-}2}{-3} (=23= \frac{-2}{\phantom{-}3} ), and 11123\frac{11}{123} are rational numbers.

Every integer kk is a rational number (because k=k1k = \frac{k}{1}\, ).


Basic properties of integers

The following hold for all integers kk , mm and nn\, :

Associative laws:

 k+(m+n)= (k+m)+nk(mn)= (km)n\ k+(m+n)= \ (k+m)+n \qquad \qquad k \cdot (m \cdot n) = \ (k \cdot m) \cdot n

Commutative laws:

 k+m= m+kkm= mk \ k+m= \ m+k \qquad \qquad \qquad \qquad \qquad k \cdot m= \ m \cdot k

Identity laws:

 k+0= kk1= k \ k+0 = \ k \qquad \qquad \qquad \qquad \qquad \qquad \qquad k \cdot 1 = \ k

Distributive law:

k(m+n) = (km)+(kn)k \cdot (m+n) \ = \ (k \cdot m) + (k \cdot n)

Other properties:

 k+(k)= 0k0 = 0\ k+(-k) = \ 0 \qquad \qquad \qquad \qquad \qquad \qquad k \cdot 0\ = \ 0

Transitivity

Link copied

If kk is a factor of mm , and mm is a factor of nn , then kk is a factor of nn .

Proof. If m=kum = ku and n=mvn = mv for integers uu and vv , then n=mv=(ku)v=k(uv)n = mv = (ku)v = k(uv) , with uvZuv \in \Z .

Anti-symmetry

Link copied

Let m,nm, n be integers such that m>0m>0 and n>0n>0 : If mm is a factor of nn , and nn is a factor of mm , then m=nm = n .

Proof. Since mm is a factor of nn we have n=mkn = mk for some integer k1k \ge 1 . Hence mnm \le n . Similarly, if nn is a factor of mm then nmn \le m . Thus mnm \le n and nmn \le m , which together imply that m=nm = n .

Notation and summary

Link copied

We often write mnm \mid n when mm is a factor of nn .

With this notation, we can summarise properties of the “factor” relation as follows. For all positive integers mm and nn :

nnn \mid n
[reflexive]
• If kmk \mid m and mnm \mid n then knk \mid n
[transitive]
• If mnm \mid n and nmn \mid m then m=nm = n
[anti-symmetric]

Further exercises

Link copied

Let a,b,cZa, b, c \in \Z . Prove the following statements.

Is it true that if a(bc)a \mid (bc) then either aba \mid b or aca \mid c ?

Warning: Do not confuse the statement (or relation) aba \mid b with the number a/ba/b .


Finding all factors of a positive integer

Let nn be a positive integer. How do we find all factors of nn ?

But first, why would we want to find all factors of nn ?

Secure data transmission (e.g. for internet banking) requires methods of encryption that are impervious to interception.

One of the principal methods (called the ‘RSA algorithm’) uses arithmetic based on integers expressible as product of two large prime numbers, and the difficulty of ‘cracking’ messages encrypted using this method relies on the difficulty of factorising large integers (with 300 digits or more). For more discussion see Section 8.4.

Algorithm for finding all factors of a positive integer

Link copied

For any positive integer nn , let Factors(n)(n) denote the set of all (positive) factors of nn .

For example, Factors(90)={1,2,3,5,6,9,10,15,18,30,45,90}(90) = \{1,2,3,5,6,9,10,15,18,30,45,90\} .

Question: Given nn , how do we find Factors(n)(n) ?

Simple algorithm - called FindFactors(n)(n) :

Given the positive integer nn as input,

  1. Initialise k=1k = 1 ;
  2. if k>nk > n then stop; otherwise if knk \mid n then output kk ;
  3. Increment kk by 11 (i.e. kk+1k \leftarrow k+1 ), then go to step 2.

Algorithm correctness

Link copied

An algorithm is called correct if it terminates and satisfies its specification - that is, if it does what it is expected to do.

This algorithm terminates after nn steps, since kk is incremented at each iteration.

Correctness in this case means that the algorithm should find all factors of nn .

Proof of correctness of FindFactors (n)(n) :

These two things ensure that mm is an output of the algorithm if and only if mm is a factor of mm , so the algorithm is correct.


Lemma 2.1 Let nn be any positive integer, and also suppose that n>1n > 1 . If kk is the smallest factor of nn with k>1k > 1 , then kk is prime.

For example, the smallest factor of 1515 is 33 , which is prime.

Proof (by contradiction).

Let kk be the smallest factor of nn with k>1k > 1 . Suppose, for a contradiction, that kk is NOT prime. Then kk has some factor jj with 1<j<k1 < j < k . But now jkj \mid k and knk \mid n , so jnj \mid n , and therefore jj is a factor of nn smaller than kk , and with j>1j > 1 . This contradicts the definition of kk . Hence the supposition that kk was not prime is false, which completes the proof.

The Fundamental Theorem of Arithmetic

Link copied

This theorem is fundamental to the study of integers: Every integer n>1n > 1 can be written as a product of prime numbers.

For example, 90=233590 = 2 \cdot 3 \cdot 3 \cdot 5 and 2016=253272016 = 2^5 \cdot 3^2 \cdot 7 .

We will discuss this theorem again in Section 3.2. There are many ways to prove this. One of them is to prove the correctness of the following ‘constructive’ algorithm:

Given the integer n>1n > 1 as input,

  1. Initialise m=nm = n ;
  2. Find and output the smallest factor kk of mm with k>1k > 1 ;
  3. If k=mk = m then stop; otherwise replace mm by mk\frac{m}{k} , and go to step 2.

Proof of correctness

Link copied

The algorithm always terminates, since the value of mm decreases each time that step (3) is executed, unless k=mk = m .

Next, let the outputs of the algorithm be k1,k2,,ksk_1, k_2, \dots, k_s , and let m1,m2,,msm_1, m_2, \dots, m_s be the corresponding values taken by mm .

By Lemma 2.1 each kik_i is prime, since it is the smallest factor of some integer mim_i greater than 11 .

Also m1=n=k1m2m_1 = n = k_1 \cdot m_2 , and then m2=k2m3m_2 = k_2 \cdot m_3 , and so on, until ms1=ks1msm_{s-1} = k_{s-1} \cdot m_s , and then ms=ks1=ksm_s = k_s \cdot 1 = k_s .

Thus

nn
=k1m2=k1k2m3==k1k2k3ks2ms1= k_1 \cdot m_2 = k_1 \cdot k_2 \cdot m_3 = \ldots = k_1 \cdot k_2 \cdot k_3 \cdot \ldots \cdot k_{s-2} \cdot m_{s-1}

=k1k2k3ks1ms=k1k2k3ks1ks= k_1 \cdot k_2 \cdot k_3 \cdot \ldots \cdot k_{s-1} \cdot m_{s} = k_1 \cdot k_2 \cdot k_3 \cdot \ldots \cdot k_{s-1} \cdot k_{s} ,

which gives nn as a product of the primes k1,k2,,ksk_1, k_2, \dots, k_s .


Example 2.2.Link copied

Take n=90n = 90 . Then the algorithm proceeds as follows:

  • m=90m = 90 [initialisation];
  • Output k=2k = 2 , and replace mm by 902=45\frac{90}{2} = 45 ;
  • Output k=3k = 3 , and replace mm by 453=15\frac{45}{3} = 15 ;
  • Output k=3k = 3 , and replace mm by 153=5\frac{15}{3} = 5 ;
  • Output k=5k = 5 , and stop [since k=5=mk = 5 = m ].

This algorithm gives 90=233590 = 2 \cdot 3 \cdot 3 \cdot 5 .

Example 2.3.Link copied

Take n=63756n = 63756 . Then the algorithm proceeds as follows:

  • m=63756m = 63756 [initialisation];
  • Output k=2k = 2 , and replace mm by 637562=31878\frac{63756}{2} = 31878 ;
  • Output k=2k = 2 , and replace mm by 318782=15939\frac{31878}{2} = 15939 ;
  • Output k=3k = 3 , and replace mm by 159393=5313\frac{15939}{3} = 5313 ;
  • Output k=3k = 3 , and replace mm by 53133=1771\frac{5313}{3} = 1771 ;
  • Output k=7k = 7 , and replace mm by 17717=253\frac{1771}{7} = 253 ;
  • Output k=11k = 11 , and replace mm by 25311=23\frac{253}{11} = 23 ;
  • Output k=23k = 23 , and stop [since k=23=mk = 23 = m ].

This algorithm gives 63756=22337112363756 = 2 \cdot 2 \cdot 3 \cdot 3 \cdot 7 \cdot 11 \cdot 23 .


Common divisors

Let mm and nn be positive integers.

A common divisor of mm and nn is any (positive) integer kk that divides both mm and nn .

The greatest common divisor of mm and nn is the largest integer kk that divides both mm and nn . It is denoted by gcd(m,n)\gcd(m,n) .


Example 2.4.Link copied The divisors of 1818 are 1,2,3,6,91,2,3,6,9 and 1818 , and the divisors of 2424 are 1,2,3,4,6,8,121,2,3,4,6,8,12 and 2424 , and therefore the common divisors of 1818 and 2424 are 1,2,31,2,3 and 66 .

The greatest common divisor is gcd(18,24)=6\gcd(18,24) = 6

Lemma 2.2 If kk is a common divisor of mm and nn , then kk divides am+bnam + bn for all integers aa and bb .

Proof. Since kk divides mm and nn , we know that m=krm = kr and n=ksn = ks for integers rr and ss . It then follows that

am+bn=a(kr)+b(ks)=k(ar+bs) am + bn = a(kr) + b(ks) = k(ar + bs)

and therefore kk divides am+bnam+bn . \Box

As a corollary, also kk divides ambnam - bn for all integers aa and bb (because we can simply replace bb by b-b in the above proof).


Example 2.5.Link copied Let mNm \in \N be an integer such that m>0m > 0 . Show that gcd(m,0)=m\gcd( m, 0 ) = m .

Does gcd(0,0)\gcd( 0, 0 ) make sense?

The Division Theorem (Quotient and Remainder)

Link copied

Let mm and nn be integers with n>0n > 0 . Then there exist integers qq and rr such that m=qn+rm = qn+r , with 0r<n0 \le r < n .

The integers qq and rr are called the quotient and remainder of mm on division by nn , respectively.

Note that the remainder rr has to be less than nn . Also note that nn is a factor of mm if and only if the remainder rr is zero.

Proof Consider all multiples of nn in increasing order, namely

,4n,3n,2n,n,0,n,2n,3n,4n,\dots, -4n, -3n, -2n, -n, 0, n, 2n, 3n, 4n, \dots

Among these, find the largest multiple qnqn of nn with the property that qnmqn \le m , and then take r=mqnr = m - qn .

Then r0r \ge 0 (because mqnm \ge qn ), and if rnr \ge n then we have mqn=rnm - qn = r \ge n , and therefore mn+qn=(q+1)nm \ge n+qn = (q+1)n .

But this shows there is a LARGER multiple (q+1)n(q+1)n of nn with (q+1)nm(q+1)n \le m , and so contradicts the choice of q.q.

Thus m=qn+rm = qn +r , and 0r<n0 \le r < n , as required.


Example 2.6.Link copied When we divide m=111m = 111 by n=15n = 15 we get 111=715+6111 = 7 \cdot 15 + 6 , with quotient q=7q = 7 and remainder r=6r = 6 .

The Euclidean algorithm

This is a fast algorithm for finding greatest common divisors. It was written down by Euclid in about 300BC, and re-discovered independently in India and China centuries later.

Euclidean algorithm

Link copied

Let the input be positive integers mm and nn .

The main idea of the algorithm is that if m=qn+rm = qn + r then

gcd(m,n) = gcd(n,r).\gcd( m, n ) \ = \ \gcd( n, r ).

Termination of the algorithm is provided by the case gcd(m,0)=m\gcd( m, 0 ) = m .

We give the algorithm in detail:

  1. If m<nm < n , then set a=na = n and b=mb = m ; {} or if m>nm > n , then set a=ma = m and b=nb = n ; {} or if m=nm = n , then output nn as gcd(m,n)\gcd(m,n) and stop;

  2. Apply the division theorem to find integers qq and rr such that a=qb+ra = qb+r , with 0r<b0 \le r < b ;

  3. If r=0r = 0 then output bb as gcd(m,n)\gcd(m,n) and stop; otherwise re-set a=ba = b and then re-set b=rb = r , and go to step 2.


Example 2.7.Link copied Take m=120m = 120 and n=25n = 25 . Then proceed as follows:
  1. a=120a = 120 and b=25b = 25 [initialisation]
  2. Find 120=425+20120 = 4 \cdot 25 + 20 , and re-set a=25a = 25 and b=20b = 20 ;
  3. Find 025=120+5\phantom{0}25 = 1 \cdot 20 + 5 , and re-set a=20a = 20 and b=5b = 5 ;
  4. Find 020=45+0\phantom{0}20 = 4 \cdot 5 + 0 , output b=5b = 5 and stop [since r=0r = 0 ].

This algorithm gives gcd(120,25)=5\gcd(120,25) = 5 .


Example 2.8.Link copied

Take m=148m = 148 and n=784n = 784 . Then proceed as follows:

  1. a=784a = 784 and b=148b = 148 [initialisation]
  2. Find 784=5148+44784 = 5 \cdot 148 + 44 , and re-set a=148a = 148 and b=44b = 44 ;
  3. Find 148=344+16148 = 3 \cdot 44 + 16 , and re-set a=44a = 44 and b=16b = 16 ;
  4. Find 044=216+12\phantom{0}44 = 2 \cdot 16 + 12 , and re-set a=16a = 16 and b=12b = 12 ;
  5. Find 016=112+4\phantom{0}16 = 1 \cdot 12 + 4 , and re-set a=12a = 12 and b=4b = 4 ;
  6. Find 012=34+0\phantom{0}12 = 3 \cdot 4 + 0 , output b=4b = 4 and stop [since r=0r = 0 ].

This algorithm give gcd(148,784)=4\gcd(148,784) = 4 .

Analysis of the Euclidean Algorithm

Link copied

First, we can observe that the values of aa and bb decrease each time that step (3) is executed, except when r=0,r = 0, and it follows that the algorithm always terminates.

Now suppose the algorithm terminates after tt steps. We wish to show that the value output by the algorithm is the greatest common divisor of the integers aa and bb . The simplest way to show this is to write a=bq+ra = bq + r , where 0r<b0 \le r < b , and to note that the correctness of the algorithm follows from the correctness, at each iteration, of the statement

gcd(a,b)=gcd(b,r) \gcd( a, b ) = \gcd( b, r )

Lemma 2.3 Let a,ba, b be positive integers and let a=bq+ra = bq + r where 0r<b0 \le r < b . Then gcd(a,b)=gcd(b,r) \gcd( a, b ) = \gcd( b, r ) .

Proof. Consider the sets S1={dP:dadb}S_1 = \{ d \in \mathbb{P} : d \mid a \land d \mid b \} and S2={dP:dbdr}S_2 = \{ d \in \mathbb{P} : d \mid b \land d \mid r \} . So S1S_1 is the set of common divisors of aa and bb , while S2S_2 is the set of common divisors of bb and rr . We will show that S1=S2S_1 = S_2 , and hence they have the same largest element.

So let dS1d \in S_1 . Then dad \mid a and dbd \mid b and so by Lemma 2.2 we have that dd is a divisor of abq=ra - bq = r . Hence dbd \mid b and drd \mid r and so dS2d \in S_2 . Conversely, suppose dS2d \in S_2 . Then dbd \mid b and drd \mid r and so d(bq+r)=ad \mid (bq + r) = a . So dad \mid a and dS1d \in S_1 . It follows that S1=S2S_1 = S_2 . \Box

Extended Euclidean Algorithm

Link copied

The extended Euclidean algorithm computes not only the integer d=gcd(a,b)d = \gcd( a,b ) , but also integers s,ts, t such that d=as+btd = as + bt . These integers are interesting for some applications. These integers can also be computed by “reversing” the calculations in Euclid’s algorithm.

Example 2.9.Link copied

Recall the calculations from Example~2.7. Working backwards we have

55
=25120= 25 - 1 \cdot 20
=51(120425)= 5 - 1 \cdot ( 120 - 4 \cdot 25)

=5251120= 5 \cdot 25 - 1 \cdot 120 .

Example 2.10.Link copied

Using the calculations from Example 2.8 find integers s,ts, t such that 148s+784t=4148s + 784 t = 4 .

Congruences and modular arithmetic

Binary arithmetic

Link copied

The set of integers can be partitioned into two subsets:

Even integers {,8,6,4,2,0,2,4,6,8, } \{\dots, -8, -6, -4, -2, 0, 2, 4, 6, 8, \dots \ \}

Odd integers {,7,5,3,1,1,3,5,7,9, } \{\dots, -7, -5, -3, -1, 1, 3, 5, 7, 9, \dots \ \}

These are the sets of integers that leave remainder 00 or 11 on division by 22 , respectively, so we can label them as [0][0] and [1][1] .

We can write [0]+[0]=[0]\,[0] + [0] = [0] , [0]+[1]=[1][0] + [1] = [1] , [1]+[0]=[1][1] + [0] = [1] and [1]+[1]=[0][1] + [1] = [0] , to indicate that

Similarly, we write [0][0]=[0]\,[0] \cdot [0] = [0] , [0][1]=[0][0] \cdot [1] = [0] , [1][0]=[0][1] \cdot [0] = [0] and [1][1]=[1][1] \cdot [1] = [1] .

Integer congruence

Link copied

Let mm be any integer greater than 11 .

We say that two integers aa and bb are congruent modulo mm , and write aba \equiv b (mod mm ), if aa and bb leave the same remainder on division by mm .

Example 2.11.Link copied

173717 \equiv 37 (mod 1010 ), since both leave remainder 77 on division by 1010 .

Similarly, aba \equiv b (mod 22 ) if and only if aa and bb are both even (leaving remainder 00 on division by 22 ) or both odd (leaving remainder 11 on division by 22 ).

Generally, n0n \equiv 0 (mod mm ) if and only if nn is a multiple of mm (leaving remainder 00 on division by mm ).


Example 2.12.Link copied

What are the integers congruent to 11 mod 33 ?

These are   \ \ldots 14- 14 , 11- 11 , 8- 8 , 5- 5 , 2- 2 , 11 , 44 , 77 , 1010 , 1313 ,   \ldots \ .

Note that any two of these differ by a multiple of 33 .

For example, 164=12=3416 - 4 = 12 = 3 \cdot 4 , and 10(8)=18=3610 - (-8) = 18 = 3 \cdot 6 .

In general, we have (3a+1)(3b+1)=3a3b=3(ab)(3a+1)-(3b+1) = 3a - 3b = 3(a-b) .

Theorem 2.1 aba \equiv b (mod mm ) if and only if aba-b is a multiple of mm

Proof: Suppose that division by mm gives a=qm+ra = qm+r and b=sm+tb = sm+t , with remainders rr and tt (both less than mm ). Then we have

ab=(qm+r)(sm+t)=(qs)m+(rt).a-b = (qm+r)-(sm+t) = (q-s)m + (r-t).

’Only if’ part: If aba \equiv b (mod mm ), then by definition, r=tr = t , and so ab=(qs)ma-b = (q-s)m , which is a multiple of mm .

’If’ part: If aba-b is a multiple of mm , then so is

(ab)(qs)m=rt.(a-b) - (q-s)m = r-t.

But 0r<m0 \le r < m and 0t<m0 \le t < m , so m<rt<m-m < r-t < m . Since the only multiple of mm strictly between m-m and +m+m is 00 , it follows that rt=0r-t = 0 , so r=tr = t , and thus aba \equiv b (mod mm ). \Box


Properties of congruence mod mm

These are easy to prove from the definition of congruence mod mm (viz. leaving the same remainder on division by mm ).

Congruence classes

Link copied

Let kk be any integer greater than 11 , and let mm be any integer.

By the division theorem, we have m=qk+rm = qk+r with 0  r < k0~\le~r~<~k . Then the set of all integers congruent to mm mod kk is the set of all integers leaving remainder rr on division by kk , namely

,3k+r,2k+r,k+r,r,k+r,2k+r,3k+r, \ldots, -3k+r, \, -2k+r, \, -k+r, r, \, k+r, \, 2k+r, \, 3k+r, \ldots \ .

This set is called the congruence class of mm mod kk , and is denoted by [m][m] .

Note that [m][m] contains mm (since m=qk+rm = qk+r ). Also [m]=[r][m] = [r] , and more generally, [m]=[n][m] = [n] if and only if mnm \equiv n (mod kk ).


The number of congruence classes mod kk is kk

Let kk be any integer greater than 11 . Then we know that for any integer mm , the congruence class [m][m] consists of all integers leaving the same remainder rr as mm on division by kk , and in particular, [m]=[r][m] = [r] , where 0r<k0 \le r < k .

It follows that every integer mm lies in exactly one of the kk congruence classes [0][0] , [1][1] , [2], ,[k ⁣ ⁣1][2], ~\dots, [k\!-\!1] .


Example 2.13.Link copied

there are just two congruence classes mod 22 , namely

[0]={ ,8,6,4,2,0,2,4,6, }[0] = \{ \ \ldots, -8, -6, -4, -2, 0, 2 ,4, 6, \ldots \ \} even integers

[1]={ ,7,5,3,1,1,3,5,7, }[1] = \{ \ \ldots, -7, -5, -3, -1, 1, 3 ,5, 7, \ldots \ \}\, odd integers.

Similarly, the ten congruence classes mod 1010 are

[0]={ ,50,40,30,20,10,0,10,20,30,40, }[0] = \{ \ \ldots, -50, -40, -30, -20, -10, 0, 10, 20 ,30, 40, \ldots \ \}
[1]={ ,49,39,29,19, 9,1,11,21,31,41, }[1] = \{ \ \ldots, -49, -39, -29, -19, \ \, -9, 1, 11, 21 ,31, 41, \ldots \ \}
[2]={ ,48,38,28,18, 8,2,12,22,32,42, }[2] = \{ \ \ldots, -48, -38, -28, -18, \ \, -8, 2, 12, 22 ,32, 42, \ldots \ \}
[3]={ ,47,37,27,17, 7,3,13,23,33,43, }[3] = \{ \ \ldots, -47, -37, -27, -17, \ \, -7, 3, 13, 23 ,33, 43, \ldots \ \}
[4]={ ,46,36,26,16, 6,4,14,24,34,44, }[4] = \{ \ \ldots, -46, -36, -26, -16, \ \, -6, 4, 14, 24 ,34, 44, \ldots \ \}
[5]={ ,45,35,25,15, 5,5,15,25,35,45, }[5] = \{ \ \ldots, -45, -35, -25, -15, \ \, -5, 5, 15, 25 ,35, 45, \ldots \ \}
[6]={ ,44,34,24,14, 4,6,16,26,36,46, }[6] = \{ \ \ldots, -44, -34, -24, -14, \ \, -4, 6, 16, 26 ,36, 46, \ldots \ \}
[7]={ ,43,33,23,13, 3,7,17,27,37,47, }[7] = \{ \ \ldots, -43, -33, -23, -13, \ \, -3, 7, 17, 27 ,37, 47, \ldots \ \}
[8]={ ,42,32,22,12, 2,8,18,28,38,48, }[8] = \{ \ \ldots, -42, -32, -22, -12, \ \, -2, 8, 18, 28 ,38, 48, \ldots \ \}
[9]={ ,41,31,21,11, 1,9,19,29,39,49, }.[9] = \{ \ \ldots, -41, -31, -21, -11, \ \, -1, 9, 19, 29 ,39, 49, \ldots \ \}.

The ring of all congruence classes mod kk

Any integer nn contained in the congruence class [r][r] is called a representative of the class.

The set of all congruence classes mod kk is denoted by Zk\Z_k . In other words,

Zk={[0],[1],[2],,[k ⁣ ⁣1]}\Z_k = \{ [0], [1], [2], \dots, [k\!-\! 1]\} .

Most books simply write Zk={0,1,,k1}\Z_k = \{ 0, 1, \dots, k-1 \} .

When equipped with addition and multiplication, Zk\Z_k is an example of an algebraic structure known as a ‘ring’, called the ring of integers modulo kk , and if pp is a prime number, then Zp\Z_p is a field. Prime fields are very useful in constructing error-correcting codes, and in cryptography.

Some more exercises

Link copied

Fix mNm \in \N and let a,b,c,dZa, b, c, d \in \Z be such that ab(modm)a \equiv b \pmod{m} and cd(modm)c \equiv d\pmod{m} . Show that

  1. a+cb+d(modm)a + c \equiv b + d \pmod{m} .
  2. acbd(modm)ac \equiv bd \pmod{m} .