0% found this document useful (0 votes)
237 views54 pages

MFCS - Unit-3

The document describes the Euclidean algorithm for finding the greatest common divisor (GCD) of two integers. It states that the Euclidean algorithm works by repeatedly dividing the larger number by the smaller number and using the remainders as the new inputs. This process is repeated until the remainder is zero, and the last non-zero remainder is the GCD of the original two integers. An example division sequence is shown to illustrate the algorithm.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
237 views54 pages

MFCS - Unit-3

The document describes the Euclidean algorithm for finding the greatest common divisor (GCD) of two integers. It states that the Euclidean algorithm works by repeatedly dividing the larger number by the smaller number and using the remainders as the new inputs. This process is repeated until the remainder is zero, and the last non-zero remainder is the GCD of the original two integers. An example division sequence is shown to illustrate the algorithm.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

WWW.JNTUKNOTES.

COM 1
WWW.JNTUKNOTES.COM 2
WWW.JNTUKNOTES.COM 3
WWW.JNTUKNOTES.COM 4
WWW.JNTUKNOTES.COM 5
WWW.JNTUKNOTES.COM 6
WWW.JNTUKNOTES.COM 7
WWW.JNTUKNOTES.COM 8
WWW.JNTUKNOTES.COM 9
WWW.JNTUKNOTES.COM 10
WWW.JNTUKNOTES.COM 11
WWW.JNTUKNOTES.COM 12
WWW.JNTUKNOTES.COM 13
WWW.JNTUKNOTES.COM 14
WWW.JNTUKNOTES.COM 15
WWW.JNTUKNOTES.COM 16
WWW.JNTUKNOTES.COM 17
WWW.JNTUKNOTES.COM 18
WWW.JNTUKNOTES.COM 19
WWW.JNTUKNOTES.COM 20
WWW.JNTUKNOTES.COM 21
WWW.JNTUKNOTES.COM 22
WWW.JNTUKNOTES.COM 23
WWW.JNTUKNOTES.COM 24
WWW.JNTUKNOTES.COM 25
WWW.JNTUKNOTES.COM 26
WWW.JNTUKNOTES.COM 27
WWW.JNTUKNOTES.COM 28
WWW.JNTUKNOTES.COM 29
WWW.JNTUKNOTES.COM 30
Number Theory
Properties of Integers
Let us denote the set of natural numbers (also called positive integers)by N and the set of
integers by Z.
i.e., N = {1, 2, 3...} and Z = {...., −2, −1, 0, 1, 2...}.
The following simple rules associated with addition and multiplication of these inte-gers are
given below:
(a). Associative law for multiplication and addition

(a + b) + c = a + (b + c) and (ab)c = a(bc), for all a, b, c ∈ Z.

(b). Commutative law for multiplication and addition a + b = b + a and ab = ba, for all a, b ∈
Z.

(c). Distritbutive law a(b + c) = ab + ac and (b + c)a = ba + ca, for all a, b, c ∈ Z.


(d). Additive identity 0 and multiplicative identity 1
a + 0 = 0 + a = a and a.1 = 1.a = a, for all a ∈ Z.
(e). Additive inverse of −a for any integer a
a + (−a) = (−a) + a = 0.
Definition: Let a and b be any two integers. Then a is said to be greater than b if a − b is
positive integer and it is denoted by a > b. a > b can also be denoted by b < a.

Basic Properties of Integers


Divisor: A non-zero integer a is said to be divisor or factor of an integer b if there exists an
integer q such that b = aq.
If a is divisor of b, then we will write a/b (read as a is a divisor of b). If a is divisor of b, then
we say that b is divisible by a or a is a factor of b or b is multiple of a. Examples: (a). 2/8,
since 8 = 2 × 4.
(b). −4/16, since 16 = (−4) × (−4).

(c). a/0 for all a ∈ Z and a ≠ 0, because 0 = a.0.

Theorem: Let a, b, c ∈ Z, the set of integers. Then,


(i). If a/b and b ≠ 0, then |a| ≤ |b|.
(ii). If a/b and b/c, then a/c.
(iii). If a/b and a/c, then a/b + c and a/b − c.
(iv). If a/b, then for any integer m, a/bm.
(v). If a/b and a/c, then for any integers m and n, a/bm + cn.
(vi). If a/b and b/a then a = ±b.
(vii). If a/b and a/b + c, then a/c.
(viii). If a/b and m ≠ 0, then ma/mb.
Proof:

(i). We have a/b ⇒ b = aq, where q ∈ Z.


Since b ≠ 0, therefore q ≠ 0 and consequently |q| ≥ 1.

WWW.JNTUKNOTES.COM 31
Also, |q| ≥ 1 ⇒ |a||q| ≥ |a| ⇒ |b| ≥
|a|.
(ii). We have a/b ⇒ b = aq1, where q1 ∈ Z.

b/c ⇒ c = bq2, where q2 ∈ Z.

103

c = bq2 = (aq1)q2 = a(q1q2) = aq, where q = q1q2 ∈ Z. ⇒ a/c.

(iii). We have a/b ⇒ b = aq1, where q1 ∈ Z.

a/c ⇒ c = aq2, where q2 ∈ Z.

Now b + c = aq1 + aq2 = a(q1 + q2) = aq, where q = q1 + q2 ∈ Z.


⇒ a/b + c.
Also, b − c = aq1 − aq2 = a(q1 − q2) = aq, where q = q1 − q2 ∈ Z.
⇒ a/b − c.
(iv). We have a/b ⇒ b = aq, where q ∈ Z.

For any integer m, bm = (aq)m = a(qm) = aq, where a = qm ∈ Z.


⇒ a/bm.
(v). We have a/b ⇒ b = aq1, where q1 ∈ Z.

a/c ⇒ c = aq2, where q2 ∈ Z.

Now bm + cn = (aq1)m + (aq2)n = a(q1m + q2n) = aq, where q = q1m + q2n ∈ Z


⇒ a/mb + cn.
(vi). We have a/b ⇒ b = aq1, where q1 ∈ Z.

