0% found this document useful (0 votes)
66 views

Lecture 1.05 - Cartesian Product and Functions

The document defines Cartesian products, tuples, and functions using set theory concepts. It discusses the Cartesian product of two sets A and B, denoted A × B, as containing all ordered pairs (a, b) where a is in A and b is in B. Functions are defined as subsets of Cartesian products that map each element of the domain set to a single element of the codomain set. Visual representations of functions using arrow diagrams and coordinate graphs are also introduced.

Uploaded by

Amelia Amelia
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

Lecture 1.05 - Cartesian Product and Functions

The document defines Cartesian products, tuples, and functions using set theory concepts. It discusses the Cartesian product of two sets A and B, denoted A × B, as containing all ordered pairs (a, b) where a is in A and b is in B. Functions are defined as subsets of Cartesian products that map each element of the domain set to a single element of the codomain set. Visual representations of functions using arrow diagrams and coordinate graphs are also introduced.

Uploaded by

Amelia Amelia
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

MATH1081 – Discrete Mathematics

Topic 1 – Set theory and functions


Lecture 1.05 – Cartesian product and functions

Lecturer: Nathan J Jackson – [email protected]


Based on materials prepared by Dr Sean Gardiner
Cartesian product
Definition. A tuple is a finite, ordered collection of objects. Unlike for a set,
the order of the elements in a tuple is important, and elements may be
repeated. A tuple with exactly n elements is sometimes called an n-tuple. A
tuple with exactly 2 elements is also called an ordered pair.
Notation. A tuple can be represented by writing its elements surrounded by
parentheses. For example, (1, 2, 1) is a 3-tuple, and it is different to (1, 1, 2).
Definition. The Cartesian product of two sets A and B, denoted A × B, is
the set containing all ordered pairs (2-tuples) for which the first element is
an element of A, and the second element is an element of B. That is,
A × B = { (a, b) : a ∈ A and b ∈ B }.
Notation. We sometimes refer to the Cartesian product A × A as A2 . For
example, the real coordinate plane is often referred to as R2 .
Example. Suppose A = {1, 2} and B = {x, y , z}. Evaluate the following.
• A × B = { (1, x), (1, y ), (1, z), (2, x), (2, y ), (2, z) }.

• A2 = { (1, 1), (1, 2), (2, 1), (2, 2) }.

Fact. For any sets A and B, we have |A × B| = |A| × |B|.


MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 1/14
Functions
We typically think of a function as a rule that converts input values to
output values. To properly define what this means, we will use the language
of set theory.
Definition. Given sets X and Y , a function from X to Y is a subset of
X × Y which contains exactly one ordered pair (x, y ) for each x ∈ X .
Notation. A function f from a set X to a set Y is declared as f : X → Y .
If (x, y ) ∈ f , we can say “f maps x to y ”. Instead of writing (x, y ) ∈ f , we
can also write f : x 7→ y , or (more commonly) f (x) = y . We sometimes
refer to x as an input value of f , and y as the output value of x under f .
For example, if X = {a, b, c} and Y = {1, 2}, then a valid function
f : X → Y is given by f = {(a, 1), (b, 2), (c, 2)}. This means we can write
that f (a) = 1, f (b) = 2, and f (c) = 2.
We can also define a function using a formula. For example, consider the
function g : R → R given by g (x) = x 2 for all x ∈ R. This function when
2
interpreted as a subset
√ of R has infinitely many elements, including (1, 1),
(2, 4), (−2, 4), and ( 2, 2).

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 2/14
Example – Identifying functions
Example. Suppose X = {1, 2, 3} and Y = {a, b, c, d}. Which of the
following represent functions from X to Y ?
• {(1, a), (2, b), (3, a)} is a function, since there is exactly one output value
for each possible input value. The fact that c and d are never returned
as output values has no effect on whether f is a function.
• {(1, a), (2, b), (3, c), (d, 1)} is not a function, since it includes the
element (d, 1), but d ̸∈ X is not a valid possible input and 1 ̸∈ Y is not a
valid possible output.
• {(1, a), (2, b)} is not a function, since it does not define an output for the
input value 3 ∈ X ; that is, it does not include the element (3, y ) for any
y ∈ Y.
• {(1, a), (2, b), (3, c), (3, d)} is not a function, since it defines more than
one output for the input value 3 ∈ X ; that is, it includes the elements
(3, c) and (3, d) where the first element is the same but the second
element is different.

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 3/14
Arrow diagrams
It can sometimes be useful to represent a function f : X → Y visually. One
way this can be done is by using arrow diagrams. Just like for Venn
diagrams, the sets X and Y are represented as separate closed figures, and
their elements are represented as labelled points. The function is then
represented by a series of arrows, each pointing from an input value in X to
its corresponding output value in Y .
For example, in the case with sets X = {a, b, c} and Y = {1, 2}, and
function f : X → Y given by f = {(a, 1), (b, 2), (c, 2)}, the function f can
be represented with an arrow diagram as follows:
X f Y
a
1
b
2
c

