0% found this document useful (0 votes)
12 views34 pages

Lecture Slides MATH255 Week 4

The document covers the concepts of relations and functions in mathematics, specifically focusing on ordered pairs, Cartesian products, and various types of relations such as reflexive, symmetric, transitive, and equivalence relations. It includes definitions, examples, and exercises to illustrate these concepts. The content is part of a mathematics course (MATH255) at the University of Wollongong, taught by Dr. Chayne Planiden.

Uploaded by

urbanatuba
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)
12 views34 pages

Lecture Slides MATH255 Week 4

The document covers the concepts of relations and functions in mathematics, specifically focusing on ordered pairs, Cartesian products, and various types of relations such as reflexive, symmetric, transitive, and equivalence relations. It includes definitions, examples, and exercises to illustrate these concepts. The content is part of a mathematics course (MATH255) at the University of Wollongong, taught by Dr. Chayne Planiden.

Uploaded by

urbanatuba
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/ 34

MATH255: Mathematics for Computing

Dr Chayne Planiden

School of Mathematics and Statistics


University of Wollongong

January 17, 2024

Dr Chayne Planiden 1/ 35
Week 4: Relations and Functions

Definition
A pair (a, b) is an ordered pair if it has the property

(a, b) = (c, d) ⇔ a = c ∧ b = d.

Definition
The Cartesian product A × B is the set of all ordered pairs
with first element from A and second element from B.

A × B = {(a, b) : a ∈ A, b ∈ B}

Dr Chayne Planiden 2/ 35
Relations

Example. Let A = B = R. Then A × B = R × R = R2 is the set