b/a ⇒ a = bq2, where q2 ∈ Z.


b = aq1 = (bq2)q1 = b(q2q1)
⇒ b(1 − q2q1) = 0

q2q1 = 1 ⇒ q2 = q1 = 1 or q2 = q1 = −1 a = b or a
= −b i.e., a ± b. (vii). We have a/b ⇒ b = aq1,
where q1 ∈ Z. a/b + c ⇒ b + c = aq2, where q2 ∈ Z

Now, c = b − aq2 = aq1 − aq2 = a(q1 − q2) = aq, where q = q1 − q2 ∈ Z.


⇒ a/c.
(viii). We have a/b ⇒ b = aq1, where q1 ∈ Z.
Since m ≠ 0, mb = m(aq1) = ma(q1)

WWW.JNTUKNOTES.COM 32
⇒ ma/mb.
Greatest Common Divisor (GCD)
Common Divisor: A non-zero integer d is said to be a common divisor of integers a and b if
d/a and d/b.

Example:

(1). 3/ − 15 and 3/21 ⇒ 3 is a common divisor of 15, 21.

(2). ±1 is a common divisor of a, b, where a, b ∈ Z.

104
Greatest Common Divisor: A non-zero integer d is said to be a greatest common divisor
(gcd) of a and b if
(i). d is a common divisor of a and b; and
(ii). every divisor of a and b is a divisor of d.
We write d = (a, b)=gcd of a, b.
Example: 2, 3 and 6 are common divisors of 18, 24.
Also 2/6 and 3/6. Therefore 6 = (18, 24).
Relatively Prime: Two integers a and b are said to be relatively prime if their greatest
common divisor is 1, i.e., gcd(a, b)=1.
Example: Since (15, 8) = 1, 15 and 8 are relatively prime.
Note:
(i). If a, b are relatively prime then a, b have no common divisors.

(ii). a, b ∈ Z are relatively prime iff there exists x, y ∈ Z such that ax + by = 1.


Basic Properties of Greatest Common Divisors:
(1). If c/ab and gcd(a, c) = 1 then c/b.

Solution: We have c/ab ⇒ ab = cq1, q1 ∈ Z.

(a, c) = 1 ⇒ there exist x, y ∈ Z such that


ax + cy = 1.

ax + cy = 1 ⇒ b(ax + cy) = b
⇒ (ba)x + b(cy) = b ⇒ (cq1)x + b(cy) = b ⇒ c[q1x + by] = b
⇒ cq = b, where q = q1x + by ∈ Z ⇒ c/b.

(2). If (a, b) = 1 and (a, c) = 1, then (a, bc) = 1.

Solution: (a, b) = 1, there exist x1, y1 ∈ Z such that

ax1 + by1 = 1

⇒ by1 = 1 − ax1——————-(1)

WWW.JNTUKNOTES.COM 33
(a, c) = 1, there exist x2, y2 ∈ Z such that

ax2 + by2 = 1

⇒ cy2 = 1 − ax2——————-(2)
From (1) and (2), we have
(by1)(cy2) = (1 − ax1)(1 − ax2)

⇒ bcy1y2 = 1 − a(x1 + x2) + a2x1x2 ⇒ a(x1 + x2 − ax1x2) +

bc(y1y2) = 1

⇒ ax3 + bcy3 = 1, where x3 = x1 + x2 −ax1x2 and y3 = y1y2 are integers.

There exists x3, y3 ∈ Z such that ax3 + bcy3 = 1.

(3). If (a, b) = d, then (ka, kb) = |k|d., k is any integer.


Solution: Since d = (a, b) ⇒ there exist x, y ∈ Z such that
ax + by = d.

⇒ k(ax) + k(by) = kd ⇒ (ka)x + (kb)y = kd

105
(ka, kb) = kd = k(a, b)
a b
(4). If (a, b) = d, then ( d , d ) = 1.

Solution: Since (a, b) = d ⇒ there exist x, y ∈ Z such that ax + by = d.


⇒( ax+by)/d = 1
⇒ (a/d)x + (b/d)y = 1
Since d is a divisor of both a and b, a/d and b/d are both integers.
Hence (a/d,b/d) = 1.

Division Theorem (or Algorithm)


Given integers a and d are any two integers with b > 0, there exist a unique pair of integers q
and r such that a = dq + r, 0 ≤ r < b. The integer‘s q and r are called the quotient and the
remainder respectively. Moreover, r = 0 if, and only if, b|a.

Proof:

Consider the set, S, of all numbers of the form a+nd, where n is an integer.

S = {a - nd : n is an integer}

S contains at least one nonnegative integer, because there is an integer, n, that ensures a-nd ≥

WWW.JNTUKNOTES.COM 34
0, namely n = -|a| d makes a-nd = a+|a| d2

≥ a+|a| ≥ 0.

Now, by the well-ordering principle, there is a least nonnegative element of S, which we will
call r, where r=a-nd for some n. Let q = (a-r)/d = (a-(a-nd))/d = n. To show that r < |d|,
suppose to the contrary that r ≥ |d|. In that case, either r-|d|=a-md, where m=n+1 (if d is
positive) or m=n-1 (if d is negative), and so r-|d| is an element of S that is nonnegative and
smaller than r, a contradiction. Thus r < |d|.

To show uniqueness, suppose there exist q,r,q',r' with 0 ≤ r,r' < |d| such

that a=qd + r and a =q'd + r'.

