Prerequisite : Introduction to Relations, Representation of Relations

**Combining Relations :**

As we know that relations are just sets of ordered pairs, so all set operations apply to them as well. Two relations can be combined in several ways such as –

**Union –**consists of all ordered pairs from both relations. Duplicate ordered pairs removed from Union.**Intersection –**consists of ordered pairs which are in both relations.**Difference –**consists of all ordered pairs only in , but not in .**Symmetric Difference –**consists of all ordered pairs which are either in or but not both.

There is another way two relations can be combined that is analogous to the composition of functions.

**Composition –** Let be a relation from to and be a relation from to , then the composite of and , denoted by , is the relation consisting of ordered pairs where and for which there exists an element such that and .

**Example –**What is the composite of the relations and where is a relation from to with and is a relation from to with ?**Solution –**By computing all ordered pairs where the first element belongs to and the second element belongs to , we get –

**Composition of Relation on itself :**

A relation can be composed with itself to obtain a degree of separation between the elements of the set on which is defined.

Let be a relation on the set . The powers where are defined recursively by - and .

**Theorem –** Let be a relation on set A, represented by a di-graph. There is a path of length , where is a positive integer, from to if and only if .

**Important Note :** A relation on set is transitive if and only if for

**Closure of Relations :**

Consider a relation on set . may or may not have a property , such as reflexivity, symmetry, or transitivity.

If there is a relation with property containing such that is the subset

of every relation with property containing , then is called the closure of

with respect to .

We can obtain closures of relations with respect to property in the following ways –

**Reflexive Closure –**is the diagonal relation on set . The reflexive closure of relation on set is .**Symmetric Closure –**Let be a relation on set , and let be the inverse of . The symmetric closure of relation on set is .**Transitive Closure –**Let be a relation on set . The**connectivity relation**is defined as – . The transitive closure of is .

**Example –** Let be a relation on set with . Find the reflexive, symmetric, and transitive closure of R.

**Solution –**

For the given set, . So the reflexive closure of is

For the symmetric closure we need the inverse of , which is

.

The symmetric closure of is-

For the transitive closure, we need to find .

we need to find until . We stop when this condition is achieved since finding higher powers of would be the same.

Since, we stop the process.

Transitive closure, –

**Equivalence Relations :**

Let be a relation on set . If is reflexive, symmetric, and transitive then it is said to be a equivalence relation.

Consequently, two elements and related by an equivalence relation are said to be equivalent.

**Example –** Show that the relation

is an equivalence relation. is the congruence modulo function. It is true if and only if divides .

**Solution –** To show that the relation is an equivalence relation we must prove that the relation is reflexive, symmetric and transitive.

**Reflexive –**For any element , is divisible by .

. So, congruence modulo is reflexive.**Symmetric –**For any two elements and , if or i.e. is divisible by , then is also divisible by .

. So Congruence Modulo is symmetric.**Transitive –**For any three elements , , and if then-

Adding both equations,. So, is transitive.

Since the relation is reflexive, symmetric, and transitive, we conclude that is an equivalence relation.

**Equivalence Classes :**Let be an equivalence relation on set .

We know that if then and are said to be equivalent with respect to .The set of all elements that are related to an element of is called the

**equivalence class**of . It is denoted by or simply if there is only one

relation to consider.

Formally,Any element is said to be the

**representative**of .**Important Note :**All the equivalence classes of a Relation on set are either equal or**disjoint**and their union gives the set .

The equivalence classes are also called**partitions**since they are disjoint and their union gives the set on which the relation is defined**Example :**What are the equivalence classes of the relation Congruence Modulo ?**Solution :**Let and be two numbers such that . This means that the remainder obtained by dividing and with is the same.

Possible values for the remainder-

Therefore, there are equivalence classes –

**GATE CS Corner Questions**Practicing the following questions will help you test your knowledge. All questions have been asked in GATE in previous years or in GATE Mock Tests. It is highly recommended that you practice them.

1. GATE CS 2013, Question 1

2. GATE CS 2005, Question 42

3. GATE CS 2001, Question 2

4. GATE CS 2000, Question 28**References –**

Composition of Relations – Wikipedia

Discrete Mathematics and its Applications, by Kenneth H RosenThis article is contributed by

**Chirag Manwani**. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.