Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Number System and Arithmetic
  • Algebra
  • Set Theory
  • Probability
  • Statistics
  • Geometry
  • Calculus
  • Logarithms
  • Mensuration
  • Matrices
  • Trigonometry
  • Mathematics
Open In App
Next Article:
Composition of Relations
Next article icon

Composition of Relations

Last Updated : 27 Aug, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Composition of Relations is a mathematical concept that links elements across different sets by combining multiple relations. This powerful tool is fundamental in fields like graph theory, function composition, and system modeling, enabling the exploration of complex connections and relationships within various structures.

In this article, we will understand the meaning of relations and its types, composition of relations, properties of composition of relations, its applications in mathematics and solved examples for better understanding.

Table of Content

  • Definition of Relations
    • Types of Relations
  • Composition of Relations
    • Mathematical Representation of Composition of Relations
  • Properties of Composition of Relations
  • Applications of Composition of Relations
  • Conclusion
  • FAQs

Definition of Relations

Relation is a relationship between two sets Through diagrams, we can express that one set of parts interacts with another. The relation R is a subset of A x B; ( Here, on each side the sets/of groups involved in the operation are linked by the Cartesian product).

Since relation R from A to B is a subset of A x B this implies that R ⊆ A x B; for (a, b) ∈ R we say "a related to b by the given under consideration" and in symbolic manner write it as (aRb).

For example, we can represent our sets like this: A = {1, 2, 3} and B = {4, 5}. The relation R is returned from A to B, i.e.

R = {(1, 4), (2, 4), (3, 4), (1, 5), (2, 5), (3, 5)}

Now, it can be seen from the relation (R) in this example that set (A) is related to every element of Set (B) by the Relation.

Types of Relations

The primary types of relations are given below:

  • Reflexive Relation: When all elements of set (A) are related to themselves through a relation (R), it is a reflexive relation. For any a ∈ A, (a, a) ∈ R. For instance, consider the set (A): {1, 2, 3}. A reflexive relation (R) is defined as {(1, 1), (2, 2), (3, 3)}, where each element of set (A) is related to itself.
  • Symmetric Relation: A relation (R) is symmetric for a set (A) if (a R b) implies (b R a). From a mathematical perspective, (a, b) ∈ R implies (b, a) ∈ R for any a, b ∈ A. For instance, with a set (A) of {1, 2}, A relation (R) defined as {(1, 2), (2, 1)} is symmetric if it meets the above criterion.
  • Transitive Relation: A relation (R) on a set (A) is transitive if aRb and bRc entail aRc. Mathematically, if a, b, c ∈ A, then (a, b) ∈ R and (b, c) ∈ R ⇒ (a, c) ∈ R. Using A = {1, 2, 3}, the relation R = {(1, 2), (2, 3), (1, 3)} is transitive.
  • Antisymmetric Relation: For a relation R on a set A to be antisymmetric, aRb and bRa must entail a = b. Mathematically, a = b for every a, b ∈ A, (a, b) ∈ R, and (b, a) ∈ R. For instance, the relation R = {(1, 1), (2, 2)} is antisymmetric with A = {1, 2}.

Composition of Relations

A composition of relations is a method whereby two sets are combined to produce a new one by use of a combination of every feasible pair of elements from the two sets, so indirectly.

For example, let us consider that we have three sets: A, B, and C. Let R be a relation from A to B and let S be a relation from B to C. The composition S ⚬ R is a relation from A to C that contains all pairs (a, c) such as there is an element b ∈ B such that (a, b) ∈ R and (b, c) ∈ S.

Suppose, we have three sets namely, A={1, 2}, B={3, 4}, and C={5, 6}, with R = {(1, 3), (2, 4)}, and S = {(3, 5), (4, 6)}. Then the composition S ⚬ R would be {(1, 5), (2, 6)}, because 1 is linked to 5 through 3 and 2 is linked to 6 through 4.

Mathematical Representation of Composition of Relations

The mathematical operation of composition of relations S ⚬ R is defined as:

S ⚬ R = (a, c) | ∃b ∈ B such that (a, b) ∈ R and (b, c) ∈ S

Interpreting the definition above:

  • (a, b) ∈ R denotes a in A and b in B relate based on the relation R.
  • (b, c) ∈ S denotes b in B and c in C relate based on the relation S
  • (a, c) ∈ S ⚬ R reveals an indirect relationship between a in A and c in C based on b in B.

Composition of this form allows us to connect elements in multiple sets in a natural way, which underpins several mathematical and practical applications.

Properties of Composition of Relations