Subtracting these equations gives d(q'-q) = r'-r, so d|r'-r. Since 0 ≤ r,r' < |d|, the difference r'-r
must also be smaller than d. Since d is a divisor of this difference, it follows that the
difference r'-r must be zero, i.e. r'=r, and so q'=q.

Example: If a = 16, b = 5, then 16 = 3 × 5 + 1; 0 ≤ 1 < 5.

106
Euclidean Algorithm for finding the GCD
An efficient method for finding the greatest common divisor of two integers based on the
quotient and remainder technique is called the Euclidean algorithm. The following lemma
provides the key to this algorithm.
Lemma: If a = bq + r, where a, b, q and r are integers, then gcd(a, b)=gcd(b, r). Statement:
When a and b are any two integers (a > b), if r1 is the remainder when a is divided by b, r2 is
the remainder when b is divided by r1, r3 is the remainder when r1 is divided by r2 and so on
and if rk+1 = 0, then the last non-zero remainder rk is the gcd(a, b).

Proof:

By the unique division principle, a divided by b gives quotient q and remainder r, such

that a = bq+r, with 0 ≤ r < |b|.

Consider now, a sequence of divisions, beginning with a divided by b giving quotient q1 and
remainder b1, then b divided by b1 giving quotient q2 and remainder b2, etc.

WWW.JNTUKNOTES.COM 35
a=bq1+b1, b=b1q2+b2,
b1=b2q3+b3,
...
bn-2=bn-1qn+bn, bn-
1=bnqn+1

In this sequence of divisions, 0 ≤ b1 < |b|, 0 ≤ b2 < |b1|, etc., so we have the sequence |b| >
|b1| > |b2| > ... ≥ 0. Since each b is strictly smaller than the one before it, eventually one of
them will be 0. We will let bn be the last non-zero element of this sequence.

From the last equation, we see bn | bn-1, and then from this fact and the equation before it, we
see that bn | bn-2, and from the one before that, we see that bn | bn-3, etc. Following the chain
backwards, it follows that bn | b, and bn | a. So we see that bn is a common divisor of a and b.

To see that bn is the greatest common divisor of a and b, consider, d, an arbitrary common
divisor of a and b. From the first equation, a-bq1=b1, we see d|b1, and from the second,
equation, b-b1q2=b2, we see d|b2, etc. Following the chain to the bottom, we see that d|bn.
Since an arbitrary common divisor of a and b divides bn, we see that bn is the greatest
common divisor of a and b.

Example: Find the gcd of 42823 and 6409.


Solution: By Euclid Algorithm for 42823 and 6409, we have
42823= 6.6409+ 4369, r1= 4369,
6409= 1.4369+2040, r2= 2040,
4369= 2.2040+289, r3 = 289,
2040= 7.289+ 17, r4 = 17, 289=
17.17+ 0, r5 = 0 r4 = 17 is the
last non-zero remainder.
d = (42823, 6409) = 17.

107
Example: Find the gcd of 826, 1890.
Solution: By Euclid Algorithm for 826 and 1890, we have
1890= 2.826+ 238,r1= 238
826= 3.238+ 112,r2= 112
238= 2.112+ 14,r3 = 14
112= 8.14 + 0, r4 = 0
r3 = 14 is the last non-zero remainder. d = (826, 1890) = 14.

****Example: Find the gcd of 615 and 1080, and find the integers x and y such that gcd(615,
1080) = 615x + 1080y.
Solution: By Euclid Algorithm for 615 and 1080, we have
1080 = 1.615 + 465, r1 = 465 − − − − − (1)
615 = 1.465 + 150, r2 = 150 − − − − − (2)
465 = 3.150 + 15, r3 = 15 − − − − − −(3)

WWW.JNTUKNOTES.COM 36
150 = 10.15 + 0, r4 = 0 − − − − − − − (4)
r3 = 15 is the last non-zero remainder.
d = (615, 1080) = 15. Now, we find x and y such that
615x + 1080y = 15.
To find x and y, we begin with last non-zero remainder as follows.
d = 15 = 465 + (−3).150; using (3)

=465 + (−3){615 + (−1)465}; using (2)


=(−3).615 + (4).465
=(−3).615 + 4{1080 + (−1).615}; using (1)
=(−7).615 + (4).1080
=615x + 1080y
Thus gcd(615, 1080) = 15 provided 15 = 615x + 1080y, where x = −7 and y = 4.
Example: Find the gcd of 427 and 616 and express it in the form 427x + 616y.
Solution: By Euclid Algorithm for 427 and 616, we have
616= 1.427+189,r1 = 189.........(1)
427= 2.189+49,r2 = 49............(2)
189= 3.49+ 42, r3 = 42..............(3)
49= 1.42+ 7,r4 = 7..................(4)
42= 6.7 + 0,r5 = 0....................(5) r5 = 7
is the last non-zero remainder.
d = (427, 616) = 7. Now, we find x and y such that
427x + 616y = 7.
To find x and y, we begin with last non-zero remainder as follows.
d = 7 = 49 + (−1).42; using (4)
=49 + (−1){189 + (−3).49}; using (3)
=4.49 − 189
=4.{427 + (−2).189} − 189; using (2)
=4.427 + (−8).189 − 189
=4.427 + (−9).189
=4.427 + (−9){616 + (−1)427}; using (1)
=4.427 + (−9).616 + 9.427
=13.427 + (−9).616
108
Thus gcd(427, 616) = 7 provided 7 = 427x + 616y, where x = 13 and y = −9.
Example: For any positive integer n, prove that the integers 8n + 3 and 5n + 2 are relatively
prime.
Solution: If n = 1, then gcd(8n + 3, 5n + 2)=gcd(11, 7) = 1. If
n ≥ 2, then we have 8n + 3 > 5n + 2, so we may write
8n + 3 = 1.(5n + 2) + 3n + 1, 0 < 3n + 1 < 5n + 2 5n + 2 = 1.(3n + 1) + 2n + 1,
0 < 2n + 1 < 3n + 1
3n + 1 = 1.(2n + 1) + n, 0 < n < 2n + 1
2n + 1 = 2.n + 1, 0 < 1 < n n = n.1 + 0.

WWW.JNTUKNOTES.COM 37
Since the last non-zero remainder is 1, gcd(8n + 3, 5n + 2) = 1 for all n ≥ 1.
Therefore the given integers 8n + 3 and 5n + 2 are relatively prime. Example:
If (a, b) = 1, then (a + b, a − b) is either 1 or 2.

Solution: Let (a + b, a − b) = d ⇒ d|a + b, d|a − b.


Then a + b = k1d........(1) and a
− b = k2d..........(2) Solving (1) and
(2), we have
2a = (k1 + k2)d and 2b = (k1 − k2)d d divides 2a and 2b d
≤gcd(2a, 2b) = 2 gcd(a, b) = 2, since gcd(a, b) = 1 d = 1 or 2.
Then 2a + b = k1d........ (1) and
a + 2b = k2d.......... (2)

3a = (2k1 − k2)d and 3b = (2k2 − k1)d d divides 3a and 3b d ≤gcd(3a,


3b) = 3 gcd(a, b) = 3, since gcd(a, b) = 1 d = 1 or 2 or 3.
But d cannot be 2, since 2a + b and a + 2b are not both even [when a is even and b is odd, 2a +
b is odd and a + 2b is even; when a is odd and b is even, 2a + b is even and a + 2b is odd;
when both a and b are odd 2a + b and a + 2b are odd.] Hence d = (2a + b, a + 2b) is 1 or 3.

Least Common Multiple (LCM)

Let a and b be two non-zero integers. A positive integer m is said to be a least common
multiple (lcm) of a and b if
(i) m is a common multiple of a and b i.e., a/m and b/m, and
(ii) c is a common multiple of a and b, c is also a multiple of m i.e., if a/c
and b/c, then m/c.

In other words, if a and b are positive integers, then the smallest positive integer that is divisible
by both a and b is called the least common multiple of a and b and is denoted by lcm(a, b).
Note: If either or both of a and b are negative then lcm(a, b) is always positive.
Example: lcm(5, -10)=10, lcm(16, 20)=80.

109
Prime Numbers

Definition: An integer n is called prime if n > 1 and if the only positive divisors of n are 1 and
n. If n > 1 and if n is not prime, then n is called composite.

Examples: The prime numbers less than 100 are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,
43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, and 97.

WWW.JNTUKNOTES.COM 38
Theorem: Every integer n > 1 is either a prime number or a product of prime numbers.

Proof: We use induction on n. The theorem is clearly true for n = 2. Assume it is true for every
integer < n. Then if n is not prime it has a positive divisor d ≠ 1, d ≠ n. Hence n = cd, where c
≠ n. But both c and d are < n and > 1 so each of c, d is a product of prime numbers, hence so
is n.

Fundamental Theorem of Arithmetic

Theorem: Every integer n > 1 can be expressed as a product of prime factors in only
one way, a part from the order of the factor.

Proof:

There are two things to be proved. Both parts of the proof will use he Well-ordering Principle
for the set of natural numbers.
(1) We first prove that every a > 1 can be written as a product of prime factors. (This
includes the possibility of there being only one factor in case a is prime.)
Suppose bwoc that there exists a integer a > 1 such that a cannot be written as a product of
primes.
By the Well-ordering Principle, there is a smallest such a.
Then by assumption a is not prime so a = bc where 1 < b, c < a.
So b and c can be written as products of prime factors (since a is the smallest positive integer
than cannot be.)
But since a = bc, this makes a a product of prime factors, a contradiction.
(2) Now suppose bwoc that there exists an integer a > 1 that has two different prime
factorizations, say a = p1 ··· ps = q1 ··· qt , where the pi and qj are all primes. (We allow
repetitions among the pi and qj . That way, we don‘t have to use exponents.) Then p1| a = q1
··· qt . Since p1 is prime, by the Lemma above, p1| qj for some j .
Since qj is prime and p1 > 1, this means that p1 = qj .
For convenience, we may renumber the qj so that p1 = q1 .
We can now cancel p1 from both sides of the equation above to get p2 ··· ps = q2 ··· qt . But
p2 ··· ps < a and by assumption a is the smallest positive integer with a non–unique prime
factorization.
It follows that s = t and that p2,...,ps are the same as q2,...,qt , except possibly in a different
order.
But since p1 = q1 as well, this is a contradition to the assumption that these were two different
factorizations.
Thus there cannot exist such an integer a with two different factorizations

4
Example: Find the prime factorisation of 81, 100 and 289. Solution: 81 = 3 × 3 × 3 × 3 = 3

110

WWW.JNTUKNOTES.COM 39
2 2
100 = 2 × 2 × 5 × 5 = 2 × 5
2
289 = 17 × 17 = 17 .

Theorem: Let m = p1a1 p2a2 ...pkak and n = p1b1 p2b2 ...pkbk . Then
min(a ,b ) min(a ,b ) min(a ,b )
gcd(m, n) = p1 1 1 × p2 2 2 × ... × pk kk
=∏ min(ai,bi)
pi , where min(a, b) represents the minimum of the two numbers a and b. max(a ,b )
max(a ,b ) max(a ,b )
lcm(m, n) = p1 1 1 × p2 2 2 × ... × pk kk
=∏ max(ai,bi)
pi , where max(a,b) represents the maximum of the two numbers a and b.

Theorem: If a and b are two positive integers, then gcd(a, b).lcm(a, b) = ab.

Proof: Let prime factorisation of a and b be

m= pa11 pa22 ...pakk and n = pb11 pb22 ...pbkk

Then gcd(a, b) = p1min(a1,b1) × p2min(a2,b2) × ... × pkmin(ak,bk)and lcm(m,

n) = p1max(a1,b1) × p2max(a2,b2) × ... × pkmax(ak,bk)

We observe that if min(ai, bi) is ai(or bi) then max(ai, bi) is bi(or ai), i = 1, 2.., n.

Hence gcd(a, b).lcm(a, b)

= p1min(a1,b1) × p2min(a2,b2) × ... × pkmin(ak,bk)× pmax(1a ,b ).pmax(2a ,b )...pmax(ka ,b ) 1 1 2 2 k k

[min(a ,b )+max(a ,b )] [min(a ,b )+max(a ,b )] [min(a ,b )+max(a ,b )]


=p1 1 1 1 1 .p2 2 2 2 2 ...pk kk kk

(a +b ) (a +b ) (a +b )
=p1 1 1 .p2 2 2 ...pk k k

a1 a2 ak b1 b 2 bk
=( p1 p2 ...pk )( p1 p2 ...pk )
=ab.

Example: Use prime factorisation to find the greatest common divisor of 18 and 30.
Solution: Prime factorisation of 18 and 30 are
1 2 0 1 1 1
18 = 2 × 3 × 5 and 30 = 2 × 3 × 5 .
gcd(18, 30) = 2min(1,1) × 3min(2,1) × 5min(0,1)
1 1 0
=2 × 3 × 5

WWW.JNTUKNOTES.COM 40
=2 × 3 × 1
=6.

Example: Use prime factorisation to find the least common multiple of 119 and 544.
Solution: Prime factorisation of 119 and 544 are
0 1 1 5 0 1
119 = 2 × 7 × 17 and 544 = 2 × 7 × 17 . lcm(119,

544) = 2max(0,5) × 7max(1,0) × 17max(1,1)


5 1 1
=2 × 7 × 17
=32 × 7 × 17
=3808.

Example: Using prime factorisation, find the gcd and lcm of

111
(i). (231, 1575) (ii). (337500, 21600). Verify also gcd(m, n). lcm(m, n) = mn.

Example: Prove that log3 5 is irrational number.


Solution: If possible, let log3 5 is rational number.

⇒ log3 5 = u/v , where u and v are positive integers and prime to each other.
3u/v = 5
u v
i.e., 3 = 5 = n, say.
This means that the integer n > 1 is expressed as a product (or power) of prime numbers (or a
prime number) in two ways.
This contradicts the fundamental theorem arithmetic.
log3 5 is irrational number.
Example: Prove that√ 5 is irrational number.
Solution: If possible, let√ 5 is rational number.
⇒√5 = u/v, where u and v are positive integers and prime to each other.
⇒ u2 = 5v2...................(1)
⇒ u2 is divisible by 5
⇒ u is divisible by 5 i.e., u = 5m.........(2)
From (1), we have 5v2 = 25m2 or v2 = 5m2
i.e., v2 and hence v is divisible by 5
i.e., v = 5n..........(3)
From (2) and (3), we see that u and v have a common factor 5, which contradicts the
assumption.
√5 is irrational number.

WWW.JNTUKNOTES.COM 41
Testing of Prime Numbers

Theorem: If n > 1 is a composite integer, then there exists a prime number p such that
p/n and p ≤√n.
Proof: Since n > 1 is a composite integer, n can be expressed as n = ab, where 1
< a ≤ b < n. Then a ≤√n.
If a >√n, then b ≥ a >√n.
n = ab >√n.√n = n, i.e. n > n, which is a contradiction.
Thus n has a positive divisor (= a) not exceeding√n.
a > 1, is either prime or by the Fundamental theorem of arithmetic, has a primefactor. In ither
ase, n has a prime factor≤√n.

Algorithm to test whether an integer n > 1 is prime:

Step 1: Verify whether n is 2. If n is 2, then n is prime. If not goto step 2.


Step 2: Verify whether 2 divides n. If 2 divides n, then n is not a prime. If 2 does not divides
n, then goto step (3).
Step 3: Find all odd primes p ≤ √n.If there is no such odd prime, then n is prime otherwise,
goto step (4).
Step 4: Verify whether p divides n, where p is a prime obtained in step (3). If p divides n, then
n is not a prime. If p does not divide n for any odd prime p obtained in step (3), then n is
prime.

112
Example: Determine whether the integer 113 is prime or not.
2
Solution: Note that 2 does not divide 113. We now find all odd primes p such that p ≤ 113.
2 2
These primes are 3, 5 and 7, since 7 < 113 < 11 .
None of these primes divide 113.
Hence, 113 is a prime.

Example: Determine whether the integer 287 is prime or not.


2
Solution: Note that 2 does not divide 287. We now find all odd primes p such that p ≤ 287.
2 2
These primes are 3, 5, 7, 11 and 13, since 13 < 287 < 17 .
7 divides 287.
Hence, 287 is a composite integer.
Modular Arithmetic

Congruence Relation

WWW.JNTUKNOTES.COM 42
If a and b are integers and m is positive integer, then a is said to be congruent to b modulo m, if
m divides a − b or a − b is multiple of m. This is denoted as

a≡ b(mod m)

m is called the modulus of the congruence, b is called the residue of a(mod m). If a is not
congruent to b modulo m, then it is denoted by a ̸≡b(mod m).
Example:
(i). 89 ≡ 25(mod 4), since 89-25=64 is divisible by 4. Consequently 25 is the residue of
89(mod 4) and 4 is the modulus of the congruent.

(ii). 153 ≡ −7(mod 8), since 153-(-7)=160 is divisible by 8. Thus -7 is the residue of 153(mod
8) and 8 is the modulus of the congruent.

(iii). 24 ̸≡3(mod 5), since 24-3=21 is not divisible by 5. Thus 24 and 3 are incon-gruent
modulo 5

Note: If a ≡ b(mod m) ⇔ a − b = mk, for some integer k ⇔


a = b + mk, for some integer k.

Properties of Congruence

Property 1: The relation ‖Congruence modulo m‖ is an equivalence relation. i.e., for all integers
a, b and c, the relation is

(i) Reflexive: For any integer a, we have a ≡ a(mod m)

(ii) Symmetric: If a ≡ b(mod m), then b ≡ a(mod m)

(iii) Transitive: If a ≡ b(mod m) and b ≡ c(mod m), then a ≡ c(mod m).

Proof: (i). Let a be any integer. Then a − a = 0 is divisible by any fixed positive integer m.
Thus a ≡ a(mod m).

113
The congruence relation is reflexive.
(ii). Given a ≡ b(mod m)

⇒ a − b is divisible by m ⇒ −(a − b) is
divisible by m ⇒ b − a is divisible by
m
i.e., b ≡ a(mod m).
Hence the congruence relation is symmetric.
(iii). Given a ≡ b(mod m) and b ≡ c(mod m)

WWW.JNTUKNOTES.COM 43
⇒ a − b is divisible of m and b − c is divisible by m. Hence (a − b)
+ (b − c) = a − c is divisible by m
i.e., a ≡ c(mod m) ⇒ The congruence
relation is transitive.
Hence, the congruence relation is an equivalence relation.
Property 2: If a ≡ b(mod m) and c is any integer, then (i). a
± c ≡ b ± c(mod m) (ii). ac ≡ bc(mod m). Proof:

(i). Since a ≡ b(mod m) ⇒ a − b is divisible by m.


Now (a ± c) − (b ± c) = a − b is divisible by m.
a ± c ≡ b ± c(mod m).

(ii). Since a ≡ b(mod m) ⇒ a − b is divisible by m.


Now, (a − b)c = ac − bc is also divisible by m.
ac ≡ bc(mod m).
Note: The converse of property (2) (ii) is not true always.
Property 3: If ac ≡ bc(mod m), then a ≡ b(mod m) only if gcd(c,m) = 1. In fact, if c is an

m
integer which divides m, and if ac ≡ bc(mod m), then a ≡ b mod[ ]
gcd(c,m)
Proof: Since ac ≡ bc(mod m) ⇒ ac − bc is divisible by m.
i.e., ac − bc = pm, where p is an integer.

m
⇒ a − b= p( c)

m m
a ≡ b[ mod ( )] , provided that is an
integer. c c
Since c divides m, gcd(c, m) = c.

m
Hence, a ≡ b mod [ ]
gcd(c,m)
But, if gcd(c, m) = 1, then a ≡ b(mod m).

Property 4: If a, b, c, d are integers and m is a positive integer such that a ≡ b(mod m) and c ≡
d(mod m), then
)
(ii). ac bd(mod m)

