You are on page 1of 7

SQQM1063 DISCRETE MATHEMATICS

CHAPTER 4
INTRODUCTION TO CODING THEORY

4.1

Divisibility

Definition 4.1 An integer is said to be divisible by an integer 0, denoted by |, if there


exists some integer such that = . We write to indicate that is not divisible by .

Examples:
a)

3|6 since there exists such that 6 = 3. Here, = 2. Hence, 3 is a divisor/factor of


6.

b)

3| 6 since there exists such that 6 = 3 . Here, = 2 . Hence, 3 is a


divisor/factor of 6. In fact, it is easily seen that 3| 6.

c)

4 7, since there does not exist such that 7 = 4. Hence, 4 is not a divisor of 5.

4.2

Prime Numbers

Definition 4.2 A number > 1 that is divisible only by 1 and itself is called a prime number.
An integer > 2 that is not a prime is called a composite number.

SQQM1063 DISCRETE MATHEMATICS


Examples:
a)

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47 are prime numbers between 2 and 50.

b)

21 is not a prime since it is divisible by 3 and 7.

Theorem 4.1 Every positive integer can be expressed as a product of primes, symbolically
written as = 1 1 2 2 , where for = 1, 2, , are distinct primes. This factorization
is unique, up to reordering the factors.

Examples:
a)

1025 can be expressed as 1025 = 52 41, where 5 and 41 are prime numbers.

b)

630 can be expressed as 630 = 2 32 5 7.

Exercises:
Express each number below to its prime factorization.
a)

72.

b)

332.

c)

1238.

d)

3465.

e)

7044.

f)

15750.

SQQM1063 DISCRETE MATHEMATICS


4.3

Congruences

Definition 4.3 Let , , and be integers, with 0. We say that is congruent to modulo
, denoted by mod , if is a multiple of .
Another formulation is that mod if and differ by a multiple of . This can be
written as = + for some integer (positive or negative).

Theorem 4.2 Let , , , and be integers with 0.


i.

0 mod if and only if |.

ii.

mod .

iii.

mod if and only if mod .

iv.

If mod and mod , then mod .

Examples:
a)

17 3 mod 7 since 17 3 = 14 is a multiple of 7. This congruence also can be written


as 17 = 3 + 7 2 .

b)

23 4 mod 10, since there is no integer such that 23 4 + 10 (or 23 4 = 19 is


not a multiple of 10.

c)

Given 2 + 7 1 mod 21, solve for .


In this problem, first we write the congruence as 2 + 7 1 = 21. Then, 2 + 6 =
21 . Obviously, when = 2, then the equation becomes 2 + 6 = 42. Solving this
equation, we get = 18.
(Note: It is also solutions if we choose = 4, 6, 8, . But normally our aim is to find the
smallest positive integer , so we choose the smallest positive integer ).

SQQM1063 DISCRETE MATHEMATICS


Exercises:
a)

For each congruences below, show that either each of them is true or false.
i.

7 5 mod 2.

ii.

8 12 mod 3.

iii.

6 2 mod 4.

iv.

0 5 mod 5.

v.

59 31 mod 6.

vi.

23 19 mod 7.

For the following congruences, solve for the the smallest positive integer .

b)

4.4

i.

4 mod 9.

ii.

17 mod 4.

iii.

2 3 mod 11.

iv.

3 4 5 mod 6.

Greatest Common Divisor (gcd)

Definition 4.4 Let and be given integers, with at least one of them different from zero. The
greatest common divisor of and , denoted by gcd , , is the positive integer satisfying the
following conditions:
i.

| and |.

ii.

If | and |, then .

The greatest common divisor can be found by two ways:


1)

Prime factorization.

2)

Division algorithm.

SQQM1063 DISCRETE MATHEMATICS


Examples:
Find gcd 84,616 .
1)

Prime factorization.
Express 84 and 616 to their prime factorization.
84 = 22 3 7
616 = 23 7 11
Taking the common prime with the smallest exponent for both integer, therefore
gcd 84,616 = 22 7 = 28

2)

Division algorithm.
First divide 616 with 84 . Write 616 as the product of 84 and its quotient, plus the
remainder.
616 = 84 7 + 28
Since the remainder is 28 > 0, repeat the first step by dividing 84 with 28.
84 = 28 3 + 0
Since the remainder is 0, then the gcd 84,616 is the last non-zero remainder, which is
28.

Exercises:
Find the greatest common divisor for the following pairs of integers.
a)

111,129 .

b)

120,165 .

c)

2025,729 .

d)

10740,525 .

SQQM1063 DISCRETE MATHEMATICS


4.5

Least Common Multiple (lcm)

Definition 4.5

The least common multiple of two integers and , usually denoted by

lcm , , is the smallest positive integer that is divisible by both and .


We can find the least common multiple for any two integers from its prime factorization.

Example:
Find lcm 84,616 .
Express 84 and 616 to their prime factorization.
84 = 22 3 7
616 = 23 7 11
Taking all the primes (choose the maximum exponent), therefore lcm 84,616 = 23 3 7
11 = 1848.

Exercises:
Find the least common multiple for the following pairs of integers.
e)

111,129 .

f)

120,165 .

g)

2025,729 .

h)

10740,525 .

SQQM1063 DISCRETE MATHEMATICS

You might also like