In the special case that X = Y and we have f : X → X , we can draw just


one set of elements and represent the function as arrows pointing between
elements in X . This is known as a directed graph, and we will investigate
such structures further in Topic 5.
MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 4/14
Coordinate graphs
Another way to represent functions visually is by using a coordinate graph.
In a coordinate graph for a function f : X → Y , the elements of X are listed
along a horizontal axis, and the elements of Y are listed along a vertical axis.
Elements (x, y ) of the function are then marked as points at the coordinates
corresponding with axis values x and y . This method of representation is
particularly useful for cases where X and Y are each R or a subset of R.
For example, for the function g : R → R given by g (x) = x 2 , the function g
can be represented with a coordinate graph as follows:

g (x) g (x)
4 4
3 3
2 2
1 1
x x
−2 −1 1 2 −2 −1 1 2

When given a coordinate graph, we can determine whether it represents a


function by using the vertical line test: the graph represents a function if and
only if every possible vertical line touches the graph at exactly one point.

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 5/14
Domain, codomain, and range
Definition. For a function f : X → Y , the set of all input values X is called
the domain of f , and the set of potential output values Y is called the
codomain of f .
Definition. For a function f : X → Y , the set of all output values actually
obtained when evaluating all input values is called the range or image of f .
The range of f can be denoted as f (X ) or range(f ) or im(f ). So the range
of f is given by
f (X ) = {f (x) : x ∈ X } ⊆ Y .
For example, again consider the sets X = {a, b, c} and Y = {1, 2}, with
function f : X → Y given by f = {(a, 1), (b, 2), (c, 2)}. Clearly the domain
of f is X and the codomain of f is Y . Furthermore, the range of f is
f (X ) = f ({a, b, c}) = {f (a), f (b), f (c)} = {1, 2},
which happens to be the same as the codomain in this case.
Consider also the function g : Z → Z given by g (x) = x 2 for all x ∈ Z.
Clearly the domain and codomain of g are both Z. The range of g is the set
of all non-negative integers, so we have
im(g ) = g (Z) = {x ∈ Z : x ≥ 0}.
MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 6/14
Image and pre-image
Definition. Suppose f : X → Y is a function and A ⊆ X . The image of A
under f , written as f (A), is the set of all output values attained by mapping
all the input values in A under f . That is,

f (A) = {f (x) : x ∈ A} ⊆ Y .

Note that the image of the domain X under f is just the range (or image)
of f , which justifies using the notation f (X ).
In other words, if x ∈ A then f (x) ∈ f (A).
Exercise. Is it true that f (x) ∈ f (A) guarantees that x ∈ A?
Definition. Suppose f : X → Y is a function and B ⊆ Y . The pre-image of
B under f , written as f −1 (B), is the set of all input values that map to the
output values in B under f . That is,

f −1 (B) = {x ∈ X : f (x) ∈ B} ⊆ X .

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 7/14
Image and pre-image
Consider again the example with sets X = {a, b, c} and Y = {1, 2}, and
function f : X → Y given by f = {(a, 1), (b, 2), (c, 2)}.
The image of {a, b} under f is

f ({a, b}) == {f (a), f (b)} = {1, 2},

while
f ({b, c}) = {f (b), f (c)} = {2}.
The pre-image of {1} under f is

f −1 ({1}) = {a},

while
f −1 ({2}) = {b, c}.
Consider also the function g : Z → Z given by g (x) = x 2 for all x ∈ Z. Then

g ({−1, 0, 1}) = {0, 1},

while
g −1 ({4, 9}) = {−3, −2, 2, 3}.
MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 8/14
Venn and arrow diagrams
We can visualise images and pre-images for functions by adapting
characteristics of Venn diagrams to our arrow diagrams.
For example, for a function f : X → Y with a subset of the domain A ⊆ X
and a subset of the codomain B ⊆ Y , we can draw the following:
X f Y

A f (A)

f (X )