of all points in the Cartesian plane.
Example. Let A = {3}, B = {2, 3}. Then A × B = {(3, 2), (3, 3)}.
Example. Let A = {x, y }, B = {1, 2, 3}, C = {α, β}. Then
A × B = {(x, 1), (x, 2), (x, 3), (y , 1), (y , 2), (y , 3)} and
(A×B)×C = {((x, 1, α), (x, 2, α), (x, 3, α), (y , 1, α), (y , 2, α), (y , 3, α),
(x, 1, β), (x, 2, β), (x, 3, β), (y , 1, β), (y , 2, β), (y , 3, β)}.

Dr Chayne Planiden 3/ 35
Relations

Definition
A relation R from A to B is a subset of A × B that is defined by
some rule that relates elements of A with elements of B. We
say that a is related to b, denoted by aRb, if (a, b) ∈ R.

Example. Let S = {0, 1, 2, 3}, R ⊆ S × S:


R = {(x, y ) : ∃ z ∈ N s.t. x + z = y }.
(a) What is a simpler description of R?
(b) List all the elements of R.
(c) Sketch S × S and circle the members of R.

Dr Chayne Planiden 4/ 35
Relations
(a) Since x, y ∈ S and x + z = y for some z ∈ N, R is all pairs
(x, y ) such that x < y .

R = {(x, y ) : x < y }

(b) R = {(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)}
(c) .

Dr Chayne Planiden 5/ 35
Relations

Example. On Z \{0}, R = {(x, y ) : ∃ z ∈ Z s.t. xz = y }


(a) Describe R. (What if x = ±1, x = ±2, . . .)
(b) True or false: (2, −4) ∈ R, −3R0, (3, 5) ∈ R.
(a) If x = 1, then 1 · z = y , so (1, ±1), (1, ±2), · · · ∈ R.
If x = −1, then −1 · z = y , so (−1, ±1), (−1, ±2), · · · ∈ R.
If x = 2, then 2 · z = y , so (2, ±2), (2, ±4), · · · ∈ R.
This pattern continues with all choices of x, so
R = {(x, y ) : y is a nonzero multiple of x}.
(b) Since −4 is a nonzero multiple of 2, we have (2, −4) ∈ R.
Since 0 is not a nonzero multiple of −3, we have
(−3, 0) 6∈ R.
Since 5 is not a nonzero multiple of 3, we have (3, 5) 6∈ R.

Dr Chayne Planiden 6/ 35
Relations

Example. On Z, R = {(m, n) : m − n is even}.


(a) Which are in R? (0, 3), (−5, −6), (2, −11), (17, 1)
(b) Prove that n odd → nR1.
(a) 0 − 3 = −3 → (0, 3) 6∈ R
−5 − (−6) = 1 → (−5, −6) 6∈ R
2 − (−11) = 13 → (2, −11) 6∈ R
17 − 1 = 16 → (17, 1) ∈ R
(b) Let n be odd. Then ∃ k ∈ Z s.t. n = 2k + 1. Is nR1?
n − 1 = (2k + 1) − 1 = 2k , k ∈ Z → nR1.

Dr Chayne Planiden 7/ 35
Relations

Relations are sets, so all the set operators seen so far can be
applied to relations.
Example. On R, R1 = {(x, y ) : x = y }, R2 = {(x, y ) : x = −y }.
What are R1 ∪ R2 and R1 ∩ R2 ?
R1 ∪ R2 = {(x, y ) : x = ±y }, R2 = {(0, 0)}.

Dr Chayne Planiden 8/ 35
Relations

Definition
Let R be a relation from A to B. The domain and range of R
are the following.

dom R = {x ∈ A : ∃ y ∈ B s.t. xRy }

ran R = {y ∈ B : ∃ x ∈ A s.t. xRy }

Note. dom R ⊆ A and ran R ⊆ B.


Example. Let A = {0, 1, 2, 3}, R = {(0, 0), (0, 1), (0, 2), (3, 0)}.
Find dom R, ran R.
dom R = {0, 3}, ran R = {0, 1, 2}

Dr Chayne Planiden 9/ 35
Relations

Example. On Z, let R = {(x, y ) : xy 6= 0}. Find dom R, ran R.


dom R = Z \{0}, ran R = Z \{0}
Example. On Z × Q, let R = (x, y ) : x 6= 0 ∧ y = x1 . Find


dom R, ran R.
R = (1, 1), 2, 12 , 3, 31 , . . . , (−1, −1), −2, − 21 , −3, − 13 , . . .
    

dom R = Z \{0}, ran R = ±1, ± 12 , ± 13 , . . .




Dr Chayne Planiden 10/ 35


Relations

Definition
Let R be a relation from A to B. The inverse relation R −1 from
B to A is define

R −1 = {(y , x) : (x, y ) ∈ R}.

Note. dom R −1 = ran R, ran R −1 = dom R.


Example. Let A = {a, b, c}, B = {1, 2, 3, 4},
R = {(a, 1), (b, 2), (c, 3), (a, 4)}. Find R −1 .
R −1 = {(1, a), (2, b), (3, c), (4, a)}

Dr Chayne Planiden 11/ 35


Relations

Example. On N, let R = {(x, y ) : y = 2x}. Write 3 elements of


R and 3 elements of R −1 . Define R −1 .
(1, 2), (5, 10), (36, 72) ∈ R
(2, 1), (10, 5), (72, 36) ∈ R −1
R −1 = {(x, y ) : x = 2y }

Dr Chayne Planiden 12/ 35


Relations

Definition
Let R be a relation on A. Then R is
1 reflexive if ∀ x ∈ A, xRx;
2 symmetric if ∀ x, y ∈ A, xRy → yRx;
3 transitive if ∀ x, y , z ∈ A, xRy ∧ yRz → xRz.

Example. On N, R = {(x, y ) : x is a factor of y } (y = kx, k ∈ N).


∀ x ∈ N, xRx? x = 1 · x, 1 ∈ N TRUE. Thus, R is reflexive.
∀ x, y ∈ N, xRy → yRx?
1
2R6 since 6 = 3 · 2, but 2 = 6k → k = 3 6∈ N, so (6, 2) 6∈ R.
Thus, R is not symmetric.
∀ x, y , z ∈ N, xRy ∧ yRz → xRz?
xRy ∧ yRz → y = kx, z = py , k , p ∈ N.
z = py = p(kx) = (pk )x, pk ∈ N → xRz. Thus, R is transitive.

Dr Chayne Planiden 13/ 35


Relations

Example. On R, R = {(x, x) : x ∈ R} is the identity relation.


Since (x, x) ∈ R ∀ x ∈ R, we have that R is reflexive.
Since (x, y ) ∈ R → x = y → (y , x) ∈ R, we have that R is
symmetric.
Since (x, y ), (y , z) ∈ R → x = y = z → (x, z) ∈ R, we have that
R is transitive.

Dr Chayne Planiden 14/ 35


Relations

Example. On Z, R = {(x, y ) : x < y }.


Since x 6< x for any x ∈ Z, we have that (x, x) 6∈ R ∀ x ∈ Z and
R is not reflexive.
For instance 3 < 5 so (3, 5) ∈ R, but 5 6< 3 so (5, 3) 6∈ R and R
is not symmetric.
If x < y and y < z, then for sure x < z. So (x, y ), (y , z) ∈ R →
(x, z) ∈ R ∀ x, y , z ∈ Z and R is transitive.

Dr Chayne Planiden 15/ 35


Relations

Example. On the set P of people in the world, R = {(x, y ) :


x is in the family of y }.
∀ x ∈ P, x is in the family of x. So R is reflexive.
∀ x, y ∈ P, i x is in the family of y , then y is in the family of x. So
R is symmetric.
∀ x, y , z ∈ P, if x is in the family of y and y is in the family of z,
then x is in the family of z. So R is transitive.

Exercise. Determine reflexive, symmetric, transitive for the fol-


lowing relations.
1 On R, R = {(x, y ) : y = x 2 }.
2 On P, R = {(x, y ) : x loves y }.

Dr Chayne Planiden 16/ 35


Relations
Definition
Let R be a relation on A. Then R is an equivalence relation on
A iff R is reflexive, symmetric and transitive.

Example. On Z , prove that R = {(a, b) : ab = 0} is not an


equivalence relation.
This is a symmetric relation, since ab = 0 → ba = 0. But it is
not reflexive nor transitive. One counterexample is enough, bet
here is one for each.
If (1, 1) ∈ R, then 1 · 1 = 0 FALSE. Thus, (1, 1) 6∈ R and R is not
reflexive. Therefore, R is not an equivalence relation.
(1, 0) ∈ R and (0, 3) ∈ R, but (1, 3) 6∈ R, so R is not transitive.
Therefore, R is not an equivalence relation.
Exercise. Prove that for any given n ∈ Z, R = {(a, b) : (b −
a)/n ∈ Z} is an equivalence relation on Z.
Dr Chayne Planiden 17/ 35
Relations

Example. Let A = {0, 1, 2, 3}, R = {(0, 0), (0, 2), (1, 1), (2, 0), (2, 2), (3, 3)}.
Prove R is an equivalence relation.
Since (0, 0), (1, 1), (2, 2), (3, 3) ∈ R, we have that R is reflexive.
(0, 2) ∈ R → (2, 0) ∈ R and vice versa, and trivially (0, 0) ∈
R → (0, 0) ∈ R, etc., so we have that R is symmetric.
(0, 0), (0, 2) ∈ R → (0, 2) ∈ R; (1, 1), (1, 1) ∈ R → (1, 1) ∈ R
(2, 0), (0, 0) ∈ R → (2, 0) ∈ R; (2, 0), (0, 2) ∈ R → (2, 2) ∈ R
(2, 2), (2, 0) ∈ R → (2, 0) ∈ R; (2, 2), (2, 2) ∈ R → (2, 2) ∈ R
(3, 3), (3, 3) ∈ R → (3, 3) ∈ R; (0, 0), (0, 0) ∈ R → (0, 0) ∈ R
So we have that R is transitive.

Therefore, R is an equivalence relation.

Dr Chayne Planiden 18/ 35


Relations

Definition
Let R be an equivalence relation on A. For each a ∈ A, the
equivalence class of a, denoted by [a], is the set of all
elements of A that are related to a.

[a] = {x ∈ A : xRa}

For any a, b ∈ A, either [a] = [b] or [a] ∩ [b] = ∅.


All equivalence classes of A form a partition of A: their
union is A and their pairwise intersection is empty.

Dr Chayne Planiden 19/ 35


Relations

Example. Let A = {0, 1, 2}, R = {(0, 0), (1, 1), (2, 2), (0, 1), (1, 0)}.
Find [0], [1], [2].
[0] = {x ∈ A : xR0} = {0, 1}
[1] = {x ∈ A : xR1} = {0, 1}
[2] = {x ∈ A : xR2} = {2}
Example. What do the equivalence classes of the identity rela-
tion on R look like? R = {(x, x) : x ∈ R}
1  1
1
2 = x ∈ R : xR 2 = 2
[0] = {0}
[−2.4] = {−2.4} . . .

Every equivalence class is just one element.

Dr Chayne Planiden 20/ 35


Relations

Example. On Z, let R = {(a, b) : a ≡ b (mod 3)}. Find [0], [1], [2].


[0] = {x ∈ Z : xR0} = x ∈ Z : 0−x

3 ∈ Z = {. . . , −6, −3, 0, 3, 6, . . .}
[1] = x ∈ Z : 1−x

3 ∈ Z = {. . . , −5, −2, 1, 4, 7, . . .}
2−x

[2] = x ∈ Z : 3 ∈ Z = {. . . , −4, −1, 2, 5, 8, . . .}

Note. [0] = [3] = [−3] = [6] = · · · , etc.,


[0] ∩ [1] = ∅, [0] ∩ [2] = ∅, [1] ∩ [2] = ∅ and
[0] ∪ [1] ∪ [2] = Z.

Dr Chayne Planiden 21/ 35


Functions

Definition
A relation f from A to B is a function iff for each x ∈ A there is
at most one y ∈ B such that (x, y ) ∈ f .

A function f from A to B is denoted by f : A → B. The equation


y = f (x) means that (x, y ) ∈ f , in which case y is the image of
x under f .

Dr Chayne Planiden 22/ 35


Functions
Relations on R can be plotted by drawing all the points. A graph-
ical way to see if a relation is a function or not is the vertical line
test: every vertical line cuts through the curve of the relation at
most once. This is not a proof, but it is a good way to visualise
functions.

The relation on the left is a function, as every possible vertical


line intersects the curve only once. The relation on the right is
not a function; while there are some vertical lines that intersect
at most once, there are others that intersect twice.

Dr Chayne Planiden 23/ 35


Functions

Exercise. Sketch the relations below and convince yourself which


ones are functions via the vertical line test.
1 On R, R = {(x, y ) : y = x 2 }
2 On R, R = {(x, y ) : x = y 2 }
3 On R+ , R = {(x, y ) : x = y 2 }

4 On R, R = {(x, y ) : y = x}
Exercise. Which are functions?
1 The identity relation on A = {1, 5, 10}
2 A = {0, 2, 4}, B = {1, 3, 5}, R on A × B,
R = {(x, y ) : x + 1 = y }
3 On Z, F = {(x, y ) : x + 1 = y }
4 On R, R = {(x, y ) : y = 1}

Dr Chayne Planiden 24/ 35


Functions

Definition
Let f : A → B be a function. Then f is injective (one-to-one) iff
for all x1 , x2 ∈ A,

f (x1 ) = f (x2 ) ⇔ x1 = x2 .

That is, each element of the range is the image of only one
element of the domain.
Note. An injective function satisfies the horizontal line test.

Dr Chayne Planiden 25/ 35


Functions

Example. Let A = {0, 1, 2, 3}, f : P(A) → N ∪{0}, f (Ai ) = |Ai |,


so f outputs the number of elements in Ai . Prove or disprove
that f is injective.

f ({1, 2}) = 2
f ({1, 3}) = 2

So this is not a 1 − 1 function; f is not injective.


Example. Which are injective?
On A = {1, 2, 3}, F = {(1, 2), (2, 3), (3, 1)}.
On A, G = {(1, 2), (2, 1), (3, 1)}.
On Z, F = {(x, y ) : y = 2x}.

On Z \{0} × R, F = {(x, y ) : y x 2 − 1}.

Dr Chayne Planiden 26/ 35


Functions
1 By direct inspection, every output comes from one distinct
input. Therefore, F is injective.
2 By direct inspection, the 1 is an output for two different
inputs: the 2 and the 3. Therefore, G is not injective.
3 Let F (x1 ) = F (x2 ). Then
2x1 2x2
2x1 = 2x2 → = → x1 = x2 .
2 2
Therefore, F is 1-1.
4 Let F (x1 ) = F (x2 ). Then
q q q 2 q 2
x1 − 1 = x2 − 1 → x1 − 1 = x22 − 1
2 2 2

→ x12 − 1 = x22 − 1 → x12 = x22 → x1 = ±x2

For instance, F (1) = 0 and F (−1) = 0. Therefore, F is not


1-1.
Dr Chayne Planiden 27/ 35
Functions

Definition
A function f : A → B is surjective (onto) iff ran f = B. That is,

∀ y ∈ B ∃ x ∈ A s.t. f (x) = y .

Example. Let A = {1, 2, 3, 4, 5}, B = {a, b, c, d}. Which are


surjective?
1 f : A → B, f = {(1, a), (2, c), (3, c), (4, d), (5, d)}
2 f : A → B, f = {(1, a), (2, b), (3, c), (4, d), (5, a)}
3 f : R → R, f (x) = 4x − 1
4 f : Z → Z, f (x) = 4x − 1

Dr Chayne Planiden 28/ 35


Functions

1 Since b ∈ B & there is no x ∈ A s.t. f (x) = b, f is not onto.


2 Since every y ∈ B is output for at least one x ∈ A, f is onto.
3 Let y ∈ R. Is there x ∈ R s.t. f (x) = y ?

y +1
y = 4x − 1 → x = ∈R YES
4
Therefore, f is surjective.
4 For instance, let y = 2. Then

2+1 3
2 = 4x − 1 → x = = 6∈ Z .
4 4
Therefore, f is not surjective.

Dr Chayne Planiden 29/ 35


Functions

Definition
The inverse of a function f , denoted by f −1 , is also a function iff
f is bijective, i.e. injective and surjective.

In the case that f −1 is a function, the following properties are


satisfied.
dom f −1 = ran f
ran f −1 = dom f
f (f −1 (x)) = x ∀ x ∈ ran f
f −1 (f (x)) = x ∀ x ∈ dom f

Dr Chayne Planiden 30/ 35


Functions
Graphically, f −1 is the reflection of f about the line y = x.
Example. Sketch f : R+ → R+ , f (x) = x 2 . Find and sketch f −1 .
Is f −1 a function?

The red curve is y = x 2 .√Reflecting on y = x (black dashed), we


obtain the function y = x in blue, the inverse function of x 2 .

Dr Chayne Planiden 31/ 35


Functions

Example. Find and test the inverse function of f : R → R, f (x) =


3x − 2.
1
f −1 : x = 3y − 2 → x + 2 = 3y → y = (x + 2)
   3
1 1
f (f −1 (x)) = f (x + 2) = 3 (x + 2) − 2 = x + 2 − 2 = x
3 3
1 1
f −1 (f (x)) = f −1 (3x − 2) = [(3x − 2) + 2] = · 3x = x
3 3

Dr Chayne Planiden 32/ 35


Functions

x−2
Example. Let f : R → R, f (x) = x+1 . Find the domain and range
of f , prove f is bijective and find f −1 .
The domain is the set of all allowable inputs, so only the −1
causes a problem (division by zero): dom f = R \{−1}. The
range of f is the domain of f −1 , so let’s wait on that.
Injective. Let f (x1 ) = f (x2 ). Then

x1 − 2 x2 − 2
= ⇔ (x1 − 2)(x2 + 1) = (x1 + 1)(x2 − 2)
x1 + 1 x2 + 1
⇔x1 x2 − 2x2 + x1 − 2 = x1 x2 + x2 − 2x1 − 2
⇔ − 2x2 + x1 = x2 − 2x1 ⇔ 3x1 = 3x2 ⇔ x1 = x2

Therefore, f is injective.

Dr Chayne Planiden 33/ 35


Functions

Surjective. Let y ∈ R. If ∃ x ∈ R s.t. f (x) = y , then

x −2
y= ⇔ y (x + 1) = x − 2 ⇔ xy + y = x − 2
x +1
2+y
⇔x(1 − y ) = 2 + y ⇔ x = ∈ R,
1−y

as long as y 6= 1. Therefore, f is surjective. Also, this gives


f −1 (x) = 2+x
1−x and thus ran f = dom f
−1 = R \{1}.

Dr Chayne Planiden 34/ 35

You might also like