The Wayback Machine - https://web.archive.org/web/20240915174305/https://www.geeksforgeeks.org/closure-relations/
Open In App

Closure of Relations

Last Updated : 20 Aug, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Closure of Relations: In mathematics, especially in the context of set theory and algebra, the closure of relations is a crucial concept. It involves extending a given relation to include additional elements based on specific properties, such as reflexivity, symmetry, and transitivity. Understanding the closure of relations is essential in fields like computer science, database theory, and formal logic, where relational structures are frequently analyzed and manipulated.

Relations

A relation R on a set A is a subset of the Cartesian product A×A. It consists of ordered pairs of elements from A. The closure of a relation refers to the smallest relation that contains R and satisfies certain properties.

Types of Closure

1. Reflexive Closure

The reflexive closure of a relation R on a set A is the smallest relation R′ that contains R and is reflexive. This means that every element in A is related to itself.

Formula: R′ = R ∪ {(a,a) ∣ a ∈ A}

Example: Let A = {1,2} and R={(1,2)}. The reflexive closure of R is: R′ = {(1,2),(1,1),(2,2)}.

2. Symmetric Closure

The symmetric closure of a relation R on a set A is the smallest relation R′ that contains R and is symmetric. This means that if (a,b) ∈ R′, then (b,a) ∈ R′

Formula: R′ = R ∪ {(b,a) ∣ (a,b) ∈ R}

Example: Let A = {1,2} and R = {(1,2)}. The symmetric closure of R is: R′ = {(1,2),(2,1)}.

3. Transitive Closure

The transitive closure of a relation R on a set A is the smallest relation R′ that contains R and is transitive. This means that if (a,b) ∈ R and (b,c) ∈ R′, then (a,c) ∈ R′

Algorithm (Warshall’s Algorithm)

  1. Initialize R′ = R.
  2. For each (a,b) ∈ R′ and (b,c) ∈ R, add (a,c) to R′.

Example:

Let A = {1,2,3} and R = {(1,2),(2,3)}. The transitive closure of R is:

R′ = {(1,2),(2,3),(1,3)}.

Applications in Engineering

1. Database Theory

In database theory, the closure of relations is used in query optimization and integrity constraints.

Example: Ensuring that a database relation maintains transitive dependencies helps in normalizing the database and reducing redundancy.

2. Computer Networks

Closure of relations helps in network routing algorithms to ensure that connections are efficiently managed.

Example: Using the transitive closure to find the shortest path in a network by considering all possible routes.

3. Formal Verification

In formal methods, closure properties are used to verify the correctness of systems and protocols.

Example: Verifying that a system maintains certain properties under all possible transitions can be achieved by computing the transitive closure of the state transition relation.

4. Compiler Design

Closure properties are used in data flow analysis to optimize and validate code.

Example: Using the transitive closure in reaching definitions analysis to determine all definitions that can reach a particular point in the code.

5. Social Network Analysis

In social network analysis, closure properties help understand the reachability and influence within a network.

Example: Computing the transitive closure to find all indirect connections between individuals in a social network.

Solved Examples on Closure of Relations

Example 1: Find Reflexive Closure

Given: R = {(1,2), (2,3), (3,4)} on set A = {1, 2, 3, 4}

To find the reflexive closure, we need to add all pairs (a,a) that are missing from R for all a ∈ A.

Reflexive closure of R = R ∪ {(1,1), (2,2), (3,3), (4,4)}

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

Example 2: Find Symmetric Closure

Given: R = {(1,2), (2,3), (1,3)} on set A = {1, 2, 3}

To find the symmetric closure, we need to add (b,a) for every (a,b) in R.

Symmetric closure of R = R ∪ {(2,1), (3,2), (3,1)}

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

Example 3: Find Transitive Closure

Given: R = {(1,2), (2,3), (3,4)} on set A = {1, 2, 3, 4}

To find the transitive closure, we need to add all pairs (a,c) where (a,b) and (b,c) are in R.

Step 1: R⁰ = R = {(1,2), (2,3), (3,4)}