f −1 (B) B

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 9/14
Example 1
Example. Suppose the students Altair, Bayek, Connor, Desmond, Ezio, and
Frye are studying MATH1081 this term. Bayek is in tutorial 1, Frye is in
tutorial 2, and the other four students are in tutorial 3.
(i) Define a function g that maps the students to their tutorials.
(ii) Draw the arrow diagram representing g .
(iii) Find the range of g .
(iv) Find the pre-image of each of the tutorials under g .
Solution. Labelling the students by their initials, we can define the set of
students S = {a, b, c, d, e, f } and the set of tutorials T = {1, 2, 3}. Then
the function g : S → T that maps students to tutorials is given by the set
g = { (a, 3), (b, 1), (c, 3), (d, 3), (e, 3), (f , 2) }.
The arrow diagram for g is provided to the right. S
a g
We can see from the diagram that the range of g T
is g (S) = {1, 2, 3} = T . b
1
We can also see that the pre-images are given by c
2
• g −1 ({1}) = {b}, d
• g −1 ({2}) = {f }, and
3
e
−1
• g ({3}) = {a, c, d, e}.
f
MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 10/14
Example 2
Example. Let the set S = {a, b, c, d, e, f } represent the set of students
Altair, Bayek, Connor, Desmond, Ezio, and Frye respectively. The function
h : S → S mapping each student to their best friend is given by
h = {(a, e), (b, f ), (c, e), (d, e), (e, e), (f , b)}.
(i) Interpret this function h.
(ii) Draw the arrow diagram representing h.
(iii) Find the range of h.
(iv) Find h({a, c}) and h−1 ({a, c}).
Solution. Ezio is the best friend of Altair, Connor, Desmond, and himself.
Bayek and Frye are each other’s best friends.
The arrow diagram for h is provided to the right. S h S
a a
We can see from the diagram that the range of h
is h(S) = {b, e, f }. b b
We can also see that h({a, c}) = {e} while c c
h−1 ({a, c}) = ∅. d d
e e
f f

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 11/14
Floor and ceiling functions
Definition. The floor function is a function with domain R and range Z
defined as follows: for any x ∈ R, the floor of x is written as ⌊x⌋ and is
given by the largest integer less than or equal to x.
Definition. The ceiling function is a function with domain R and range Z
defined as follows: for any x ∈ R, the ceiling of x is written as ⌈x⌉ and is
the smallest integer greater than or equal to x.
Example. Evaluate the following:
• ⌊3.14⌋ = 3.
• ⌈3.14⌉ = 4.
• ⌊−0.5⌋ = −1.
• ⌈−0.5⌉ = 0.
• ⌊1⌋ = 1.
• ⌈1⌉ = 1.

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 12/14
Example 3
Example. Let f : R → R be the function given by f (x) = ⌊x⌋, and let
g : R → R be the function given by g (x) = ⌈x⌉.
(i) Draw the coordinate graphs representing f and g .
(ii) Find the range of f and of g .
(iii) Let S = { n1 : n ∈ Z+ } = {1, 12 , 13 , 14 , ... }. Find f (S), g (S), f −1 (S), and
g −1 (S).
Solution. The coordinate graphs are provided below.

f (x) g (x)
4 4
3 3
2 2
1 1
x x
−4 −3 −2 −1 1 2 3 4 −4 −3 −2 −1 1 2 3 4
−1 −1
−2 −2
−3 −3
−4 −4

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 13/14
Example 3 (continued)
Example. Let f : R → R be the function given by f (x) = ⌊x⌋, and let
g : R → R be the function given by g (x) = ⌈x⌉.
(i) Draw the coordinate graphs representing f and g .
(ii) Find the range of f and of g .
(iii) Let S = { n1 : n ∈ Z+ } = {1, 12 , 13 , ... }. Find each of f (S), g (S),
f −1 (S), and g −1 (S).
Solution. The coordinate graphs indicate that the range of both f and of g
is Z. To confirm this, notice that for any k ∈ Z, we have f (k) = g (k) = k,
so there is at least one input value that returns any integer k as an output.
Notice that f (S) = {f (1), f ( 21 ), f ( 13 ), f ( 14 ), ... } = {1, 0, 0, 0, ... } = {0, 1}.
Similarly, g (S) = {g (1), g ( 21 ), g ( 31 ), g ( 14 ), ... } = {1, 1, 1, 1, ... } = {1}.
No input value of either function can return a non-integer output. So in
particular, the pre-image of any non-integer is empty, that is,
f −1 ({ 21 }) = g −1 ({ 12 }) = ∅, f −1 ({ 13 }) = g −1 ({ 13 }) = ∅, and so on.
So f −1 (S) = f −1 ({1, 21 , 13 , ... }) = f −1 ({1}) = {x ∈ R : 1 ≤ x < 2}.
Similarly, g −1 (S) = g −1 ({1, 21 , 13 , ... }) = g −1 ({1}) = {x ∈ R : 0 < x ≤ 1}.
MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 14/14

You might also like