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

1.3 Relations 1

The document defines and provides examples of Cartesian products and binary relations. It states that the Cartesian product of two non-empty sets A and B, written as A × B, is the set of all ordered pairs (a, b) where a ∈ A and b ∈ B. It also defines a binary relation R from set X to Y as a subset of the Cartesian product X × Y. Binary relations can be represented using matrices and directed graphs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views

1.3 Relations 1

The document defines and provides examples of Cartesian products and binary relations. It states that the Cartesian product of two non-empty sets A and B, written as A × B, is the set of all ordered pairs (a, b) where a ∈ A and b ∈ B. It also defines a binary relation R from set X to Y as a subset of the Cartesian product X × Y. Binary relations can be represented using matrices and directed graphs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 18

Discrete Mathematics

2
Cartesian Product
If A and B are two non-empty sets, then their Cartesian
product A × B is the set of all ordered pair of elements
from A and B.

A × B = {(x, y) : x ∈ A, y ∈ B}

Suppose, if A and B are two non-empty sets, then the


Cartesian product of two sets, A and set B is the set of
all ordered pairs (a, b) such that a ∈ A and b ∈ B which
is denoted as A × B.
Example: If A = {7, 8} and B = {2, 4, 6}, then
A× B = {(7, 2); (7, 4); (7, 6); (8, 2); (8, 4); (8, 6)}

3
Relation
• Definition: A binary relation R from set X to Y (written as XRY or R(X,Y)) is a subset of
the Cartesian product X×Y. If the ordered pair of R is reversed, the relation also changes.
It will be another binary relation F from Y  X

• Generally an n-ary relation R between sets A1,…,An and is a subset of the n-ary
product A1×⋯×An. The minimum cardinality of the relation R is Zero and maximum
is n2 in this case.

• A binary relation R on a single set A is a subset of A×A

• For two distinct sets, A and B, having cardinalities m and n respectively, the maximum
cardinality of a binary relation R from A to B is mn.

4
Example
• Let A and B be two sets such that A = {1, 5, 9, 13, 17} and B = {1, 2, 3, 4, 5}. Then,
• R = {(x, y): x = 4y – 3, x ∈ A and y ∈ B} (Set-builder form)
• ={(1,1),(5,2),(9,3),(13,4),(17,5)}

• Let A be the set of people in the city. Define the following relation R on A
• (a,b) ∈ R if and only if there is a sequence a0, a1, a2, ..., an of people in A such that
a0 = a, an = b and ai-1 knows ai , i= 1 ,2 , ...., n.
• Note: n will depend on a and b.

5
Domain and Range: Sets Arising from a Relation

If there are two sets A and B, and relation R is the set of ordered pair (x, y),
x∈A and y∈B

• The domain of R, Dom(R), is the set {x|(x,y)∈R for some y in B}


• Dom(R) ⊆ A
• The range of R, Ran(R), is the set {y|(x,y)∈R for some x in A}
• Ran(R) ⊆ B

6
Example
1. Let, A={1,2,9} and B={1,3,7}
• Case 1 − If relation R is 'equal to' then R={(1,1)}
Dom(R) = {1},Ran(R)={1},
• Case 2 − If relation R is 'less than' then R={(1,3),(1,7),(2,3),(2,7)}
Dom(R) = {1,2},Ran(R)={3,7}
• Case 3 − If relation R is 'greater than' then R={(2,1),(9,1),(9,3),(9,7)}
Dom(R) = {2,9},Ran(R)={1,3,7}

2. Let A=R, The set of real numbers


R={(x,y), iff x and y satisfies the equation }
R consists of all points (x,y) that lie on the ellipse shown in the figure on
RHS

7
Representing a Relation

Relations are represented using


• Matrices
• Digraphs

8
Relation as a Matrix:
Let P = [a1,a2,a3,.......am] and Q = [b1,b2,b3......bn] be
finite sets, containing m and n number of elements
respectively. R is a relation from P to Q. The relation
R can be represented by m x n matrix M = [Mij],
defined as
Mij = 0 if (ai,bj) ∉ R , Mij =1 if (ai,bj )∈ R

Example: Let P = {1, 2, 3, 4}, Q = {a, b, c, d}


and R = {(1, a), (1, b), (1, c), (2, b), (2, c), (2, d)}.
• The matrix of relation R is shown in the figure on
RHS.

9
Relation as a Directed Graph

There is another way of representing a relation


R when R is a relation from a finite set to itself.

Example
A = {1, 2, 3, 4}
R = {(1, 2) (2, 2) (2, 4) (3, 2) (3, 4) (4, 1) (4, 3)}

10
Do It Yourself

11
In-degree and Out-degree

The in-degree and out-degree of the graph on rhs is shown below:

12
Do It Yourself
Find the in-degree and out-degree of each of the vertices of the graph given below

13
Paths in Relation and Digraph
• A path of length n in R from a to b is a finite sequence π : a, x1, x2, ....., xn−1, b,
beginning with a and ending b, such that (a,x1)∈R, (x1,x2)∈R, ......., (xn−1,b)∈R.
• A path that begins and ends at the same vertex is called a cycle.

• Note:
• A path of length n involves (n+1) elements of A.
• All the elements of the path are not necessarily distinct.

14
Connectivity Relation

15
Solved Example

16
Boolean Product of Two Matrices

Where P is the no of columns in A and no of


rows in B

17
Relation as an Arrow Diagram
If P and Q are finite sets and R is a relation from P
to Q. Relation R can be represented as an arrow
diagram as follows.
Let P = {1, 2, 3, 4}
Q = {a, b, c, d}

R = {(1, a), (2, a), (3, a), (1, b), (4, b), (4, c), (4, d)

The arrow diagram of relation R is shown in fig:

18

You might also like