Step 2: R¹ = R⁰ ∪ {(1,3)} (because (1,2) and (2,3) are in R⁰)

Step 3: R² = R¹ ∪ {(1,4), (2,4)} (because (1,3) and (3,4), and (2,3) and (3,4) are in R¹)

Step 4: R³ = R² (no new pairs added)

Therefore, the transitive closure of R is:

{(1,2), (2,3), (3,4), (1,3), (1,4), (2,4)}

Example 4: Find All Closures Combined

Given: R = {(1,2), (2,1)} on set A = {1, 2, 3}

Reflexive Closure:

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

Symmetric Closure:

R is already symmetric

Transitive Closure:

R is already transitive

Reflexive, Symmetric, and Transitive Closure:

{(1,1), (1,2), (2,1), (2,2), (3,3)}

Example 5 : Let R be a relation on set A = {1, 2, 3} defined as R = {(1,2), (2,3)}.Find the reflexive closure:

To find the reflexive closure:

Add all pairs (a,a) for each element a in A that are not already in R.

Reflexive closure = R ∪ {(1,1), (2,2), (3,3)}

Final result: {(1,2), (2,3), (1,1), (2,2), (3,3)}

Example 6 : Let R be a relation on set A = {a, b, c} defined as R = {(a,b), (b,c), (c,a)}.Find the reflexive closure:

To find the symmetric closure:

For each pair (x,y) in R, add (y,x) if it’s not already present.

Symmetric closure = R ∪ {(b,a), (c,b), (a,c)}

Final result: {(a,b), (b,c), (c,a), (b,a), (c,b), (a,c)}

Example 7 : Let R be a relation on set A = {1, 2, 3, 4} defined as R = {(1,2), (2,3), (3,4)}.Find the reflexive closure:

To find the transitive closure:

Add all pairs (x,z) where (x,y) and (y,z) are in R for some y.

In this case, we need to add (1,3), (2,4), and (1,4).

Transitive closure = R ∪ {(1,3), (2,4), (1,4)}

Final result: {(1,2), (2,3), (3,4), (1,3), (2,4), (1,4)}

Example 8 : Let R be a relation on set A = {x, y, z} defined as R = {(x,y), (y,z), (z,x)}.Find the reflexive closure:

To find the reflexive closure:

Add all pairs (a,a) for each element a in A that are not already in R.

Reflexive closure = R ∪ {(x,x), (y,y), (z,z)}

Final result: {(x,y), (y,z), (z,x), (x,x), (y,y), (z,z)}

Example 9 : Find Symmetric Closure:

Let R be a relation on set A = {1, 2, 3, 4} defined as R = {(1,2), (2,3), (3,4), (4,1)}.

To find the symmetric closure:

For each pair (a,b) in R, add (b,a) if it’s not already present.

Symmetric closure = R ∪ {(2,1), (3,2), (4,3), (1,4)}

Final result: {(1,2), (2,3), (3,4), (4,1), (2,1), (3,2), (4,3), (1,4)}

Transitive Closure:

Example 10 : Let R be a relation on set A = {a, b, c, d} defined as R = {(a,b), (b,c), (c,d), (d,a)}.

To find the transitive closure:

Add all pairs (x,z) where (x,y) and (y,z) are in R for some y.

We need to add: (a,c), (b,d), (c,a), (d,b)

Then we need to add: (a,d), (b,a), (c,b), (d,c)

Finally, we add: (a,a), (b,b), (c,c), (d,d)

Transitive closure = R ∪ {(a,c), (b,d), (c,a), (d,b), (a,d), (b,a), (c,b), (d,c), (a,a), (b,b), (c,c), (d,d)}

Final result: {(a,b), (b,c), (c,d), (d,a), (a,c), (b,d), (c,a), (d,b), (a,d), (b,a), (c,b), (d,c), (a,a), (b,b), (c,c), (d,d)}

Practice Problems on Closure of Relations

1).Find the reflexive closure of R = {(1,2), (2,3), (3,1)} on set A = {1, 2, 3}.

