Topic 2 Lecture Notes (Gardiner)
Topic 2 Lecture Notes (Gardiner)
For these and all other number sets we have encountered (Q, R, C), if we
add or multiply any two elements from one of the sets, we attain another
element from that set. But for the operation of division, the integers and its
subsets are distinguished by the fact that this property does not hold –
dividing one integer by another non-zero integer does not guarantee an
integer result.
Number theory is one of the most fundamental branches of Mathematics,
and is still relevant in the modern era especially considering its applications
to cryptography.
Towards the end of this topic, we will also address the topic of mathematical
relations, which is a natural generalisation of what we have already learned
about functions, and provides more structure to our understanding of
divisibility and modular arithmetic.
MATH1081 Topic 2 – Number theory and relations Lecture 2.01 – Divisibility and greatest common divisors 1/10
Divisibility
Definition. Given two integers a and b, we say a divides b if we can write
b = ak for some integer k. We might also say:
• a is a divisor of b,
• a is a factor of b,
• b is divisible by a, or
• b is a multiple of a.
Notation. The expression a | b is read as “a divides b” and is equivalent to
writing b = ak for some integer k. The expression a ∤ b is read as “a does
not divide b”, and means that b ̸= ak for any integer k.
Example. Decide whether the following statements are true or false.
• 3 | 15 is true since 15 = 3 × 5 and 5 ∈ Z.
• 15 | 3 is false since 3 = 15 × 1
5 but 1
5 ̸∈ Z.
• 3 | 3 is true since 3 = 3 × 1 and 1 ∈ Z.
• −5 | 15 is true since 15 = (−5) × (−3) and −3 ∈ Z.
• 0 | 3 is false since there is no integer k such that 3 = 0 × k.
• 3 | 0 is true since 0 = 3 × 0 and 0 ∈ Z.
• 0 | 0 is true since 0 = 0 × 1 (for example) and 1 ∈ Z.
MATH1081 Topic 2 – Number theory and relations Lecture 2.01 – Divisibility and greatest common divisors 2/10
Divisibility properties
The divisibility relation has many useful properties. Some of the most
important are the following.
Lemma. For all integers a, we have a | a.
Proof. Since a = a × 1 and 1 ∈ Z, we have by definition that a | a.
Lemma. For all integers a, b, c, if a | b and b | c, then a | c.
Proof. Since a | b, we have b = ak for some k ∈ Z, and since b | c, we
have c = bl for some l ∈ Z. So c = (ak)l = a(kl) where kl ∈ Z, so a | c.
Lemma. For all integers a, b, c, if a | b and a | c, then a | bx + cy for any
x, y ∈ Z.
Proof. Since a | b, we have b = ak for some k ∈ Z, and since a | c, we have
c = al for some l ∈ Z. So bx + cy = (ak)x + (al)y = a(kx + ly ) where
kx + ly ∈ Z, so a | bx + cy .
We can deduce other useful facts from the above properties. For example,
setting c = 0 in the third lemma shows that if a | b then a | bm for any
integer m. Combining this with the first lemma shows that a | am for any
integer m.
MATH1081 Topic 2 – Number theory and relations Lecture 2.01 – Divisibility and greatest common divisors 3/10
Prime numbers
Definition. A prime number (or just a prime) is any p ∈ N such that p > 1
and the only positive divisors of p are 1 and p.
The first few prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, ... .
Definition. A composite number is any natural number that is not 0, 1, or
a prime number.
The first few composite numbers are 4, 6, 8, 9, 10, 12, ... .
Theorem. There are infinitely many prime numbers.
Proof. See Angell: Slide 3.53 (or Gardiner: Lecture 3.07, Example 5).
To determine if a natural number n is prime, a standard approach is to√
check whether it is divisible by all known primes less than or equal to n.
(See Problem Set 3, Question 25.)
For example, 1009 is prime
√ because it is not divisible by any of the primes
less than or equal to ⌊ 1009⌋ = 31.
MATH1081 Topic 2 – Number theory and relations Lecture 2.01 – Divisibility and greatest common divisors 4/10
Fundamental Theorem of Arithmetic
Theorem. (Fundamental Theorem of Arithmetic)
Every natural number greater than 1 has a unique prime factorisation. That
is, given any positive integer n > 1, it can be written uniquely in the form
where each p1 , p2 , ... , pk is a prime number, p1 < p2 < p3 < · · · < pk , and
α1 , α2 , ... , αk ∈ Z+ for some k ∈ Z+ .
Proof. See Angell: Slide 3.76 (or Gardiner: Lecture 3.08, Example 4).
For example, the prime factorisation of 12 is 22 × 3.
Example. Find the prime factorisations for each of the integers from 21
to 25.
• 21 = 3 × 7.
• 22 = 2 × 11.
• 23 = 23.
• 24 = 23 × 3.
• 25 = 52 .
MATH1081 Topic 2 – Number theory and relations Lecture 2.01 – Divisibility and greatest common divisors 5/10
Common divisors
Definition. A common divisor of two integers a and b is any integer d such
that both d | a and d | b.
Example. Which of the following are common divisors of 12 and 18?
• 1 is a common divisor of 12 and 18 because 1 | 12 and 1 | 18.
• −6 is a common divisor of 12 and 18 because −6 | 12 and −6 | 18.
• 9 is not a common divisor of 12 and 18 because 9 | 18 but 9 ∤ 12.
Definition. Two integers a and b are coprime or relatively prime if and only
if their only common divisors are 1 and −1. Equivalently, two integers are
coprime if and only if their only positive common divisor is 1.
Example. Which of the following pairs of numbers are coprime?
• 2 and 3 are coprime because 1 is their only positive common divisor.
• 9 and −10 are coprime because 1 is their only positive common divisor.
• 12 and 18 are not coprime because they have positive common divisors
other than 1, for example 2, 3, or 6.
• 0 and 1 are coprime because 1 is their only positive common divisor.
MATH1081 Topic 2 – Number theory and relations Lecture 2.01 – Divisibility and greatest common divisors 6/10
Greatest common divisors
Definition. The greatest common divisor (GCD) of two integers a and b
(when a and b are not both 0), denoted gcd(a, b), is the natural number
d ∈ N such that
• both d | a and d | b, and
• for all c ∈ N, if c | a and c | b, then c ≤ d.
The process terminates immediately after the nth step, when the remainder
is first found to be zero. The remainder at the nth step is then the GCD of
a and b. That is,
gcd(a, b) = rn .
MATH1081 Topic 2 – Number theory and relations Lecture 2.02 – The Euclidean algorithm 2/10
Example – Euclidean algorithm
Example. Use the Euclidean algorithm to find gcd(403, 286).
Solution. We have
403 = 1 × 286 + 117,
286 = 2 × 117 + 52,
117 = 2 × 52 + 13,
52 = 4 × 13 + 0.
So we can write gcd(403, 286) in the form 403x + 286y for integers x and y ,
where specifically x = 5 and y = −7.
MATH1081 Topic 2 – Number theory and relations Lecture 2.02 – The Euclidean algorithm 5/10
Bézout’s identity
The method we just saw can be generalised for any pair of integers.
Theorem. (Bézout’s identity)
Given any integers a and b, there exist integers x and y such that
gcd(a, b) = ax + by .
Values for x and y can be found by applying the Euclidean algorithm to a
and b and then working backwards, like in the previous example.
Note that the solution pair (x, y ) is not unique. For example, we saw
gcd(403, 286) = 13 = 5 × 403 + (−7) × 286, but it is also true that
gcd(403, 286) = 13 = (−17) × 403 + 24 × 286.
Notice that Bézout’s identity cannot be used in reverse. However, the
following weaker statement is true.
Theorem. Given d = ax + by for some integers a, b, x, y , we have that
gcd(a, b) | d.
Proof. By definition, gcd(a, b) | a and gcd(a, b) | b. So gcd(a, b) must be a
divisor of any integer linear combination of a and b, by a previous result
about divisibility.
MATH1081 Topic 2 – Number theory and relations Lecture 2.02 – The Euclidean algorithm 6/10
Example – Bézout’s identity
Example. Find integers x and y such that gcd(283, 193) = 283x + 193y .
Solution. The Euclidean algorithm applied to 283 and 193 gives:
283 = 1 × 193 + 90,
193 = 2 × 90 + 13,
90 = 6 × 13 + 12,
13 = 1 × 12 + 1,
12 = 12 × 1 + 0.
Working backwards from the penultimate line, we get:
1 = 13 − 12
= 13 − (90 − 6 × 13)
= 7 × 13 − 90
= 7 × (193 − 2 × 90) − 90
= 7 × 193 − 15 × 90
= 7 × 193 − 15 × (283 − 193)
= 22 × 193 − 15 × 283.
So gcd(283, 193) = 1 = 22 × 193 − 15 × 283, that is, x = −15 and y = 22.
MATH1081 Topic 2 – Number theory and relations Lecture 2.02 – The Euclidean algorithm 7/10
Solving linear equations for integers
Theorem. Given integers a, b, and c, there exist integers x and y such that
ax + by = c if and only if gcd(a, b) | c.
Proof. First suppose ax + by = c for some integers x and y . Since
gcd(a, b) is a divisor of both a and b, we must have that
gcd(a, b) | (ax + by ) for all integers x, y . So gcd(a, b) | c.
Next suppose gcd(a, b) | c. Then c = gcd(a, b)k for some integer k. By
Bézout’s identity, we know there exist integers x ′ and y ′ such that
gcd(a, b) = ax ′ + by ′ . Multiplying through by k then gives
c = a(kx ′ ) + b(ky ′ ) where x = kx ′ and y = ky ′ are integers.
Corollary. Suppose we are given integers a, b, and c, and wish to solve
ax + by = c for integers x and y .
• If gcd(a, b) ∤ c, then there are no integer solutions.
• If gcd(a, b) | c, then we can find integer solutions as follows:
◦ Find integers x ′ and y ′ satisfying ax ′ + by ′ = gcd(a, b) by applying
the Euclidean algorithm to a and b and working backwards.
c ′
◦ Writing d = gcd(a, b), we have that x = dx and y = dc y ′ are integer
solutions to ax + by = c.
MATH1081 Topic 2 – Number theory and relations Lecture 2.02 – The Euclidean algorithm 8/10
Example – Solving linear equations for integers
Example. Find integers x and y such that 289x + 119y = 13.
Solution. The Euclidean algorithm applied to 289 and 119 gives:
289 = 2 × 119 + 51,
119 = 2 × 51 + 17,
51 = 3 × 17 + 0.
So gcd(289, 119) = 17, which does not divide 13. Thus there are no integer
solutions to 289x + 119y = 13.
Example. Find integers x and y such that 289x + 119y = 34.
Solution. In this case, gcd(289, 119) = 17 is a divisor of 34, so there do
exist integer solutions.
Working backwards from the penultimate line of the Euclidean algorithm:
17 = 119 − 2 × 51
= 119 − 2(289 − 2 × 119)
= 5 × 119 − 2 × 289.
So an integer solution to 17 = 289x ′ + 119y ′ is x ′ = −2 and y ′ = 5.
Thus an integer solution to 34 = 289x + 119y is x = −4 and y = 10.
MATH1081 Topic 2 – Number theory and relations Lecture 2.02 – The Euclidean algorithm 9/10
Using Bézout’s identity in proofs
When proving statements involving GCDs, it can often be useful to use
Bézout’s identity. That is, if we are given that gcd(a, b) = c, then we can
use the fact that c = ax + by for some x, y ∈ Z.
For example, consider the following applications:
Theorem. Suppose a, b, and c are integers with a | bc and gcd(a, b) = 1.
Then a | c.
Proof. Since a | bc, we may write bc = ak for some integer k.
Since gcd(a, b) = 1, by Bézout’s identity there exist integers x and y such
that 1 = ax + by . Multiplying this through by c gives
MATH1081 Topic 2 – Number theory and relations Lecture 2.03 – Modular arithmetic 2/9
Properties of modular arithmetic
Suppose a, b, c, d ∈ Z and m ∈ Z+ . Below are several useful properties of
modular arithmetic:
• If a ≡ b (mod m), and k ∈ Z+ satisfies k | m, then a ≡ b (mod k).
• If a ≡ b (mod m) and c ≡ d (mod m), then a + c ≡ b + d (mod m).
• If a ≡ b (mod m), then a + k ≡ b + k (mod m) for all k ∈ Z.
• If a ≡ b (mod m) and c ≡ d (mod m), then ac ≡ bd (mod m).
• If a ≡ b (mod m), then ak ≡ bk (mod m) for all k ∈ Z.
• If a ≡ b (mod m), then ak ≡ bk (mod mk) for all k ∈ Z+ .
• If ak ≡ bk (mod mk) for some k ∈ Z+ , then a ≡ b (mod m).
(If there is a divisor common to both sides of the congruence and the
modulus, we can “divide” all terms through by that common divisor.)
• If ak ≡ bk (mod m) for some k ∈ Z, and gcd(m, k) = 1, then
a ≡ b (mod m).
(If there is a divisor common to both sides of the congruence and it is
coprime with the modulus, we can “divide” both sides of the congruence
through by that common divisor.)
• If a ≡ b (mod m), then ak ≡ b k (mod m) for all k ∈ Z+ .
MATH1081 Topic 2 – Number theory and relations Lecture 2.03 – Modular arithmetic 3/9
Properties of modular arithmetic – Proofs
Proofs are provided for two of these properties...
Theorem. If a ≡ b (mod m) and c ≡ d (mod m), then ac ≡ bd (mod m).
Proof. Since a ≡ b (mod m), we know that a = b + mk for some integer k,
and since c ≡ d (mod m), we know c = d + ml for some integer l. So
ac = (b + mk)(d + ml) = bd + mbl + mdk + m2 kl = bd + m(bl + dk + mkl)
where bl + dk + mkl ∈ Z. Thus ac ≡ bd (mod m).
Theorem. If ak ≡ bk (mod m) for some k ∈ Z, and gcd(m, k) = 1, then
a ≡ b (mod m).
Proof. Since ak ≡ bk (mod m), we know that m | (ak − bk), so
m | k(a − b). By the GCD Property 5 from Lecture 2.01, since
gcd(m, k) = 1, we must have that m | (a − b), which is equivalent to saying
a ≡ b (mod m).
Challenge. Using similar approaches, prove that the other properties hold.
Similar problems appear in Problem Set 2, Questions 6 and 8.
MATH1081 Topic 2 – Number theory and relations Lecture 2.03 – Modular arithmetic 4/9
Problem-solving with modular arithmetic
Having established these properties of modular arithmetic, we now have a
useful set of tools for solving problems that involve divisibility or remainders.
Example. Prove that a natural number is divisible by 3 if and only if its
digit sum is divisible by 3.
Solution. Let n be any natural number with k + 1 digits d0 , d1 , d2 , ... , dk
from right to left, so that
Thus n has the same residue modulo 3 as its digit sum. So in particular,
n mod 3 = 0 if and only if n’s digit sum is congruent to 0 modulo 3,
meaning n is divisible by 3 if and only if its digit sum is divisible by 3.
MATH1081 Topic 2 – Number theory and relations Lecture 2.03 – Modular arithmetic 5/9
Reducing powers modulo m
Finding large powers of the form ak modulo m can be difficult, since while
we are allowed to reduce a modulo m, we cannot reduce the power k in the
same way. However, it is always possible to simplify the expression by finding
small powers of a that reduce to smaller values modulo m, helping to
decrease the value of ak in steps. Typically, we look for a small power of a
that is close to 0 (ideally 1 or −1) modulo m.
Example. Find 71001 mod 12.
Solution. Checking small powers of 7, we first find that 72 ≡ 49 ≡ 1
(mod 12). So we have
500
71001 ≡ 72 × 71 ≡ 1500 × 7 ≡ 7 (mod 12),
meaning 71001 mod 12 = 7.
Example. Find 121001 mod 7.
Solution. First we can note that 121001 ≡ (−2)1001 (mod 7). Checking
small powers of 2, we find that (−2)3 = −8 ≡ −1 (mod 7), so
333
(−2)1001 ≡ (−2)3 × (−2)2 ≡ (−1)333 × 4 ≡ −4 ≡ 3 (mod 7).
Thus 121001 mod 7 = 3.
MATH1081 Topic 2 – Number theory and relations Lecture 2.03 – Modular arithmetic 6/9
Reducing powers modulo m – Example 2
Example. Find 51001 mod 93.
Solution. In order to check small powers of 5 here, it can be useful to use a
table. Working modulo 93, we have:
n 1 2 3 4 5 6 ...
5n 5 25 32 −26 −37 1 ...
Notice that to find each entry in this table, we only needed to multiply the
previous entry by 5 and reduce the result modulo 93. To keep the
multiplications manageable, we can always choose to use the reduced value
that is closest to 0. For example, to find 54 modulo 93, we did the following:
MATH1081 Topic 2 – Number theory and relations Lecture 2.03 – Modular arithmetic 7/9
Reducing powers modulo m – Example 3
Example. Find 3103 mod 15.
Solution. We can again check small powers of 3 here, working modulo 15:
n 1 2 3 4 5 ...
3n 3 9 12 6 3 ...
In this case, we can see we will never encounter a power of 3 that gives 1
modulo 15. But we can also see that the powers of 3 modulo 15 repeat with
period 4. So 3 ≡ 35 ≡ 39 ≡ 313 ≡ · · · ≡ 3101 (mod 15), and thus
Alternate solution. We can divide both the value and its modulus by the
common factor of 3 and first find 3102 mod 5. In this case, we can notice
that 32 = 9 ≡ −1 (mod 5), so
So 3102 ≡ 4 (mod 5), and we can now multiply both sides of the congruence
and the modulus through by 3 to find 3103 ≡ 12 (mod 15).
MATH1081 Topic 2 – Number theory and relations Lecture 2.03 – Modular arithmetic 8/9
Fermat’s Little Theorem
A useful theorem for simplifying powers in prime moduli is Fermat’s Little
Theorem:
Theorem. (Fermat’s Little Theorem)
For any prime p and any integer a such that p ∤ a, we have
ap−1 ≡ 1 (mod p).
Proof. (See MATH2400 – Finite Mathematics!)
Note that p − 1 is not necessarily the smallest non-negative power of a that
is 1 modulo p.
Example. Find the following values.
• 99100 mod 101.
Solution. Since 101 is prime, by FLT, a100 ≡ 1 (mod 101) for all integers
a where 101 ∤ a. So in this case we must have 99100 mod 101 = 1.
• 99909 mod 101.
Solution. We just showed that 99100 mod 101 = 1, so
99909 = (99100 )9 × 999 ≡ 1 × (−2)9 ≡ −512 ≡ 94 (mod 101).
MATH1081 Topic 2 – Number theory and relations Lecture 2.03 – Modular arithmetic 9/9
MATH1081 – Discrete Mathematics
Topic 2 – Number theory and relations
Lecture 2.04 – Solving linear modular congruences
ax + my ≡ c (mod m),
ax + 0y ≡ c (mod m),
ax ≡ c (mod m).
MATH1081 Topic 2 – Number theory and relations Lecture 2.04 – Solving linear modular congruences 1/10
Linear congruences – Checking all multiples
Example. Find all solutions to the linear congruence 6x ≡ 4 (mod 7).
Solution. Checking the multiples of 6 while working modulo 7, we have:
x 0 1 2 3 4 5 6
6x 0 6 5 4 3 2 1
So the only solution is x ≡ 3 (mod 7).
Example. Find all solutions to the linear congruence 6x ≡ 4 (mod 8).
Solution. Checking the multiples of 6 while working modulo 8, we have:
x 0 1 2 3 4 5 6 7
6x 0 6 4 2 0 6 4 2
So the only solutions are x ≡ 2 (mod 8) and x ≡ 6 (mod 8).
Equivalently, the only solution is x ≡ 2 (mod 4).
Example. Find all solutions to the linear congruence 6x ≡ 4 (mod 9).
Solution. Checking the multiples of 6 while working modulo 9, we have:
x 0 1 2 3 4 5 6 7 8
6x 0 6 3 0 6 3 0 6 3
So there are no solutions to 6x ≡ 4 (mod 9).
MATH1081 Topic 2 – Number theory and relations Lecture 2.04 – Solving linear modular congruences 2/10
Linear congruences – Using rules of modular arithmetic
Example. Find all solutions to the linear congruence 6x ≡ 4 (mod 7).
Solution. We have
6x ≡ 4 (mod 7),
−x ≡ 4 (mod 7),
x ≡ −4 (mod 7),
x ≡3 (mod 7).
MATH1081 Topic 2 – Number theory and relations Lecture 2.04 – Solving linear modular congruences 6/10
Solving linear congruences – Example 3
Example. Solve 130x ≡ 125 (mod 245).
Solution. First apply the Euclidean algorithm to the coefficient 130 and the
modulus 245. We have
245 = 1 × 130 + 115,
130 = 1 × 115 + 15,
115 = 7 × 15 + 10,
15 = 1 × 10 + 5,
10 = 2 × 5 + 0.
So gcd(130, 245) = 5. Since 5 | 125, there are solutions to the congruence,
and there should be exactly 5 solutions modulo 245.
Working backwards, we eventually find 5 = 17 × 130 − 9 × 245. So an
integer solution to 130x ′ + 245y ′ = 5 is x ′ = 17 and y ′ = −9.
Since the right-hand side of the congruence is 125, we need to multiply this
answer for x ′ by 125 245
5 = 25 and reduce the answer modulo 5 = 49.
So the general solution is x ≡ 17 × 25 ≡ 33 (mod 49), or in the original
modulus, by adding 49 repeatedly to our answer, we have
x ≡ 33, 82, 131, 180, or 229 (mod 245).
MATH1081 Topic 2 – Number theory and relations Lecture 2.04 – Solving linear modular congruences 7/10
Solving linear congruences – Example 3
Example. Solve 130x ≡ 125 (mod 245).
Alternative approach. Observing that gcd(130, 245) = 5 and that 5 | 125,
we first divide everything through by 5 to get the equivalent congruence
26x ≡ 25 (mod 49). Applying the Euclidean algorithm to 26 and 49 gives:
49 = 1 × 26 + 23,
26 = 1 × 23 + 3,
23 = 7 × 3 + 2,
3 = 1 × 2 + 1,
2 = 2 × 1 + 0.
MATH1081 Topic 2 – Number theory and relations Lecture 2.04 – Solving linear modular congruences 8/10
Solving linear congruences – Example 3
Example. Solve 130x ≡ 125 (mod 245).
Alternative solution. We have
MATH1081 Topic 2 – Number theory and relations Lecture 2.04 – Solving linear modular congruences 9/10
Multiplicative inverses
Definition. The (multiplicative) inverse of an integer x modulo m (if it
exists) is the integer y for which 0 ≤ y < m and xy ≡ 1 (mod m).
Notation. If it exists, we write the inverse of x modulo m as x −1 mod m.
For example, the multiplicative inverse of 3 modulo 7 is 5, since
3 × 5 = 15 ≡ 1 (mod 7). So 3−1 ≡ 5 (mod 7). Similarly, we can find:
x 0 1 2 3 4 5 6
x −1 mod 7 none 1 4 5 2 3 6
Example. Find the multiplicative inverse of 26 modulo 49.
Solution. We want to solve 26x ≡ 1 (mod 49). From the previous example,
we saw via the (reversed) Euclidean algorithm that 1 = 17 × 26 − 9 × 49, so
26 × 17 ≡ 1 (mod 49), meaning that 26−1 ≡ 17 (mod 49).
When given the general linear congruence ax ≡ c (mod m), if the
multiplicative inverse of a exists, we can multiply both sides of the
congruence by this value a−1 , giving x ≡ a−1 c (mod m).
If the multiplicative inverse of a does not exist, either there is no solution to
the congruence, or gcd(a, m) | c, in which case dividing the whole
congruence through by gcd(a, m) will produce a new congruence that we can
solve by repeating the above approach.
MATH1081 Topic 2 – Number theory and relations Lecture 2.04 – Solving linear modular congruences 10/10
MATH1081 – Discrete Mathematics
Topic 2 – Number theory and relations
Lecture 2.05 – Relations and equivalences
a b a b
or
c c
Notice that if two elements are related to each other, we can draw two
separate arrows representing these two relations, or just one arrow pointing
in both directions.
MATH1081 Topic 2 – Number theory and relations Lecture 2.05 – Relations and equivalences 3/10
Example – Representing relations
Example. Consider the set of people S = {a, b, c, d, e, f } representing
students Alyx, Barney, Chell, Dog, Eli, and Freeman. The relation R on the
set S is defined by x R y if and only if x considers y to be their friend.
Alyx’s friends are Dog, Eli, and Freeman. Barney’s friends are Freeman and
himself. Dog’s friend is Alyx. Eli’s friends are Alyx and Freeman. Freeman is
friends with everyone else. Represent this relation by a relation matrix and
an arrow diagram.
Solution. A relation matrix and arrow diagram for R are provided below.
0 0 0 1 1 1 a b
0 1 0 0 0 1
0 0 0 0 0 0
1 0 0 0 0 0
1 0 0 0 0 1 f
1 1 1 1 1 0 e c
d
MATH1081 Topic 2 – Number theory and relations Lecture 2.05 – Relations and equivalences 4/10
Reflexivity
Definition. A relation R on a set X is reflexive if and only if for all x ∈ X ,
we have x R x.
In an arrow diagram, a loop is an arrow pointing from one element to itself.
In terms of arrow diagrams, a relation R is reflexive if and only if every
element has a loop.
Diagrammatically, this property can be represented as:
implies
MATH1081 Topic 2 – Number theory and relations Lecture 2.05 – Relations and equivalences 5/10
Symmetry
Definition. A relation R on a set X is symmetric if and only if for all
x, y ∈ X , whenever x R y we have y R x.
In terms of arrow diagrams, a relation R is symmetric if and only if every
non-loop arrow points in both directions.
Diagrammatically, this property can be represented as:
implies
MATH1081 Topic 2 – Number theory and relations Lecture 2.06 – Partial orders 2/11
Examples of partial order relations
Example. Let S be a set. Show that the relation ⪯ on P(S) defined by
setting X ⪯ Y if and only if X ⊆ Y is a partial order relation.
Solution. We proceed by proving ⪯ is reflexive, antisymmetric, and
transitive.
Reflexivity: Let X ∈ P(S). Since every element of X is of course an element
of X , we know X ⊆ X , so X ⪯ X and thus ⪯ is reflexive.
Antisymmetry: Let X , Y ∈ P(S), and suppose X ⪯ Y and Y ⪯ X . Then
X ⊆ Y and Y ⊆ X , so by definition, we have X = Y . Thus ⪯ is
antisymmetric.
Transitivity: Let X , Y , Z ∈ P(S), and suppose X ⪯ Y and Y ⪯ Z . Then
X ⊆ Y and Y ⊆ Z , so for all x ∈ X we have x ∈ Y since X ⊆ Y , and
therefore x ∈ Z since Y ⊆ Z . So X ⊆ Z , meaning X ⪯ Z , and thus ⪯ is
transitive.
Hence ⪯ acting on P(S) is a partial order relation.
MATH1081 Topic 2 – Number theory and relations Lecture 2.06 – Partial orders 3/11
Examples of partial order relations
Example. Show that the relation ⪯ on N defined by setting x ⪯ y if and
only if x | y is a partial order relation.
Solution. We proceed by proving ⪯ is reflexive, antisymmetric, and
transitive.
Reflexivity: Let x ∈ N. Since x = x × 1 and 1 ∈ Z, we can write that x | x.
So x ⪯ x, and thus ⪯ is reflexive.
Antisymmetry: Let x, y ∈ N, and suppose x ⪯ y and y ⪯ x. Then y = xk
and x = yl for some natural numbers k and l. So x = (xk)l, implying
kl = 1, whose only solution over the natural numbers is k = l = 1. So
x = y , and thus ⪯ is antisymmetric.
Transitivity: Let x, y , z ∈ N, and suppose x ⪯ y and y ⪯ z. Then y = xk
and z = yl for some natural numbers k and l. So z = (xk)l where kl ∈ N,
which means x | z. So x ⪯ z, and thus ⪯ is transitive.
Hence ⪯ acting on N is a partial order relation.
Notice that if this relation ⪯ acted on the set Z instead of N, the relation
would no longer be antisymmetric and therefore (Z, | ) would not be a
partially ordered set. (For example, 1 | −1 and −1 | 1 but 1 ̸= −1.)
MATH1081 Topic 2 – Number theory and relations Lecture 2.06 – Partial orders 4/11
Hasse diagrams
Notation. Given ⪯ is a partial order relation on some set X , we use the
symbol ≺ to mean “precedes but does not equal”. That is, x ≺ y means
x ⪯ y and x ̸= y .
Definition. A Hasse diagram is a simplified way of representing a partially
ordered set. Given a partial order relation ⪯ on a set X , the Hasse diagram
for the partially ordered set (X , ⪯) is constructed as follows:
• Draw a labelled dot for each element of X .
• For each pair of elements x, y ∈ X , draw a line from x to y with x placed
lower than y if and only if both
◦ x ≺ y , and
◦ there does not exist z ∈ X such that x ≺ z and z ≺ y .
A Hasse diagram contains all the information of a usual arrow diagram for a
poset, but in a simpler format.
• Arrowheads are not needed since direction is implied by element position.
• Loops are not included since they must exist at every element.
• Lines implied by transitivity are not included since they must exist for
every upward path.
MATH1081 Topic 2 – Number theory and relations Lecture 2.06 – Partial orders 5/11
Hasse diagrams – subset example
Example. Draw the Hasse diagram for the partially ordered sets
(P({a, b}), ⊆ ) and (P({a, b, c}), ⊆ ).
Solution.
The Hasse diagram for the poset The Hasse diagram for the poset
(P({a, b}), ⊆ ) is: (P({a, b, c}), ⊆ ) is:
{a, b} {a, b, c}
{a, c}
{a} {b} {a, b} {b, c}
{a} {c}
{} {b}
{}
MATH1081 Topic 2 – Number theory and relations Lecture 2.06 – Partial orders 6/11
Hasse diagrams – divisibility example
Example. Draw the Hasse diagram for the partially ordered set
({1, 2, 3, 4, 6, 8, 9, 12, 18}, | ).
Solution. The Hasse diagram for the poset ({1, 2, 3, 4, 6, 8, 9, 12, 18}, | ) is:
8 12 18
9
4 6
2 3
MATH1081 Topic 2 – Number theory and relations Lecture 2.06 – Partial orders 7/11
Least and greatest elements
Definition. A minimal element of a partially ordered set (X , ⪯) is any
element x ∈ X such that there is no y ∈ X where y ≺ x.
In terms of Hasse diagrams, a minimal element is an element with no lines
connecting to it from below.
Definition. A maximal element of a partially ordered set (X , ⪯) is any
element x ∈ X such that there is no y ∈ X where x ≺ y .
In terms of Hasse diagrams, a maximal element is an element with no lines
connecting to it from above.
Definition. The least element of a partially ordered set (X , ⪯) (if it exists)
is the element x ∈ X for which x ⪯ y for all y ∈ X .
In terms of Hasse diagrams, the least element is the element that can reach
all other elements in X by following lines in a strictly upwards path.
Definition. The greatest element of a partially ordered set (X , ⪯) (if it
exists) is the element x ∈ X for which y ⪯ x for all y ∈ X .
In terms of Hasse diagrams, the greatest element is the element that can
reach all other elements in X by following lines in a strictly downwards path.
MATH1081 Topic 2 – Number theory and relations Lecture 2.06 – Partial orders 8/11
Least and greatest elements – Examples and properties
Example. Find the minimal, maximal, least, and greatest elements of
(P({a, b, c}), ⊆ ).
Solution. The only minimal element is {}, which is also the least element.
The only maximal element is {a, b, c}, which is also the greatest element.
Example. Find the minimal, maximal, least, and greatest elements of
({1, 2, 3, 4, 6, 8, 9, 12, 18}, | ).
Solution. The only minimal element is 1, which is also the least element.
The maximal elements are 8, 12, and 18. There is no greatest element, since
for example, 8 and 12 are not comparable.
Fact. The following statements are true for any partially ordered set (X , ⪯).
• If it exists, the least element is unique.
• If it exists, the greatest element is unique.
• If X is finite, the poset has a least element if and only if it has exactly
one minimal element.
• If X is finite, the poset has a greatest element if and only if it has exactly
one maximal element.
MATH1081 Topic 2 – Number theory and relations Lecture 2.06 – Partial orders 9/11
Lower and upper bounds
Definition. Given a partially ordered set (X , ⪯), a lower bound of two
elements x, y ∈ X is any element z ∈ X such that z ⪯ x and z ⪯ y .
In terms of Hasse diagrams, a lower bound of x and y is any element that
can reach both x and y by following lines in strictly upwards paths.
Definition. Given a partially ordered set (X , ⪯), the greatest lower bound of
two elements x, y ∈ X , denoted glb(x, y ), is the greatest element amongst
the set of all lower bounds (if it exists). That is, glb(x, y ) is the greatest
element (if it exists) of {z ∈ X : z ⪯ x and z ⪯ y }.
Definition. Given a partially ordered set (X , ⪯), an upper bound of two
elements x, y ∈ X is any element z ∈ X such that x ⪯ z and y ⪯ z.
In terms of Hasse diagrams, an upper bound of x and y is any element that
can reach both x and y by following lines in strictly downwards paths.
Definition. Given a partially ordered set (X , ⪯), the least upper bound of
two elements x, y ∈ X , denoted lub(x, y ), is the least element amongst the
set of all upper bounds (if it exists). That is, lub(x, y ) is the least element
(if it exists) of {z ∈ X : x ⪯ z and y ⪯ z}.
MATH1081 Topic 2 – Number theory and relations Lecture 2.06 – Partial orders 10/11
Lower and upper bounds – Examples and properties
Example. In the poset (P({a, b, c}), ⊆ ), find glb({a, b}, {b, c}) and
lub({a}, {a, b}) if they exist.
Solution. The lower bounds of {a, b} and {b, c} are {b} and {}, so the
greatest lower bound exists and is {b}. The upper bounds of {a} and {a, b}
are {a, b} and {a, b, c}, so the least upper bound exists and is {a, b}.
Example. In the poset ({1, 2, 3, 4, 6, 8, 9, 12, 18}, | ), find glb(12, 18) and
lub(4, 9) if they exist.
Solution. The lower bounds of 12 and 18 are 1, 2, 3, and 6, so the greatest
lower bound exists and is 6. There is no upper bound for 4 and 9, so their
least upper bound does not exist in this poset.
Fact. For any set S, in the partially ordered set (P(S), ⊆ ), for any two
elements A, B ∈ P(S) we have glb(A, B) = A ∩ B and lub(A, B) = A ∪ B.
Fact. In the partially ordered set (Z+ , | ), for any two elements a, b ∈ Z+
we have glb(a, b) = gcd(a, b) and lub(a, b) = lcm(a, b).
Note that the least element of (Z+ , | ) is 1, but it has no greatest element.
If we use the “alternate definition” given for the GCD and LCM, the above
facts also hold for the poset (N, | ), whose greatest element is 0.
MATH1081 Topic 2 – Number theory and relations Lecture 2.06 – Partial orders 11/11