MATH1081 Topic2 LectureNotes
MATH1081 Topic2 LectureNotes
MATH1081 Topic2 LectureNotes
Trenerry
Integers Z = {. . . , 2, 1, 0, 1, 2, . . .}.
Rational numbers Q = p p, q Z, q 6= 0 .
q
12 48
48 12
(ii) if a | b, then a | bc ;
(Important!)
(Transitivity of divisibility)
8
9
10
11
..
.
Last digit is 0, 2, 4, 6, or 8.
Sum of digits is divisible by 3.
Last two digits are divisible by 4.
Last digit is 0 or 5.
Divisible by 2 and 3.
Double the last digit and subtract it from the remaining leading
truncated number. If the result is divisible by 7, then so was the
original number. Apply this rule over and over again as necessary.
Last three digits is divisible by 8.
Sum of digits is divisible by 9.
Last digit is 0.
The difference between the sum of digits in the odd positions
and the sum of digits in the even positions is divisible by 11.
Exercise.
Is 408254 a multiple of 3? Is 408254 divisible by 7? Does 11 divide 408254?
A prime is an integer larger than 1 whose only positive factors are 1 and itself.
The first few primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, . . ..
The smallest prime is 2, the only even prime.
There are infinitely many primes; this has been known for over 2000 years.
Primes of the form 2p 1, where p is prime, are called Mersenne primes.
The largest prime currently known is a Mersenne prime, 257,885,161 1,
discovered in December 2014. It has 17,425,170 decimal digits.
n
or
60 = 15 4 = 3 5 2 2.
It does not matter how we start; we always end up with the same prime factors,
but maybe in different order.
60
1001
= 22 3 5 ;
= 7 11 13 ;
1002 = 2 3 167 .
n.
Equivalently...
Theorem. If n has no prime factor less than or equal to
n, then it is prime.
Proof.
Let a and b be integers, not both zero. Any positive integer d that satisfies
d | a and d | b is called a common divisor or a common factor of a and b.
The largest such d is called the greatest common divisor of a and b, and is
denoted by gcd(a, b).
If gcd(a, b) = 1, then a and b are coprime or relatively prime to each other.
Let a and b be positive integers. Each positive integer m that satisfies both
a | m and b | m is called a common multiple of a and b. The smallest such m
is called the least common multiple of a and b, and is denoted by lcm(a, b).
If a and b are positive integers, then gcd(a, b) lcm(a, b) = ab.
Example. The positive factors of 12 are {1, 2, 3, 4, 6, 12}.
The positive divisors of 42 are {1, 2, 3, 6, 7, 14, 21, 42}.
The common divisors of 12 and 42 are {1, 2, 3, 6}.
Thus, gcd(12, 42) = 6.
The positive multiples of 12 are {12, 24, 36, 48, 60, 72, 84, . . .}.
The positive multiples of 42 are {42, 84, 126, . . .}.
Thus, lcm(12, 42) = 84.
6
Example. We can find the gcd and lcm of two numbers through their prime
factorizations. For example, consider
14175 = 34 52 7
16758 = 2 32 72 19 .
and
For the gcd, we multiply all the prime factors common to both:
gcd(14175, 16758) = 32 7 = 63 .
For the lcm, take the smallest product that includes all factors of both numbers:
lcm(14175, 16758) = 2 34 52 72 19 = 3770550 .
Exercise. Find the gcd and lcm of a = 23 3 52 11 and b = 3 5 7.
Exercise. If a is any integer, then what happens if we try to compute lcm(a, 0)?
13
7 )92
91
1
13
7 ) 92
91
1
14
7 ) 92
98
6
simplified
incorrect
correct
We see that 92 = 13 7 + 1.
Thus, when 92 is divided by 7, the quotient is 13 and the remainder 1.
We have 92 = (13) 7 + (1) and 92 = (14) 7 + 6. Since the remainder
should lie between 0 and 6, we conclude that when 92 is divided by 7, the
quotient is 14 and the remainder 6.
Exercise. Find the quotient and remainder when 1001 is divided by 101.
Exercise. Find the quotient and remainder when 101 is divided by 1001.
Exercise. Find the quotient and remainder when 1001 is divided by 101.
Euclidean Algorithm. Use the above theorem together with the Division
Algorithm repeatedly to calculate the greatest common divisor of two numbers.
Example. We use the Euclidean Algorithm to compute the greatest common
divisor of 16758 and 14175 as follows:
16758
14175
2583
1260
=
=
=
=
1 14175 + 2583,
5 2583 + 1260,
2 1260 + 63,
20 63 + 0,
=
=
=
=
1 14175 + 2583
5 2583 + 1260
2 1260 + 63
20 63 + 0 .
(3)
(2)
(1)
2583 2 1260
2583 2 (14175 5 2583)
11 2583 2 14175
11 (16758 14175) 2 14175
11 16758 13 14175
by equation (1)
by equation (2)
collect like terms
by equation (3)
collect like terms .
Thus,
16758 11 + 14175 (13) = 63 .
The B
ezout Property. Consider the equation
ax + by = c ,
where a, b, and c are integers, with a and b not both zero. Then
(i) if c = gcd(a, b), then the equation has an integer solution;
(ii) if c is a multiple of gcd(a, b), then the equation has an integer solution;
(iii) if c is not a multiple of gcd(a,b), then the equation has no integer solution.
Proof. Let d = gcd(a, b).
The proof of (i) is a bit complicated; see Exercise 11 in Problem Set 2.
Assuming that (i) proved, then we have integers x0 and y0 such that
ax0 + by0 = d .
If c is a multiple of d, then c = dm for some integer m, and we have
a(x0 m) + b(y0 m) = dm = c .
Thus, the equation ax + by = c has an integer solution x = x0 m and y = y0 m.
Suppose now that c is not a multiple of d. If x and y were integers, then we
would have d | (ax + by) and hence d | c, which contradicts the fact that c is
not a multiple of d. Hence, in this case x and y cannot be integers.
Exercise. Use the Extended Euclidean Algorithm to find integer solutions to
the equations
520x 1001y = 13,
11
5 mod 7
11 mod 3
5 mod 7
Proof.
(i) and (ii) are equivalent by definition.
(iii) and (iv) are equivalent by definition.
Let us prove that (ii) implies (iii).
Suppose that (a mod m) = (b mod m) = r for some integer 0 r < m.
Then a = q1 m + r and b = q2 m + r for some integers q1 and q2 . Thus,
a b = (q1 m + r) (q2 m + r) = (q1 q2 )m = km ,
where k = q1 q2 is an integer. Hence, we have m | (a b).
12
Finally, let us prove that (iv) implies (ii). (Why does this prove the result?)
13
Example. The last two digits of the number 1234567 is the number 67.
This can be formally expressed as
1234567 mod 100 = 67
or
1234567 67
(mod 100) .
Similarly, to find the last two digits of the number 71234567 , we need to evaluate
71234567 mod 100. We have
71
72
73
74
7 (mod 100) ;
49 (mod 100) ;
49 7 343 43 (mod 100) ;
43 7 301 1 (mod 100) .
14
(mod 100) .
Example. We have seen that simplifying an mod m becomes quite easy if there
is a small number k such that ak 1 (mod m). In a similar way, it is also
useful to have ak 1 (mod m). The trick is to try and keep the numbers
between m/2 and m/2.
For example, we will try to simplify 5115511 mod 29. We have
51
52
53
54
55
56
57
5 (mod 29) ;
25 4 (mod 29) ;
(4) 5 20 9 (mod 29) ;
9 5 45 16 13 (mod 29) ;
(13) 5 65 7 (mod 29) ;
(7) 5 35 6 (mod 29) ;
(6) 5 30 1 (mod 29) .
Thus,
5115511 5716501+4 (57 )16501 54
(1)16501 (13) (1) (13) 13
(mod 29) .
6 (mod 100) ;
36 (mod 100) ;
36 6 216 16 (mod 100) ;
16 6 96 4 (mod 100) ;
(4) 6 24 (mod 100) ;
(24) 6 144 44 (mod 100) ;
(44) 6 264 36 (mod 100) .
Since 67 62 (mod 100), the numbers repeat every 5 steps from here on. Thus,
654321 654316 654311 66 44 56
(mod 100).
Since 66 6 61 (mod 100), the pattern does not hold for smaller powers.
15
for some y Z .
This is equivalent to 40x 77y = 1. (This has a solution since gcd(40, 77) = 1.)
2. Now use the extended Euclidean algorithm to find x.
77
40
37
3
=
=
=
=
1 40 + 37
1 37 + 3
12 3 + 1
31+0
1 =
=
=
=
=
37 12 3
37 12 (40 37)
13 37 12 40
13 (77 40) 12 40
13 77 25 40
16
Problem. For integers a, b and positive integer m, find all integers x so that
ax b (mod m) .
This is a problem of solving linear congruence.
There are several cases to consider in solving this congruence equation.
Theorem. If gcd(a, m) b, then ax b (mod m) has no solutions.
ax acb 1b b
79x 12
(mod m) .
(mod 45) .
=
=
=
=
1 45 + 34
1 34 + 11
3 11 + 1
11 1 + 0
34 3 11
34 3 (45 34)
4 34 3 45
4 (79 45) 3 45
4 79 7 45
17
(mod 45) ,
(mod m)
and
cax cb
(mod cm)
18
(mod 15) .
1 = 13 6 2
= 13 6 (15 13)
= 7 13 6 15
(mod 60) .
5. Note that there are now 4 = gcd(52, 60) solutions modulo 60.
Exercise. Solve the congruence 9x 3 (mod 24). Give your answer as a
congruence to the smallest possible modulus, and as a congruence modulo 24.
19
To summarise:
Theorem. Consider the congruence ax b (mod m).
(i) If gcd(a, m) = 1, then the congruence has a unique solution modulo m.
(ii) If gcd(a, m) is not a factor of b, then the congruence has no solution.
(iii) If d = gcd(a, m) is a factor of b, then the congruence has
one unique solution modulo m/d, and
d different solutions modulo m.
Exercise. Without actually solving anything, determine how many solutions
the following congruences have. Give your answers in terms of the original
modulus, and in terms of a smaller modulus if appropriate.
(a) 15x 18 (mod 21)
(b) 16x 19 (mod 22)
(c) 17x 20 (mod 23)
Sometimes we can solve congruences simply by using the following fact.
Theorem. If gcd(c, m) = 1, then
pq
(mod m) .
Example.
52x 4 (mod 60)
13x 1 (mod 15)
2x 14 (mod 15)
x 7 (mod 15)
20
(mod 7) .
21
Matrix MR :
Arrange the elements of A and B in some order a1 , a2 , . . . and b1 , b2 , . . .,
and then form a rectangular array of numbers where
(
1 if ai R bj ;
the entry in the ith row and jth column = mi,j =
0 if ai R
6 bj .
The matrix MR has |A| rows and |B| columns.
The matrix changes if the elements are arranged in a different order.
Example. Five flatmates Adam, Ben, Cate, Diane, and Eve chatted about who
had visited the four cities Montreal, New York, Osaka, and Paris.
Their travel experiences lead to a relation defined as follows:
A = {Adam, Ben, Cate, Diane, Eve}
B = {Montreal, New York, Osaka, Paris}
R = {(Adam, Montreal), (Ben, New York), (Ben, Paris),
(Diane, New York), (Diane, Osaka)}
The arrow diagram and matrix for this relation are
Adam
Ben
Cate
Diane
Eve
Montreal
New York
Osaka
Paris
MR
1
0
=
0
0
0
0
1
0
1
0
0
0
0
1
0
0
1
0
0
2
1 0 1 0 1
0 0 1 0 0
1
0
0
0
1
M
=
3
6
R
0 1 0 0 0
0 0 1 0 0
4
5
Exercise. Let R = {(a, a), (a, b), (b, a), (b, b), (d, b)} be a relation on the set
A = {a, b, c, d}. Draw the arrow diagram of R and write the matrix of R.
23
implies
bRa,
implies
a = b,
i.e., if a and b are related to each other, then they must be identical.
We say that a relation R on a set A is transitive when for every a, b, c A,
a R b and b R c
implies
aRc,
reflexive
symmetric
arrow diagram
matrix
must have
(i) if we have
must have
(ii) if we have
, then we
, and
, then
we must have
R1
a
R3
c
R1
R4
c
R2
R3
R4
reflexive
symmetric
antisymmetric
transitive
Exercise. For each relation R defined on the set of all human beings, determine
whether or not it is reflexive, symmetric, antisymmetric, or transitive.
e
refl
a is the father of b
a is a sibling of b
a is taller than b
a and b were born on the same day
a and b speak a common language
a likes b
25
e
xiv
sy m
tr
me
ic
sy m
i
t
an
tr
me
ic
ive
t
i
ns
tra
Exercise. For each relation R defined on the set of all integers, determine
whether or not it is reflexive, symmetric, antisymmetric, or transitive.
e t r ic
c
i
m
r
t
m
e
e
y
iv
itive
sy m m
antis
(x, y) R if and only if
reflex
trans
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
(i)
(j)
(k)
x=y
x>y
xy
x 6= y
x y (mod 7)
x is a multiple of y
xy 1
x = y + 1 or x = y 1
x and y are both negative
or both nonnegative
x = y2
x y2
26
27
An equivalence relation tells us when two things are of the same type.
Example. Let denote a relation on the set of real numbers defined by
xy
if and only if
cos x = cos y .
b
c
f
e
d
Since R is reflexive, symmetric, and transitive, it is an equivalence relation.
The equivalence classes are
[a] = {a, c, d}
[d] =
[b] = {b, f }
[e] =
[c] = {a, c, d}
[f ] =
Proof.
(i) Since is reflexive, a a and so a [a].
(ii) Let a b and suppose that x [a]; then a x.
Since is symmetric, b a.
Since is transitive, b x, so x [b].
Hence, [a] [b]. Similarly, we can show that [b] [a],
and we conclude that a b implies that [a] = [b].
Now suppose that [a] = [b]. By i), we have a [a] so a [b]. Then a b.
Hence, a b if and only if [a] = [b].
(T) Suppose that a b and b c. Then a and b lie in the same subset Ai
and b and c belong to the same subset Aj . Since Ai and Aj are either
disjoint or identical and b lies in both, they must be identical.
Thus a, b, c all belong to the same subset; in particular,
a and c belong to the same subset, so a c.
Thus, is transitive.
Hence, is an equivalence relation on A.
30
if and only if
cos x = cos y,
find [0] and [1]; then find a general formula for the equivalence class [a].
31
32
Exercise. For any set S, prove that the relation is a partial order on P (S).
33
34
Exercise. Draw the Hasse diagram for the poset (P (S), ) where S = {a, b, c}.
35
R2
d
a
R1
R4
d
e
c
R3
a
R2
R3
maximal elements
minimal elements
greatest element
least element
36
R4
Exercise. Draw the Hasse diagram for the divisibility relation on the set
S = {positive factors of 72} .
(b) (S, )
(c) (S, |)
37