The properties of composition of relations are as follows:

  • Identity Relation: For any set A, the identity relation IA on A is defined as IA = {(a, a) | a ∈ A}. The identity relation acts as a neutral element in the composition: R ⚬ IA = R and IB ⚬ R = R, where R ⊆ A x B.
  • Associativity: Composition of relations is associative. If R ⊆ A x B, S ⊆ B x C and T ⊆ C x D then T ⚬ (S ⚬ R) = (T ⚬ S) ⚬ R.
  • Inverse Relation: If R ⊆ A x B, the inverse relation R-1 ⊆ B x A is defined as (b, a) ∈ R-1 ⇔ (a, b) ∈ R. The composition of a relation and its inverse has properties similar to functions: R ⚬ R-1 ⊆ IB and R-1 ⚬ R ⊆ IA.
  • Distributivity over Union: Composition of relations distributes over the union: R ⚬ (S ⋃ T) = (R ⚬ S) ⋃ (R ⚬ T) and (R ⋃ S) ⚬ T = (R ⚬ T) ⋃ (S ⚬ T).
  • Monotonicity: If R1 ⊆ R2 and S1 ⊆ S2 , then: S1 ⚬ R1 ⊆ S2 ⚬ R2.

Applications of Composition of Relations

Some of the common applications of composition of relations are:

  • Databases: Instead of discussing table relationships or repeating statements, join is done. When one table links two sets of entities and the other relates one to the third, a join operation (similar to composition) joins the two tables and their relationship.
  • Computer Science (State Machines):State machines explicitly mathematically describe transition relations as a set of relations. If a system goes from A to B and then from B to C, these stages illustrate a clear transition.
  • Graph Theory: Relations represent graph theory pathways. The composition of graph theory relations concatenates paths. The composition gives a road from A to C if there are paths from A to B and B to C.
  • Formal Logic: Predicate logic usually combines relations. The more complicated predicate is the key benefit when examining dictionary relationships.

Conclusion

The composition of relations allows for pairing elements across different sets, revealing indirect connections. This concept is crucial in areas like function composition, graph theory, and system modeling. Key properties such as associativity, identity, and inverses help manage complex structures, aiding in both theoretical and practical problem-solving.

Read More,

  • Composition of Function
  • Composition of Functions
  • Derivative of Composite Functions

Solved Examples on Composition of Relations

Example 1: Given the two relations as below:

  • Relation (R) as {(1, 20), (24, 38)}
  • Relation (S) as {(8, 9), (7, 6)}

Find the composition of this relations i.e. S ⚬ R.

Solution:

Now, let us consider that (a, b) ∈ R, and we need to find the corresponding b in S as (b, c) in order to form the composition of relations.

And finally after combining the pairs we can get S ⚬ R where (a, c) ∈ (S ⚬ R).

But, from the relation R we can find that R doesn't have any b values that matches with the first element of the pair in S. So, we can say that S ⚬ R = ∅.

Example 2: Given the two relations as below:

  • Relation (R) as {(1, 20), (25, 35)}
  • Relation (S) as {(20, 40), (35, 56)}

Find the composition of this relations i.e. S ⚬ R.

Solution:

Now, let us consider that (a, b) ∈ R, and we need to find the corresponding b in S as (b, c) in order to form the composition of relations.

And finally after combining the pairs we can get S ⚬ R where (a, c) ∈ (S ⚬ R) where. Now, from the given relations:

1. Now if we combine (1, 20) from R and (20, 40) from S it is going to result of (1,40).
2. We can merge (25, 35) from R and (35, 56) from S to get (25,56).

Therefore, we obtain S ⚬ R ={(1,40), (25, 56)}.

Example 3: Given the two matrices R and S

  • R = \begin{bmatrix} 0 && 1 && 0 \\ 1 && 0 && 0 \\ 0 && 1 && 1\end{bmatrix}
  • S = \begin{bmatrix} 1 && 0 && 1 \\ 0 && 1 && 0 \\ 1 && 0 && 1\end{bmatrix}

Find the matrix representing R ⚬ S.

Solution:

Now we multiply S by R to find the resulting matrix of the expression R ⚬ S.

R \circ S = \begin{bmatrix}1 && 0 && 1 \\ 0 && 1 && 0 \\ 1 && 0 && 1\end{bmatrix} \times \begin{bmatrix}0 && 1 && 0 \\ 1 && 0 && 0 \\ 0 && 1 && 1\end{bmatrix}

Now, index from 1 for both rows and column

1. For (1,1) entry: (1 x 0) + (0 x 1) + (1 x 0) = 0
2. For (1,2) entry: (1 x 1) + (0 x 0) + (1 x 1) = 2
3. For (1,3) entry: (1 x 0) + (0 x 0) + (1 x 1) = 1
4. For (2,1) entry: (0 x 0) + (1 x 1) + (0 x 0) = 1
5. For (2,2) entry: (0 x 1) + (1 x 0) + (0 x 1) = 0
6. For (2,3) entry: (0 x 0) + (1 x 0) + (0 x 1) = 0
7. For (3,1) entry: (1 x 0) + (0 x 1) + (1 x 0) = 0
8. For (3,2) entry: (1 x 1) + (0 x 0) + (1 x 1) = 2
9. For (3,3) entry: (1 x 0) + (0 x 0) + (1 x 1) = 1

Therefore the resulting matrix is the same as under:

R \circ S = \begin{bmatrix}0 && 2 && 1 \\ 1 && 0 && 0 \\ 0 && 2 && 1\end{bmatrix}