(iii). an ≡ bn(mod m), where n is a positive integer.

WWW.JNTUKNOTES.COM 44
114

Proof: (i). Since a ≡ b(mod m) ⇒ a − b is divisible by m.


Also c ≡ d(mod m) ⇒ c − d is divisible by m.

(a − b) ± (c − d) is divisible by m. i.e., (a ± c) −
(b ± d) is divisible by m. i.e., a ± c ≡ b ± d(mod m).

(ii). Since a ≡ b(mod m) ⇒ a − b is divisible by m.


(a − b)c is also divisible by m.
(c − d)b is also divisible by m.
(a − b)c + (c − d)b = ac − bd is divisible by m. i.e., ac − bd is divisible by m.
i.e., ac ≡ bd(mod m)...........................(1)
(iii). In (1), put c = a and d = b. Then, we get
a2 ≡ b2(mod m)................(2) Also
a ≡ b(mod m)................(3)
Using the property (ii) in equations (2) and (3), we have a3 ≡ b3(mod m)
Proceeding the above process we get an ≡
bn(mod m), where n is a positive integer.

WWW.JNTUKNOTES.COM 45
Fermat’s Theorem
p−1 −
If p is a prime and (a, p) = 1 then a − 1 is divisible by p i.e., ap 1 ≡ 1 (mod p).

