Discrete Structure 2
Discrete Structure 2
Discrete Structure 2
Relation
Set-builder notation
Construction
• Cartesian Product
• Purpose of Cartesian Product
– All possible ways to take things from multiple sets
• Example: I have an apple, and orange, and a pear. The TA has a pencil, a pen,
an eraser, and a book. You take one thing from each of us.”
• You are selecting one element from each set. What are the possible selections
you can make? How many possibilities are there?
• Symbolic Notation:
• Definition:
– Example: A standard deck of playing cards is basically the Cartesian Product
Important Property
(commutative property does not hold)
Cardinality
Other representations
Matrices
Graphs
Vertices, Edges
Adjacency Matrix
Relations
Let A and B be sets. A binary relation from A to B is a subset of A × B.
We use the notation aRb to denote that (a, b) ∈ R and a R b to denote that (a,
b) /∈ R. Moreover, when (a, b) belongs to R, a is said to be related to b by R.
Relationships between elements of sets occur in many contexts.
Relations on a Set
A relation on a set A is a relation from A to A.
et A be the set {1, 2, 3, 4}. Which ordered pairs are in the rela-
tion R = {(a, b) | a divides b}? Solution: Because (a, b) is in R if
and only if a and b are positive integers not exceeding 4 such
that a divides b, we see that R = {(1, 1), (1, 2), (1, 3), (1, 4), (2,
2), (2, 4), (3, 3), (4, 4)}.
Properties of relation
There are several properties that are used to classify relations on a set. We will introduce the most impor-
tant of these here. In some relations an element is always related to itself. For instance, let R be the rela-
tion on the set of all people consisting of pairs (x, y) where x and y have the same mother and the same
father. Then xRx for every person x.
Consider the following relations on {1, 2, 3, 4}:
2 3 2
The definition shows that R = R ◦ R, R = R ◦ R = (R ◦ R)◦ R, and so on
Let R = {(1, 1), (2, 1), (3, 2), (4, 3)}. Find the powers Rn, n = 2, 3, 4,
◦R, we find that R2 = {(1, 1), (2, 1), (3, 1), (4, 2)}. Furthermore, because R3 = R2 ◦R,
R3 = {(1, 1), (2, 1), (3, 1), (4, 1)}. Additional computation shows that R4 is the same
as R3, so R4 = {(1, 1), (2, 1), (3, 1), (4, 1)}. It also follows that Rn = R3 for n = 5, 6,
7,.......
The relation R on a set A is transitive if
and only if Rn ⊆ R for n = 1, 2, 3,....
n-ary Relation
Let A1, A2,...,An be sets. An n-ary relation on these sets is a subset of
A1 × A2 ×···× An. The sets A1, A2,...,An are called the domains of the
relation, and n is called its degree.
• Relationships among elements from more than two sets are called n-ary relation