2).Determine the symmetric closure of R = {(a,b), (b,c), (c,d)} on set A = {a, b, c, d}.

3).Calculate the transitive closure of R = {(1,2), (2,3), (3,4)} on set A = {1, 2, 3, 4}.

4).Find the reflexive and symmetric closure of R = {(x,y), (y,z)} on set A = {x, y, z}.

5).Determine the transitive closure of R = {(a,b), (b,c), (c,a), (a,d)} on set A = {a, b, c, d}.

6).Calculate the reflexive, symmetric, and transitive closure of R = {(1,2), (2,3)} on set A = {1, 2, 3}.

7).Find the symmetric closure of R = {(1,1), (1,2), (2,3), (3,1)} on set A = {1, 2, 3}.

8).Determine the reflexive closure of R = {(a,b), (b,a), (b,c), (c,c)} on set A = {a, b, c}.

9).Calculate the transitive closure of R = {(1,2), (2,1), (2,3), (3,4)} on set A = {1, 2, 3, 4}.

10).Find the reflexive and transitive closure of R = {(x,y), (y,z), (z,x)} on set A = {x, y, z}.

Conclusion

The closure of relations is a powerful tool in mathematics and computer science, providing a means to extend relations to satisfy important properties like reflexivity, symmetry, and transitivity. These concepts have wide-ranging applications in database theory, network routing, formal verification, compiler design, and social network analysis. Understanding and applying the closure of relations allows for more efficient and accurate modeling and analysis of complex systems.

FAQs on Closure of Relations

What is the reflexive closure of a relation?

The reflexive closure of a relation R is the smallest relation that contains R and includes all pairs (a,a) for each element a in the set.

How is the symmetric closure of a relation computed?

The symmetric closure of a relation R is computed by adding all pairs (b,a) for each pair (a,b) in R.

What is the purpose of the transitive closure?

The transitive closure of a relation ensures that if (a,b) and (b,c) are in the relation, then (a,c) is also included, making the relation transitive.

How is the transitive closure used in database theory?

In database theory, the transitive closure is used to maintain and enforce transitive dependencies, aiding in database normalization and query optimization.

What algorithm is commonly used to compute the transitive closure?

Warshall’s Algorithm is commonly used to compute the transitive closure of a relation by iteratively adding pairs to ensure transitivity.



Previous Article
Next Article

Similar Reads