Proof
We offer several proofs using different techniques to prove the statement .
If , then we can cancel a factor of from both sides and retrieve the first version
of the theorem.
Proof by Induction
The most straightforward way to prove this theorem is by by applying the induction principle. We
fix as a prime number. The base case, , is obviously true. Suppose the
statement is true. Then, by the binomial theorem,

Note that divides into any binomial coefficient of the form for . This

follows by the definition of the binomial coefficient as ; since is prime,


then divides the numerator, but not the denominator.

115

Taken , all of the middle terms disappear, and we end up


with . Since we also know that ,
then , as desired.

Example: Using Fermat‘s theorem, compute the values of


(i) 3302(mod 5), (ii)
3302(mod 7) and

(iii) 3302(mod 11).

Solution: By Fermat‘ s theorem, 5 is a prime number and 5 does not divide 3, we have

35−1≡ 1 (mod 5)

34≡ 1 (mod 5)

WWW.JNTUKNOTES.COM 46
(34)75≡ 175 (mod 5)

3300≡ 1 (mod 5)

3302≡ 32 = 9 (mod 5)

3302≡ 4 (mod 5).............(1) Similarly,


7 is a prime number and 7 does not divide 3, we have
6
3 ≡ 1 (mod 7)
(36)50 ≡ 150 (mod 7)
300
3 ≡ 1 (mod 7)