Example 4: Given the two relations as below:

  • Relation (R) as {(a, a), (b, b)}
  • Relation (S) as {(a, a), (b, b)}

Find the composition of this relations i.e. S ⚬ R.

Solution:

Now, let us consider that (x, y) ∈ R, and we need to find the corresponding y in S as (y, z) in order to form the composition of relations.

And finally after combining the pairs we can get S ⚬ R where (x, z) ∈ (S ⚬ R). Now, from the given relations:

1. Pairing (a, a) from R with (a, a) from S to get (a, a).
2. Pairing (b, b) from R with (b, b) from S to get (b, b).

So, from this we get, S ⚬ R is given as: {(a, a), (b, b)}.

Note: The relation resulted here reflects the reflexive property.

Example 5: Given the two functions as described below:

  • f(x) is given as: 2x + 1
  • g(x) is given as: 3x - 2

Find f(g(x)) and g(f(x)).

Solution: Now, in order to find f(g(x)) initially we need to substitute g(x) into f(x) and the final expression is given as follows:

f(g(x)) = 2*( 3x - 2) + 1 = 6x - 4 + 1 = 6x - 3

Now, in order to find g(f(x)) initially we need to substitute f(x) into g(x) and the final expression is given as follows:

g(f(x)) = 3*( 2x + 1) - 2 = 6x + 3 - 2 = 6x + 1

Note: The relation resulted here represents the composition in a function.

Example 6: Given the two relations as below:

  • Relation (R) is given as: {(1, 2), (2, 3)}
  • Relation (S = R-1 ) is given as: {(2, 1), (3, 2)}

Find the composition of this relations i.e. S ⚬ R.

Solution:

Now, let us consider that (a, b) ∈ R, and we need to find the corresponding b in S as (b, c) in order to form the composition of relations.

And finally after combining the pairs we can get S ⚬ R where (a, c) ∈ (S ⚬ R). Now, from the given relations:

1. Now if we combine (1, 2) from R and (2, 1) from S it is going to result of (1,1).
2. We can merge (2, 3) from R and (3, 2) from S to get (2,2).

Therefore, we obtain S ⚬ R ={(1, 1), (2, 2)}.

Note: As we can observe that S represents the inverse of R, so this type of relations are known as composition of inverse relations.

Example 7: Given the two relations as below:

  • Relation (R) is given as: { (1, 2), (2, 3) }
  • Relation (S) is given as: { (2, 1), (3, 2) }

Find S ⚬ R and R ⚬ S.

Solution:

Now, let us consider that (a, b) ∈ R, and we need to find the corresponding b in S as (b, c) in order to form the composition of relations.

And finally after combining the pairs we can get S ⚬ R where (a, c) ∈ (S ⚬ R). Now, from the given relations:

1. Now if we combine (1, 2) from R and (2, 1) from S it is going to result of (1,1).
2. We can merge (2, 3) from R and (3, 2) from S to get (2,2).

Therefore, we obtain S ⚬ R ={(1, 1), (2, 2)}.

Now, let us consider that (a, b) ∈ S, and we need to find the corresponding b in R as (b, c) in order to form the composition of relations.

And finally after combining the pairs we can get R ⚬ S where (a, c) ∈ (R ⚬ S). Now, from the given relations:

1. Now if we combine (2, 1) from R and (1, 2) from S it is going to result of (2,2).
2. We can merge (3, 2) from R and (2, 3) from S to get (3,3).

Therefore, we obtain R ⚬ S ={(2, 2), (3, 3)}.


Next Article
Composition of Relations

M

mathivananshivam
Improve
Article Tags :
  • Mathematics
  • School Learning
  • Relations and Functions
  • Maths

Similar Reads

    Composition of Functions
    The composition of functions is a process where you combine two functions into a new function. Specifically, it involves applying one function to the result of another function. In simpler terms, the output of one function becomes the input for the other function.Mathematically, the composition of t
    11 min read
    Composite functions - Relations and functions
    Let f : A->B and g : B->C be two functions. Then the composition of f and g, denoted by g o f, is defined as the function g o f : A->C given by g o f (x) = g{f(x)}, ∀ x ∈ A. Clearly, dom(g o f) = dom(f). Also, g o f is defined only when range(f) is a subset of dom(g). Evaluating composite f
    5 min read
    Degree of Relations in DBMS
    We are living in a world where every entity has relationships with one other whether a living or non-living being. For example, you are a single entity but you share different relations with your family and friends. Even within a family, you are the son of your father at the same time you are also a
    4 min read
    Domain and Range of Relations
    The domain is the set of all possible input values (the "x" values), and the range is the set of all possible output values (the "y" values) in a relation.For any two non-empty sets A and B, we define the relation R as the subset of the Cartesian product of A × B where each member of set A is relate
    8 min read
    Real Life Examples of Relations
    Relations in mathematics becomes easier when we look at real-life examples. A relation, in simple terms, is a set of ordered pairs that show how elements from one set are connected to elements of another set. These connections are all around us in everyday situations.For instance, think about the re
    4 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences