Skip to main content

Operations on Relations

Operations on Relations​

A relation is a subset of the Cartesian product of two sets.

Suppose

R,S⊆A×AR, S \subseteq A \times A

Since relations are simply sets of ordered pairs, we can perform all standard set operations on them, such as union, intersection, difference, and complement. We can also define two special operations unique to relations: composition and inverse.

These operations are frequently tested in GATE CSE, especially in questions involving relation properties and graph-based representations.

1. Union of Relations​

Definition​

The union of two relations contains every ordered pair that belongs to either relation.

Mathematically,

R∪S={(a,b)∣(a,b)∈R or (a,b)∈S}R \cup S = \{(a,b)\mid (a,b)\in R \text{ or } (a,b)\in S\}

The word or means:

  • Present in R
  • Present in S
  • Present in both

Example​

Let

R={(1,2),(2,3),(3,1)}R=\{(1,2),(2,3),(3,1)\}

and

S={(2,3),(3,2),(1,1)}S=\{(2,3),(3,2),(1,1)\}

Then

R∪S={(1,1),(1,2),(2,3),(3,1),(3,2)}R\cup S= \{ (1,1), (1,2), (2,3), (3,1), (3,2) \}

Notice that

(2,3)(2,3)

appears only once because sets never contain duplicate elements.

Venn Diagram Interpretation​

R S

●●●●●●●●
● R∩S ●
●●●●●●●●

Union = Everything inside both circles.

Important Properties​

  • Commutative
R∪S=S∪RR\cup S=S\cup R
  • Associative
(R∪S)∪T=R∪(S∪T)(R\cup S)\cup T=R\cup(S\cup T)
  • Identity
R∪∅=RR\cup\varnothing=R

2. Intersection of Relations​

Definition​

The intersection contains only the ordered pairs that appear in both relations.

Mathematically,

R∩S={(a,b)∣(a,b)∈R and (a,b)∈S}R\cap S= \{ (a,b)\mid (a,b)\in R \text{ and } (a,b)\in S \}

Example​

Let

R={(1,2),(2,3),(3,1)}R=\{(1,2),(2,3),(3,1)\}

and

S={(2,3),(3,2),(1,1)}S=\{(2,3),(3,2),(1,1)\}

Then

R∩S={(2,3)}R\cap S= \{ (2,3) \}

Only one ordered pair belongs to both relations.

Venn Diagram Interpretation​

R S

●●●●●●●●
● X ●
●●●●●●●●

Intersection = Common region.

Properties​

  • Commutative
R∩S=S∩RR\cap S=S\cap R
  • Associative
(R∩S)∩T=R∩(S∩T)(R\cap S)\cap T= R\cap(S\cap T)
  • Identity
R∩∅=∅R\cap\varnothing= \varnothing

3. Difference of Relations​

Definition​

The difference of two relations consists of ordered pairs that belong to the first relation but not to the second.

Mathematically,

R−S={(a,b)∣(a,b)∈R and (a,b)∉S}R-S= \{ (a,b)\mid (a,b)\in R \text{ and } (a,b)\notin S \}

Example​

Let

R={(1,2),(2,3),(3,1)}R= \{ (1,2), (2,3), (3,1) \}

and

S={(2,3),(3,2)}S= \{ (2,3), (3,2) \}

Then

R−S={(1,2),(3,1)}R-S= \{ (1,2), (3,1) \}

The pair

(2,3)(2,3)

is removed because it appears in both relations.

Important Note​

Difference is not commutative.

Generally,

R−S≠S−RR-S \neq S-R

4. Complement of a Relation​

Definition​

The complement of a relation contains every ordered pair that does not belong to the relation.

Suppose

R⊆A×AR\subseteq A\times A

Then

Rc=(A×A)−RR^c= (A\times A)-R

Example​

Let

A={1,2}A=\{1,2\}

Then

A×A={(1,1),(1,2),(2,1),(2,2)}A\times A= \{ (1,1), (1,2), (2,1), (2,2) \}

Suppose

R={(1,1),(2,2)}R= \{ (1,1), (2,2) \}

Then

Rc={(1,2),(2,1)}R^c= \{ (1,2), (2,1) \}

Important Observation​

The complement depends on the universal relation (Cartesian product).

Without knowing

A×AA\times A

the complement cannot be determined.

Property​

Applying complement twice gives the original relation.

(Rc)c=R(R^c)^c=R

5. Composition of Relations​

Definition​

Composition combines two relations into a new relation.

Suppose

R⊆A×BR\subseteq A\times B

and

S⊆B×CS\subseteq B\times C

Their composition is written as

S∘RS\circ R

and is defined by

S∘R={(a,c)∣∃b:(a,b)∈R and (b,c)∈S}S\circ R= \{ (a,c) \mid \exists b : (a,b)\in R \text{ and } (b,c)\in S \}

The order is important:

  • First apply R
  • Then apply S

Intuition​

Think of composition as following a path.

A ----R----> B ----S----> C

If you can travel from

AA

to

CC

through

BB

then include

(A,C)(A,C)

in the composition.

Example​

Let

R={(1,2),(2,3)}R= \{ (1,2), (2,3) \}

and

S={(2,4),(3,5)}S= \{ (2,4), (3,5) \}

Using

(1,2)∈R(1,2)\in R

and

(2,4)∈S(2,4)\in S

we obtain

(1,4)(1,4)

Using

(2,3)∈R(2,3)\in R

and

(3,5)∈S(3,5)\in S

we obtain

(2,5)(2,5)

Therefore,

S∘R={(1,4),(2,5)}S\circ R= \{ (1,4), (2,5) \}

Graph Interpretation​

1 → 2 → 4

becomes

1 → 4

Similarly,

2 → 3 → 5

becomes

2 → 5

Important Notes​

Composition is generally

  • Not commutative
S∘R≠R∘SS\circ R \neq R\circ S

Composition is

  • Associative
(T∘S)∘R=T∘(S∘R)(T\circ S)\circ R = T\circ(S\circ R)

6. Inverse of a Relation​

Definition​

The inverse of a relation is obtained by reversing every ordered pair.

If

R={(a,b)}R= \{ (a,b) \}

then

R−1={(b,a)}R^{-1}= \{ (b,a) \}

More formally,

R−1={(b,a)∣(a,b)∈R}R^{-1} = \{ (b,a) \mid (a,b)\in R \}

Example​

Suppose

R={(1,2),(2,3),(3,1)}R= \{ (1,2), (2,3), (3,1) \}

Then

R−1={(2,1),(3,2),(1,3)}R^{-1} = \{ (2,1), (3,2), (1,3) \}

Every ordered pair has simply been reversed.

Graph Interpretation​

Original graph

1 → 2
2 → 3
3 → 1

Inverse graph

1 ← 2
2 ← 3
3 ← 1

Every arrow changes direction.

Important Properties​

Inverse of inverse

(R−1)−1=R(R^{-1})^{-1}=R

Inverse distributes over union

(R∪S)−1=R−1∪S−1(R\cup S)^{-1} = R^{-1}\cup S^{-1}

Inverse distributes over intersection

(R∩S)−1=R−1∩S−1(R\cap S)^{-1} = R^{-1}\cap S^{-1}

Inverse of composition

(S∘R)−1=R−1∘S−1(S\circ R)^{-1} = R^{-1}\circ S^{-1}

Notice that the order is reversed.

Summary Table​

OperationDefinition
UnionOrdered pairs present in either relation
IntersectionOrdered pairs common to both relations
DifferenceOrdered pairs present in the first relation but not the second
ComplementOrdered pairs not present in the relation
CompositionConnect two relations through an intermediate element
InverseReverse every ordered pair

Common GATE Questions​

  • Compute R∪SR \cup S
  • Compute R∩SR \cap S
  • Find R−SR-S
  • Find the complement of a relation
  • Compute S∘RS \circ R
  • Find the inverse of a relation
  • Determine whether composition is commutative
  • Use matrix multiplication to compute composition
  • Verify identities involving inverse and composition

Memory Tricks​

OperationEasy Way to Remember
UnionEverything from both relations
IntersectionOnly common ordered pairs
DifferenceRemove common pairs from the first relation
ComplementEverything outside the relation
CompositionFollow arrows through an intermediate vertex
InverseReverse every arrow