3302 ≡ 32 = 9 (mod 7)
302
3 ≡ 2 (mod 7).............(2)
and 11 is a prime number and 11 does not divide 3, we have
10
3 ≡ 1 (mod 11)
(310)30 ≡ 130 (mod 11)
300
3 ≡ 1 (mod 11)

3302 ≡ 32 = 9 (mod 11).............(3)

Example: Using Fermat‘s theorem, find 3201(mod 11).


Example: Using Fermat‘s theorem, prove that 413332 ≡ 16 (mod 13331). Also, give an example
to show that the Fermat theorem is true for a composite integer. Solution:
(i). Since 13331 is a prime number and 13331 does not divide 4.
By Fermat‘s theorem, we have
13331−1
4 ≡ 1 (mod 13, 331)
13330
4 ≡ 1 (mod 13, 331)
13331
4 ≡ 4 (mod 13, 331)
13332
4 ≡ 16 (mod 13, 331)
(ii). Since 11 is prime and 11 does not divide 2.

116
By Fermat‘s theorem, we have
11−1

WWW.JNTUKNOTES.COM 47
2 ≡ 1 (mod 11)
10
i.e., 2 ≡ 1 (mod 11)
(210)34 ≡ 134 (mod 11)
340
2 ≡ 1 (mod 11).............(1)
Also,
5
2 ≡ 1 (mod 31)
(25)68 ≡ 168 (mod 31)
340
2 ≡ 1 (mod 31).............(2)

From (1) and (2), we get


340
2 − 1 is divisible by 11 × 31 = 341, since gcd(11, 31) = 1.
340
i.e., 2 ≡ 1 (mod 341).
Thus, even though 341 is not prime, Fermat theorem is satisfied.

Euler’s totient Function:


Euler's totient function counts the positive integers up to a given integer n that are relatively
prime to n. It is written using the Greek letter phi as ϕ(n), and may also be called Euler's phi
function. It can be defined more formally as the number of integers k in the range 1 ≤ k ≤ n for
which the greatest common divisor gcd(n, k) is equal to 1. The integers k of this form are
sometimes referred to as totatives of n. Computing Euler's totient function:

where the product is over the distinct prime numbers dividing

Example: Find ϕ(21), ϕ(35), ϕ(240) Solution:


ϕ(21) = ϕ(3 × 7)

= 21(1 )(1 )
= 12

ϕ(35) = ϕ(5 × 7)

= 35(1 )(1 )
= 24

ϕ(240) = ϕ(15 × 16)

WWW.JNTUKNOTES.COM 48
=ϕ(3×5× 24)

=240 (1 )(1 )(1 )


= 64

117

Euler’s Theorem: If a and n > 0 are integers such that (a, n) = 1 then aϕ(n) ≡ 1(mod n).
Proof:

Consider the elements r , r1 2 ,…,r ( ) n of (Z/n) the congruence classes of integers that are
relatively prime to n.
For a (Z/n) the claim is that multiplication by a is a permutation of this set; that is, the set { ar1,
ar2 ,…,ar ( ) n} equals (Z/n). The claim is true because multiplication by a is a function from the
finite set (Z/n) to itself that has an inverse, namely multiplication by 1/a (mod n) Now, given the
claim, consider the product of all the elements of (Z/n), on one hand, it is r r1 2 ,…r ( ) n. On the

other hand, it is ar1 ar2 …ar ( ) n . So these products are congruent mod n r r1 2 …r ( ) n ar1 ar2
…ar ( ) n r r1 2 …r ( ) n a ( )n r r1 2 …r ( ) n

1 a ( )n
where, cancellation of the ri is allowed because they all have multiplicative inverses(mod n)

Example: Find the remainder 29202 when divided by 13.


Solution: We first note that (29,13)=1.
Hence we can apply Euler's Theorem to get that 29ϕ(13) ≡1(mod13).
Since 13 is prime, it follows that ϕ(13)=12, hence 2912≡1(mod13).
We can now apply the division algorithm between 202 and 12 as follows:
202=12(16)+10
Hence it follows that 29 =(29 ) 2910≡(1)26 2910≡2910(mod13).
202 12 26

Also we note that 29 can be reduced to 3 (mod 13), and hence:


2910≡310=59049≡3(mod13)2
Hence when 29202 is divided by 13, the remainder leftover is 3.

Example: Find the remainder of 99999999 when divided by 23.


Solution: Once again we note that (99,23)=1, hence it follows that 99ϕ(23) ≡1(mod23).
Once again, since 23 is prime, it goes that ϕ(23)=22, and more appropriately
9922≡1(mod23).
We will now use the division algorithm between 999999 and 22 to get that:
999999=22(45454)+11
Hence it follows that
99999999=(9922)45454 9911≡145454 9911≡711=1977326743≡22(mod23).
Hence the remainder of 99999999 when divided by 23 is 22.

WWW.JNTUKNOTES.COM 49
Note that we can solve the final congruence a little differently as:
9911≡711=(72)5 7=(49)5 7≡35 7=1701≡22(mod23).
There are many ways to evaluate these sort of congruences, some easier than others.
Example: What is the remainder when 1318 is divided by 19?
Solution: If yϕ (z) is divided by z, the remainder will always be 1; if y, z are co-prime
In this case the Euler number of 19 is 18
(The Euler number of a prime number is always 1 less than the number).
As 13 and 19 are co-prime to each other, the remainder will be 1.

118
Example: Now, let us solve the question given at the beginning of the article using the
concept of Euler Number: What is the remainder of 192200002/23?
Solution: The Euler Number of the divisor i.e. 23 is 22, where 19 and 23 are co-prime.
Hence, the remainder will be 1 for any power which is of the form of 220000.
The given power is 2200002.
Dividing that power by 22, the remaining power will be 2.
Your job remains to find the remainder of 192/23.
As you know the square of 19, just divide 361 by 23 and get the remainder as 16.

Example: Find the last digit of 555.


Sol: We first note that finding the last digit of 555 can be obtained by reducing 555 (mod 10),
that is evaluating 555(mod10).
We note that (10, 55) = 5, and hence this pair is not relatively prime,
however, we know that 55 has a prime power decomposition of
55 = 5 x 11. (11, 10) = 1,
hence it follows that 11ϕ(10) ≡1(mod10).

We note that ϕ(10)=4. Hence 11 1(mod10), and more


appropriately:
55 =5 11 =5 11 11≡5 (1) 11≡34375≡5(mod10)
Hence the last digit of 555 is 5.

Example: Find the last two digits of 33334444.


Sol:
We first note that finding the last two digits of 33334444 can be obtained by reducing
33334444 (mod 100).
Since (3333, 100) = 1, we can apply this theorem.
We first calculate that ϕ(100)=ϕ(22)ϕ(52)=(2)(5)(4)=40.
Hence it follows from Euler's theorem that 333340≡1(mod100).
Now let's apply the division algorithm on 4444 and 40 as follows:
4444=40(111)+4
Hence it follows that:

WWW.JNTUKNOTES.COM 50
33334444≡(333340)111 33334≡(1)111 33334(mod100)≡334=1185921≡21(mod100) Hence
the last two digits of 33334444 are 2 and 1.

119
Previous questions
1. a) Prove that a group consisting of three elements is an abelian group?
b) Prove that G={-1,1,i,-i} is an abelian group under multiplication?
2. a) Let G= {-1,0,1} . Verify that G forms an abelian group under addition?
b) Prove that the Cancellation laws holds good in a group G.?
3. Prove that the order of a-1 is same as the order of a.?
4. a) Explain in brief about fermats theorem?
b) Explain in brief about Division theorem?
c) Explain in brief about GCD with example?
5. Explain in brief about Euler’s theorem with examples?
6. Explain in brief about Principle of Mathematical Induction with examples?
7. Define Prime number? Explain in brief about the procedure for testing of prime numbers?
8. Prove that the sum of two odd integers is an even integer?
9. State Division algorithm and apply it for a dividend of 170 and divisor of 11.
10. Using Fermat’s theorem, find 3201 mod 11.
11. Use Euler’s theorem to find a number between 0 and 9 such that a is congruent to 71000 (mod 10) 12.
Find the integers x such that i) 5x≡4 (mod 3) ii) 7x≡6 (mod 5) iii) 9x≡8 (mod 7)
13. Determine GCD (1970, 1066) using Euclidean algorithm.
14. If a=1820 and b=231, find GCD (a, b). Express GCD as a linear combination of a and b.
15. Find 117 mod 13 using modular arithmetic.