Attribute Closure Algorithm and its Utilization
Closure of a set F of FDs is the set F+ of all FDs that can be inferred from F. It is also known as complete set of Functional Dependency. It is denoted by F+. Algorithm : Attribute Closure set Algorithm to compute a+, the closure of a under F Result:= a; while (changes to Result) do for each B → Y in F do Begin if B ⊆ Result then Result := Result
4 min read
Easiest way to find the closure set of attribute
Set of all those attributes which can be functionally determined from an attribute set is called closure of the attribute set and the closure of the attribute set {X} is denoted as {X}+. We can only find candidate key and primary keys only with help of closure set of an attribute. So let see the easiest way to calculate the closure set of attribute
2 min read
Closure properties Table in TOC
The Below Table shows the Closure Properties of Formal Languages : REG = Regular LanguageDCFL = deterministic context-free languages, CFL = context-free languages,CSL = context-sensitive languages,RC = Recursive.RE = Recursive Enumerable Consider L and M are regular languages : The Kleene star - ∑*, is a unary operator on a set of symbols or string
3 min read
Closure properties of Regular languages
Closure properties on regular languages are defined as certain operations on regular language that are guaranteed to produce regular language. Closure refers to some operation on a language, resulting in a new language that is of the same "type" as originally operated on i.e., regular. Regular languages are closed under the following operations: Co
4 min read
Discrete Mathematics | Types of Recurrence Relations - Set 2
Prerequisite - Solving Recurrences, Different types of recurrence relations and their solutions, Practice Set for Recurrence Relations The sequence which is defined by indicating a relation connecting its general term an with an-1, an-2, etc is called a recurrence relation for the sequence. Types of recurrence relations First order Recurrence relat
4 min read
Minimum Relations Satisfying First Normal Form (1NF)
A relation that does not contain any composite or multivalued attribute, then the relation is in its First Normal Form. Relations that contain a single-valued attribute comes under First Normal Form. In this article, we will be going to discuss the minimum relations satisfying the First Normal Form. Before proceeding to First Normal Form, let's dis
4 min read
Different types of recurrence relations and their solutions
In this article, we will see how we can solve different types of recurrence relations using different approaches. Before understanding this article, you should have idea about recurrence relations and different method to solve them (See : Worst, Average and Best Cases, Asymptotic Notations, Analysis of Loops). Type 1: Divide and Conquer Recurrence
3 min read
Finding the candidate keys for Sub relations using Functional Dependencies
We know how to find candidate keys for a relation already, you can check here Finding Attribute Closure and Candidate Keys using Functional Dependencies. But here we will learn to find out the candidate keys for a sub relation which is a little bit different from that of finding out candidate keys for a relation. Let see how to find it. What is Fun
4 min read
How to solve time complexity Recurrence Relations using Recursion Tree method?
The Recursion Tree Method is a way of solving recurrence relations. In this method, a recurrence relation is converted into recursive trees. Each node represents the cost incurred at various levels of recursion. To find the total cost, costs of all levels are summed up. Steps to solve recurrence relation using recursion tree method: Draw a recursiv
4 min read
Discrete Mathematics | Representing Relations
Prerequisite - Introduction and types of Relations Relations are represented using ordered pairs, matrix and digraphs: Ordered Pairs - In this set of ordered pairs of x and y are used to represent relation. In this corresponding values of x and y are represented using parenthesis. Example: {(1, 1), (2, 4), (3, 9), (4, 16), (5, 25)}This represent sq
2 min read
Number of possible Equivalence Relations on a finite set
An equivalence relation is Reflexive, Symmetric and Transitive. Before counting the number of possible equivalence relations on a set |A|=n, let us see an example of a equivalence relation and identify Equivalence Classes in it. Let A = {1, 2, 3, 4} be a set and R = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (3, 4), (4, 3), (4, 4)} be an equivalence
4 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 relationship between students and their grades in a
5 min read
Relations in Mathematics
Relation in mathematics is defined as the well-defined relationship between two sets. The relation connects the value of the first set with the value of the second set. We represent relation in mathematics using the ordered pair. If we are given two sets Set X and Set Y then the relation between them is represented using the ordered pair (x, y) suc
12 min read
DBMS Tutorial – Learn Database Management System
Database Management System is a software or technology used to manage data from a database. Some popular databases are MySQL, Oracle, MongoDB, etc. DBMS provides many operations e.g. creating a database, Storing in the database, updating an existing database, delete from the database. DBMS is a system that enables you to store, modify, and retrieve
8 min read
Operating System Tutorial
An Operating System(OS) is software that manages and handles the hardware and software resources of a computer system. It provides interaction between users of computers and computer hardware. An operating system is responsible for managing and controlling all the activities and sharing of computer resources. An operating system is a low-level Soft
7 min read
Computer Network Tutorial
A computer network is a collection of computers or devices connected to share resources. Any device which can share or receive the data is called a Node. Through which the information or data propagate is known as channels, It can be guided or unguided. In this Computer network tutorial, you’ll learn basic to advanced concepts like the Basics of co
10 min read
Top 100+ Computer Keyboard Shortcut Keys List (A to Z), PDF Available
Computer Shortcut Keys significantly enhance productivity and efficiency. These handy combinations of keys provide quick access to various functions and commands, allowing us to navigate in Computers. One must know Computer Shortcut keys to work more easily and quickly with computers. In this Computer Keyboard Shortcut Keys Guide, you will learn al
15+ min read
Functions of Operating System
An Operating System acts as a communication bridge (interface) between the user and computer hardware. The purpose of an operating system is to provide a platform on which a user can execute programs conveniently and efficiently. An operating system is a piece of software that manages the allocation of Computer Hardware. The coordination of the har
12 min read
Difference Between IPv4 and IPv6
The address through which any computer communicates with our computer is simply called an Internet Protocol Address or IP address. For example, if we want to load a web page or download something, we require the address to deliver that particular file or webpage. That address is called an IP Address. There are two versions of IP: IPv4 and IPv6. IPv
7 min read
Types of Operating Systems
An Operating System performs all the basic tasks like managing files, processes, and memory. Thus, the operating system acts as the manager of all the resources, i.e. resource manager. Thus, the operating system becomes an interface between the user and the machine. It is one of the most required software that is present in the device. Operating Sy
11 min read
Types of Transmission Media
Transmission media refer to the physical pathways through which data is transmitted from one device to another within a network. These pathways can be wired or wireless. The choice of medium depends on factors like distance, speed, and interference. In this article, we will discuss the transmission media. What is Transmission Media? A transmission
8 min read
TCP/IP Model
The TCP/IP model is a fundamental framework for computer networking. It stands for Transmission Control Protocol/Internet Protocol, which are the core protocols of the Internet. This model defines how data is transmitted over networks, ensuring reliable communication between devices. It consists of four layers: the Link Layer, the Internet Layer, t
13 min read
What is OSI Model? - Layers of OSI Model
OSI stands for Open Systems Interconnection , where open stands to say non-proprietary. It is a 7-layer architecture with each layer having specific functionality to perform. All these 7 layers work collaboratively to transmit the data from one person to another across the globe. The OSI reference model was developed by ISO - 'International Organiz
15+ min read
Program for Decimal to Binary Conversion
Given a decimal number as input, we need to write a program to convert the given decimal number into an equivalent binary number. Examples of Decimal to Binary:  Input : 7Output : 111Input : 10Output : 1010Input: 33Output: 100001Recommended PracticeDecimal to binaryTry It!Brute force ApproachFor Example: If the decimal number is 10. Step 1: Remaind
15+ min read
Types of Network Topology
Network topology refers to the arrangement of different elements like nodes, links, or devices in a computer network. It defines how these components are connected and interact with each other. Understanding various types of network topologies helps in designing efficient and robust networks. Common types include bus, star, ring, mesh, and tree top
12 min read
Types of Keys in Relational Model (Candidate, Super, Primary, Alternate and Foreign)
Keys are one of the basic requirements of a relational database model. It is widely used to identify the tuples(rows) uniquely in the table. We also use keys to set up relations amongst various columns and tables of a relational database. Different Types of Database Keys Candidate Key Primary Key Super Key Alternate Key Foreign Key Composite Key To
6 min read
ACID Properties in DBMS
A transaction is a single logical unit of work that accesses and possibly modifies the contents of a database. Transactions access data using read and write operations. In order to maintain consistency in a database, before and after the transaction, certain properties are followed. These are called ACID properties. For those looking to master thes
6 min read
Introduction of ER Model
Peter Chen developed the ER diagram in 1976. The ER model was created to provide a simple and understandable model for representing the structure and logic of databases. It has since evolved into variations such as the Enhanced ER Model and the Object Relationship Model The Entity Relational Model is a model for identifying entities to be represent
10 min read
Normal Forms in DBMS
Normalization is the process of minimizing redundancy from a relation or set of relations. Redundancy in relation may cause insertion, deletion, and update anomalies. So, it helps to minimize the redundancy in relations. Normal forms are used to eliminate or reduce redundancy in database tables. Normalization of DBMSIn database management systems (
12 min read
Network Devices (Hub, Repeater, Bridge, Switch, Router, Gateways and Brouter)
Network Devices: Network devices, also known as networking hardware, are physical devices that allow hardware on a computer network to communicate and interact with one another. For example Repeater, Hub, Bridge, Switch, Routers, Gateway, Brouter, and NIC, etc. 1. Repeater - A repeater operates at the physical layer. Its job is to amplifies (i.e.,
6 min read