Multiple choice questions


1. If a|b and b|c, then a|c.
a) True b) False
Answer: a

WWW.JNTUKNOTES.COM 51
2. GCD(a,b) is the same as GCD(|a|,|b|).
a) True b) False
Answer: a
3. Calculate the GCD of 1160718174 and 316258250 using Euclidean algorithm.
a) 882 b) 770 c) 1078 d) 1225
Answer: c
4. Calculate the GCD of 102947526 and 239821932 using Euclidean algorithm.
a) 11 b) 12 c) 8 d) 6
Answer: d
5. Calculate the GCD of 8376238 and 1921023 using Euclidean algorithm.
a) 13 b) 12 c) 17 d) 7
Answer: a
6. What is 11 mod 7 and -11 mod 7?
a) 4 and 5 b) 4 and 4 c) 5 and 3 d) 4 and -4
Answer: d
7. Which of the following is a valid property for concurrency?
a) a = b (mod n) if n|(a-b) b) a = b (mod n) implies b = a (mod n)
c) a = b (mod n) and b = c (mod n) implies a = c (mod n)
d) All of the mentioned
Answer: d
8. [(a mod n) + (b mod n)] mod n = (a+b) mod n
a) True b) False
9. [(a mod n) – (b mod n)] mod n = (b – a) mod n
a) True b) False
Answer:b

120
10. 117 mod 13 =
a) 3 b) 7 c) 5 d) 15
Answer: d
11. The multiplicative Inverse of 1234 mod 4321 is
a) 3239 b) 3213 c) 3242 d) Does not exist
Answer: a
12. The multiplicative Inverse of 550 mod 1769 is
a) 434 b) 224 c) 550 d) Does not exist
Answer: a
13. The multiplicative Inverse of 24140 mod 40902 is
a) 2355 b) 5343 c) 3534 d) Does not exist
Answer: d
14. GCD(a,b) = GCD(b,a mod b)
a) True b) False
Answer: a
15. Define an equivalence relation R on the positive integers A = {2, 3, 4, . . . , 20} by m R n

WWW.JNTUKNOTES.COM 52
if the largest prime divisor of m is the same as the largest prime divisor of n. The number
of equivalence classes of R is
(a) 8 (b) 10 (c) 9 (d) 11 (e) 7
Ans:a
16. The set of all nth roots of unity under multiplication of complex numbers form a/an
A.semi group with identity B.commutative semigroups with identity
C.group D.abelian group Option:
D
17. Which of the following statements is FALSE ?
A.The set of rational numbers is an abelian group under addition B.The set
of rational integers is an abelian group under addition
C.The set of rational numbers form an abelian group under multiplication
D.None of these
Option: D
18.In the group G = {2, 4, 6, 8) under multiplication modulo 10, the identity element is
A.6 B.8 C.4 D.2
Option: A
19. Match the following
A. Groups I. Associativity
B. Semi groups II. Identity
C. Monoids III. Commutative
D. Abelian Groups IV Left inverse
A. A B C D B. A B C D C. A B C D D. A B C D
IV I II III III I IV II II III I IV I II III IV
Option: A
20. Let (Z,*) be an algebraic structure, where Z is the set of integers and the operation * is
defined by n*m = maximum(n,m). Which of the following statements is TRUE for (Z,*)?
A.(Z, *) is a monoid B.(Z, *) is an abelian group C.(Z, *) is a group D.None
Option: D
21. Some group (G,0) is known to be abelian. Then which of the following is TRUE for G ?
A.g = g-1 for every g G B.g = g2 for every g G
2 2 2
C.(g o h) = g o h for every g,h G D.G is of finite order
Option: C
22. If the binary operation * is deined on a set of ordered pairs of real numbers as (a, b)*(c, d)

121
= (ad + bc, bd) and is associative, then (1, 2) * (3, 5) * (3, 4) equals
A.(74,40) B.(32,40) C.(23,11) D.(7,11)
Option: A

WWW.JNTUKNOTES.COM 53
23. The linear combination of gcd(252, 198) = 18 is d) 252*4 – 198*4
a) 252*4 – 198*5 b) 252*5 – 198*4 c) 252*5 – 198*2
Answer:a
24. The inverse of 3 modulo 7 is
a) -1 b) -2 c) -3 d) -4
Answer:b
25. The integer 561 is a Carmichael number.
a) True b) False
Answer:a
26. The linear combination of gcd(117, 213) = 3 can be written as
a) 11*213 + (-20)*117 b) 10*213 + (-20)*117
c) 11*117 + (-20)*213 d) 20*213 + (-25)*117
Answer:a
27. The inverse of 7 modulo 26 is
a) 12 b) 14 c) 15 d) 20
Answer:c
28. The inverse of 19 modulo 141 is
a) 50 b) 51 c) 54 d) 52
Answer:d
29. The value of 52003 mod 7 is
a) 3 b) 4 c) 8 d) 9
Answer:a
30. The solution of the linear congruence 4x = 5(mod 9) is
a) 6(mod 9) b) 8(mod 9) c) 9(mod 9) d) 10(mod 9)
Answer:b
31. The linear combination of gcd(10 ,11) = 1 can be written as
a) (-1)*10 + 1*11 b) (-2)*10 + 2*11
c) 1*10 + (-1)*11 d) (-1)*10 + 2*11
Answer:a

122

Powered by TC PDF ( www.tc pdf.org)

WWW.JNTUKNOTES.COM 54

You might also like