Set Theory, Relations, and Functions
Overview
In this chapter, we shall explore the fundamental discrete structures that form the bedrock of theoretical computer science: sets, relations, and functions. These concepts are not merely abstract mathematical exercises; rather, they provide the formal language and analytical tools necessary to model computational problems, define data structures, and reason about algorithmic processes. A mastery of this material is therefore essential, as questions derived from these principles appear consistently in the GATE examination, both directly and as prerequisites for understanding more advanced topics such as graph theory, databases, and automata theory.
Our study will proceed in a logical progression, beginning with the elementary concept of a set as a collection of objects. We will then build upon this foundation to examine relations, which formally describe the connections between elements within or across sets. This leads naturally to the study of functions, a specialized and ubiquitous type of relation that maps inputs to unique outputs, a concept central to the very idea of computation. Finally, we will investigate more complex algebraic structures, namely partial orders and lattices, which provide a framework for ordering and comparing elements in a set. Throughout this chapter, the emphasis will be on rigorous definition, the analysis of properties, and the application of these structures to problems relevant to a computer science engineer.
---
Chapter Contents
| # | Topic | What You'll Learn |
|---|-------|-------------------|
| 1 | Sets | Fundamental properties and operations on collections. |
| 2 | Relations | Defining relationships between elements of sets. |
| 3 | Functions | Specialized relations with unique output mappings. |
| 4 | Partial Orders and Lattices | Structures for ordering and comparing elements. |
---
Learning Objectives
After completing this chapter, you will be able to:
- Perform operations on sets, including union, intersection, complement, and power sets, and apply principles of cardinality.
- Analyze the properties of binary relations, such as reflexivity, symmetry, and transitivity, and determine equivalence classes and partitions.
- Classify functions as injective, surjective, or bijective, and compute their composition and inverses where they exist.
- Identify a partially ordered set (poset), construct its Hasse diagram, and determine maximal, minimal, greatest, and least elements.
---
We now turn our attention to Sets...
Part 1: Sets
Introduction
The theory of sets is a fundamental branch of mathematics that serves as the bedrock for many areas within Computer Science, including discrete mathematics, database theory, automata theory, and algorithm design. A set is, in essence, the most basic way to group objects, and the study of these collections provides the language and tools necessary to reason about discrete structures. For the GATE examination, a firm grasp of set theory is indispensable for understanding more advanced topics such as relations, functions, and graph theory.
Our study will begin with the formal definition of a set and its various representations. We will then proceed to explore the relationships between sets, such as subsets and supersets, leading to the concept of the power set. The core of our discussion will focus on the operations that can be performed on setsβunion, intersection, difference, and complementβalong with the algebraic laws that govern them. Finally, we will examine the concepts of set cardinality and the Cartesian product, which are essential for combinatorial analysis.
A set is a well-defined, unordered collection of distinct objects. The objects that constitute a set are called its elements or members. Sets are typically denoted by uppercase letters (e.g., , , ), and their elements are denoted by lowercase letters (e.g., , , ).
---
Key Concepts
1. Representation of Sets
A set can be represented in two primary forms:
* Roster or Tabular Form: The elements of the set are listed explicitly, separated by commas, and enclosed in curly braces `{}`. For example, the set of vowels in the English alphabet is .
* Set-Builder or Rule Form: The elements are described by a common property. We write this as or , which reads "the set of all elements such that satisfies the property ." For example, .
2. Subsets, Power Sets, and Cardinality
Let us consider two sets, and .
If every element of set is also an element of set , then is a subset of , denoted as .
If and , then is a proper subset of , denoted as .
The cardinality of a finite set , denoted by , is the number of distinct elements in the set. The empty set, denoted by or , is a set with no elements, and its cardinality is .
A particularly important concept is the collection of all possible subsets of a given set.
The power set of a set , denoted by , is the set of all subsets of .
Variables:
- is the cardinality of set .
- is the cardinality of the power set of .
When to use: To find the total number of subsets of a given finite set.
Worked Example:
Problem: Find the power set of and determine its cardinality.
Solution:
Step 1: Identify the elements of the set .
The elements are and . The cardinality is .
Step 2: List all possible subsets of .
The subsets are:
- The empty set:
- Subsets with one element: ,
- The set itself:
Step 3: Collect all subsets into a set to form the power set .
Step 4: Calculate the cardinality of the power set using the formula.
Answer: The power set is and its cardinality is .
3. Set Operations
We can combine or modify sets using several fundamental operations. Let and be two sets within a universal set .
* Union (): The set of all elements that are in , or in , or in both.
* Intersection (): The set of all elements that are in both and .
* Difference (): The set of all elements that are in but not in .
* Complement ( or ): The set of all elements in the universal set that are not in .
4. Principle of Inclusion-Exclusion
This principle is a counting technique used to find the number of elements in the union of two or more sets.
Variables:
- , : Cardinalities of sets and .
- : Cardinality of the intersection of and .
- : Cardinality of the union of and .
When to use: To find the size of the union of two sets when their individual sizes and the size of their intersection are known.
---
Problem-Solving Strategies
For problems involving up to three sets and their cardinalities, always start by drawing a Venn diagram. Fill in the cardinality of the innermost intersection first (e.g., ), then work your way outwards. This visual method prevents double-counting and simplifies complex inclusion-exclusion problems.
---
---
Common Mistakes
- β Confusing subsets and elements: is a subset of , but is an element. An element can also be a set, e.g., in , is an element.
- β Always distinguish between membership () and subset (). is true, but is false.
- β Incorrectly calculating power set cardinality: For a set with elements, the power set has elements, NOT .
- β For , , so .
---
Practice Questions
:::question type="MCQ" question="Let . Which of the following statements is true?" options=["","","",""] answer="{2, 3} A" hint="Distinguish between an element that is a set and a subset of the main set. Analyze the top-level elements of A." solution="
Step 1: Identify the elements of set .
The set is given by . The distinct elements of are the number , the set , and the number .
Step 2: Evaluate each option.
- Option A: : This statement claims that is a proper subset of . For this to be true, every element of must be an element of . The elements of are and . However, neither nor are elements of . Thus, this statement is false.
- Option B: : This statement claims that the set is an element of . Looking at the definition of , we can see that is indeed listed as one of the three elements. Thus, this statement is true.
- Option C: : This statement claims that the set is an element of . The elements of are , , and . The set is not one of these elements. Thus, this statement is false.
- Option D: : This statement claims that the number is an element of . The elements of are , , and . The number is not an element of ; it is an element of the set which is an element of . Thus, this statement is false.
Result: The only true statement is .
Answer:
"
:::
:::question type="NAT" question="In a class of 60 students, 35 students play Cricket and 20 students play both Cricket and Tennis. All students play at least one of the two games. How many students play Tennis?" answer="45" hint="Use the Principle of Inclusion-Exclusion. You are given the total number of students (the union), the number who play Cricket, and the number who play both (the intersection)." solution="
Step 1: Define the sets.
Let be the set of students who play Cricket.
Let be the set of students who play Tennis.
The total number of students is 60, and every student plays at least one game, so .
Step 2: List the given cardinalities.
Step 3: Apply the Principle of Inclusion-Exclusion.
The formula is .
Step 4: Substitute the known values and solve for .
Result: 45 students play Tennis.
Answer:
"
:::
:::question type="MSQ" question="Let and be two non-empty sets in a universal set . Which of the following statements are always true?" options=["","","","If , then "] answer="A - B = A B',A A' = U,A A B,If A B = , then A B'" hint="Evaluate each identity using the definitions of set operations and the complement." solution="
Let's analyze each statement:
- : By definition, contains all elements that are in but not in . The set contains all elements not in . The intersection contains all elements that are in AND not in . These two definitions are identical. Thus, this statement is always true.
- : The set contains some elements of the universal set . The set contains all elements of that are not in . Their union therefore contains all elements of . This is the definition of the complement law. Thus, this statement is always true.
- : The union contains all elements of and all elements of . By definition, every element of is present in . Therefore, is a subset of . Thus, this statement is always true.
- If , then : If , it means that and are disjoint. This implies that every element of is not in , and therefore must be in (the complement of ). So, . Since and are non-empty, cannot be equal to (as contains elements not in ), making a proper subset of . Thus, this statement is always true.
---
Summary
- Definitions are Paramount: Be absolutely clear on the definitions of a set, element, subset (), proper subset (), and membership ().
- Power Set Cardinality: For a set with cardinality , the power set has cardinality . This is a frequently tested concept.
- Inclusion-Exclusion: Master the formula . For problems with three sets, drawing a Venn diagram is often faster and less error-prone than using the full formula.
- Set Identities: Understand the fundamental laws, especially De Morgan's Laws: and .
---
What's Next?
This topic provides the foundation for several other critical areas in Discrete Mathematics:
- Relations: A relation between two sets and is formally defined as a subset of their Cartesian product, . Understanding sets is a prerequisite.
- Functions: A function is a special type of relation where each element in the domain maps to exactly one element in the codomain. The concepts of domain, codomain, and range are all based on sets.
Master these connections for comprehensive GATE preparation!
---
Now that you understand Sets, let's explore Relations which builds on these concepts.
---
Part 2: Relations
Introduction
In the discipline of discrete mathematics, the concept of a relation provides a formal framework for describing connections between elements of sets. A relation is, in essence, a generalization of a function. While a function must map each input from its domain to a single, unique output, a relation allows for more flexible associations: an element may be related to multiple elements, or to none at all. This framework is fundamental to numerous areas within computer science, including database theory (relational databases), graph theory, and the formal verification of algorithms.
Our study will begin with the foundational definitions, establishing a relation as a subset of a Cartesian product. We will then proceed to a systematic examination of the properties that a relation on a set may possess, such as reflexivity, symmetry, and transitivity. The culmination of these properties leads to the particularly important concept of an equivalence relation, which partitions a set into disjoint subsets known as equivalence classes. For the GATE examination, a thorough understanding of these properties and the structure of equivalence relations is not merely advantageous but essential for solving a class of problems that test deep conceptual clarity.
Let and be two non-empty sets. A binary relation from set to set is a subset of the Cartesian product . If , we say that is related to by , often denoted as .
If , the relation is called a relation on the set A.
---
Key Concepts
1. Fundamental Definitions and Representations
Let us first establish the necessary groundwork. The Cartesian product of two sets, and , denoted , is the set of all ordered pairs where and .
A relation is simply any subset of this product. The set is called the domain of the relation, and the set is the codomain. The range of a relation is the set of all second elements of the pairs in , i.e., .
Relations can be represented in several ways, each offering a different perspective.
* Set-Roster Notation: The relation is explicitly listed as a set of ordered pairs. For , a relation could be .
* Matrix Representation: For a relation from to , we can construct an matrix where if and otherwise.
* Directed Graph (Digraph): For a relation on a set , we can draw a graph where the vertices represent the elements of . A directed edge is drawn from vertex to vertex if and only if .
Consider the set and the relation . The digraph representation provides an intuitive visualization of this structure.
---
2. Properties of Relations on a Set
When a relation is defined on a single set (i.e., ), it can exhibit several important properties. Let us consider a relation on a set .
* Reflexive: A relation is reflexive if every element is related to itself.
In matrix form, all diagonal entries must be 1. In a digraph, every vertex must have a self-loop.
* Irreflexive: A relation is irreflexive if no element is related to itself.
In matrix form, all diagonal entries must be 0. In a digraph, no vertex has a self-loop.
* Symmetric: A relation is symmetric if for every pair in , the pair is also in .
In matrix form, the matrix is equal to its transpose (). In a digraph, for every edge from to , there must be a corresponding edge from to .
* Antisymmetric: A relation is antisymmetric if the only way for both and to be in is if .
This property is crucial for defining partial orderings.
* Transitive: A relation is transitive if a "chain" of relations implies a direct relation.
In a digraph, if there is a path of length 2 from vertex to (via ), there must be a direct edge from to .
* Circular: This is a less common but tested property. A relation is circular if a chain of two relations implies a "reversed" relation.
---
3. Equivalence Relations
An equivalence relation is a fundamental structure that generalizes the concept of equality. It groups elements of a set that are similar in some specified manner.
A relation on a set is an equivalence relation if it is:
- Reflexive
- Symmetric
- Transitive
The canonical example is the equality relation "=" on the set of integers. Another is the congruence modulo relation, where if divides .
An equivalence relation on a set induces a partition of . A partition is a collection of non-empty, disjoint subsets of whose union is . These subsets are called equivalence classes.
Let be an equivalence relation on a set . For any element , the equivalence class of , denoted by , is the set of all elements in that are equivalent to .
The set of all distinct equivalence classes is called the quotient set, denoted .
Worked Example:
Problem: Let and define a relation on such that if and only if . Determine the equivalence classes.
Solution:
Step 1: Understand the relation. means that is an integer multiple of 3. We verify this is an equivalence relation (it is reflexive, symmetric, and transitive).
Step 2: Find the equivalence class of 1, denoted . We seek all such that .
- , which is . So .
- , not a multiple of 3.
- , not a multiple of 3.
- , which is . So .
- , not a multiple of 3.
Step 3: Find the equivalence class of 2, denoted . We seek all such that .
- . So .
- . So .
Step 4: Find the equivalence class of 3, denoted . We seek all such that , which is the same as .
- . So .
Step 5: Verify the partition. The equivalence classes are , , and . These are disjoint, non-empty, and their union is .
Answer: The equivalence classes are , , and . The quotient set is .
---
4. The Circular Relation Property
As observed in GATE examinations, non-standard properties may be introduced to test fundamental reasoning. The circular property is one such example. A key result connects it directly to equivalence relations.
A relation on a set is an equivalence relation if and only if is reflexive and circular.
Let us prove this significant result.
Proof:
Part 1: Equivalence Reflexive and Circular
Assume is an equivalence relation. By definition, is reflexive. We must show it is circular.
Let and .
Since is transitive, .
Since is symmetric, .
Thus, . This is the definition of a circular relation.
Part 2: Reflexive and Circular Equivalence
Assume is reflexive and circular. We must show is symmetric and transitive.
* Symmetry:
Let . We want to show .
Since is reflexive, we know that .
We have and .
By the circular property, these two imply .
Thus, is symmetric.
* Transitivity:
Let and . We want to show .
By the circular property, .
We have just proven that is symmetric.
Therefore, since , it must be that .
Thus, is transitive.
Since is reflexive (by assumption), symmetric, and transitive, it is an equivalence relation. This completes the proof.
---
---
#
## 5. Relations Induced by Functions
A function can be used to define an equivalence relation on its domain. This construction is a powerful idea that connects the study of functions to relations and partitions.
Consider a function . We can define a relation on the domain as follows:
This relation groups together elements of the domain that map to the same element in the codomain. We can demonstrate that this is always an equivalence relation.
Since is an equivalence relation, it partitions into equivalence classes. Let be the set of these equivalence classes. We can now define a new function by the rule:
A crucial question arises: is this function well-defined? A function is well-defined if its output depends only on the input, not on how the input is represented. Here, the input is an equivalence class , which can be represented by any of its members. If we choose a different representative, say , will we get the same output?
Let . By definition of an equivalence class, this means . By the definition of our relation , this means .
Therefore, and , which are equal.
So, . The output of is independent of the choice of representative from the equivalence class. Thus, the function is always well-defined.
Now, let us analyze the properties of this new function .
* Injectivity (One-to-one): is always injective.
To prove this, assume . By definition of , this means . By definition of , this implies . If and are equivalent, they belong to the same equivalence class, so . We have shown that , which is the definition of injectivity.
* Surjectivity (Onto): The surjectivity of depends on the surjectivity of the original function .
If is surjective, then for any , there exists some such that . Now consider the equivalence class . The function maps this class as . So, for any element in the codomain, we have found a pre-image in the domain . Therefore, if is surjective, then is also surjective.
* Bijectivity: A function is bijective if it is both injective and surjective. From our analysis, is always injective. It is surjective if and only if is surjective. Therefore, if is surjective, then is bijective.
This result is a simplified version of the First Isomorphism Theorem for sets and provides a canonical way to construct a bijection from a surjection.
Problem-Solving Strategies
For a relation on a finite set , its matrix representation can be used to quickly check properties:
- Reflexive: All diagonal elements are 1 ( for all ).
- Irreflexive: All diagonal elements are 0 ( for all ).
- Symmetric: The matrix is its own transpose ().
- Antisymmetric: If and , then must be equal to . (No 1s are symmetric with respect to the diagonal, except on the diagonal itself).
- Transitive: If the matrix product (using Boolean arithmetic: ) has a 1 at position , then must also have a 1 at . In other words, if , then must be 1.
---
Common Mistakes
- β Confusing Antisymmetric and Asymmetric: A relation can be both symmetric and antisymmetric simultaneously (e.g., the identity relation). An asymmetric relation, however, cannot have any symmetric pairs and where , and it must also be irreflexive. The key difference is the handling of self-loops.
- β Incomplete Transitivity Check: When checking for transitivity, students often miss a required pair. For , one might miss checking if is needed. Since and , transitivity requires .
- β Assuming Reflexivity on a Subset: A relation on a set is reflexive only if for every . If and , is not reflexive because is missing.
- β Circular vs. Transitive: Do not confuse the implications.
---
Practice Questions
:::question type="MCQ" question="Let . Consider the relation . Which of the following properties does possess?" options=["Reflexive and Transitive","Symmetric but not Transitive","Transitive but not Symmetric","Neither Symmetric nor Transitive"] answer="Symmetric but not Transitive" hint="Check each property systematically. For reflexivity, ensure all elements of A have self-loops. For transitivity, look for paths of length 2." solution="
Step 1: Check Reflexivity.
The set is . A reflexive relation on must contain . The relation is missing . Therefore, is not reflexive.
Step 2: Check Symmetry.
We check each pair.
- . The pair is also in . This is satisfied.
- . The pair is also in . This is satisfied.
Step 3: Check Transitivity.
We look for pairs and in .
- We have and . For transitivity, we must have .
- The pair is not in .
Result: The relation is symmetric but not transitive.
Answer: \boxed{\text{Symmetric but not Transitive}}
"
:::
:::question type="NAT" question="Let be a set with 4 elements. What is the number of reflexive relations on ?" answer="4096" hint="A relation on a set with elements is a subset of a Cartesian product of size . For a relation to be reflexive, which pairs must be included?" solution="
Step 1: Define the set and the Cartesian product.
Let the set be . The size of is .
A relation on is a subset of .
The size of the Cartesian product is .
The total number of relations on is the number of subsets of , which is .
Step 2: Apply the reflexive property constraint.
A relation on is reflexive if for every , the pair is in .
The pairs on the main diagonal of the matrix representation are . There are 4 such pairs.
For to be reflexive, these 4 pairs must be included in the relation. There is no choice for them.
Step 3: Count the remaining choices.
There are a total of 16 pairs in .
The 4 diagonal pairs have a fixed choice (they must be in ).
The remaining off-diagonal pairs can either be in the relation or not. For each of these 12 pairs, we have 2 choices.
Step 4: Calculate the total number of reflexive relations.
The total number of ways to form the relation is the product of the number of choices for each pair.
Number of relations = .
Step 5: Compute the final value.
Result: The number of reflexive relations on a set with 4 elements is 4096.
Answer: \boxed{4096}
"
:::
:::question type="MSQ" question="Let the set of integers be . Define a function as . Let be a relation on defined by if . Let be the set of equivalence classes of . Let a new function be defined as . Which of the following statements is/are TRUE?" options=["The function is surjective.","The relation is an equivalence relation.","The function is injective (one-to-one).","The function is surjective (onto)."] answer="The relation is an equivalence relation.,The function is injective (one-to-one)." hint="Analyze the properties of the function on the domain of integers. Recall the properties of the induced function G." solution="
Statement 1: The function is surjective.
A function is surjective if its range equals its codomain. Here, the codomain is . The range of for is the set of perfect squares . This is not equal to all integers . For example, there is no integer such that . Therefore, is not surjective. This statement is FALSE.
Statement 2: The relation is an equivalence relation.
The relation is defined as . As proven in the notes, any relation defined this way from a function is an equivalence relation.
- Reflexive: .
- Symmetric: .
- Transitive: .
Statement 3: The function is injective (one-to-one).
The function is defined from the set of equivalence classes to . As proven in the notes, such a function is always injective.
To verify: Assume . This means . By definition of the relation , this means . If , then they belong to the same equivalence class, i.e., . Since , the function is injective. This statement is TRUE.
Statement 4: The function is surjective (onto).
The function is surjective if and only if the original function is surjective. We already established in Statement 1 that is not surjective. Therefore, is also not surjective. This statement is FALSE.
Result: The correct statements are "The relation is an equivalence relation." and "The function is injective (one-to-one)."
Answer: \boxed{\text{The relation is an equivalence relation.,The function is injective (one-to-one).}}
"
:::
---
Summary
- Properties are Fundamental: Be able to rapidly identify if a relation is reflexive, symmetric, antisymmetric, and transitive. Use matrix or graph representations as a tool for quick verification.
- Equivalence Relations Partition Sets: Understand that an equivalence relation (Reflexive, Symmetric, Transitive) on a set groups elements into disjoint equivalence classes, whose union is . This is a core concept.
- Special Properties: Be prepared for non-standard properties like "circular". The key result to remember is that a relation is an equivalence relation if and only if it is reflexive and circular.
- Functions Induce Relations: A function induces an equivalence relation on its domain via . The induced map from the equivalence classes to is always well-defined and injective. It is bijective if and only if the original function was surjective.
---
What's Next?
A solid understanding of relations is the foundation for more advanced topics in discrete mathematics.
- Partial Orders (Posets) and Lattices: If a relation is reflexive, antisymmetric, and transitive, it defines a partial order. This is the basis for structures like Hasse diagrams and lattices, which are important in algorithm design and theory of computation.
- Functions: Relations are a superset of functions. Deepening your understanding of injective, surjective, and bijective functions will clarify the connection explored in this chapter and is crucial for many other GATE CS topics.
- Graph Theory: A directed graph is a visual representation of a relation. Properties of relations, such as transitivity (transitive closure), have direct analogues in graph reachability algorithms.
---
---
Now that you understand Relations, let's explore Functions which builds on these concepts.
---
Part 3: Functions
Introduction
In the study of discrete mathematics, the concept of a function is of paramount importance. A function serves as a fundamental mechanism for formally describing a relationship between two sets, where each element of the first set is associated with exactly one element of the second. This simple yet powerful idea forms the bedrock upon which more complex structures in computer science are built, including data structures, algorithms, computability theory, and formal languages.
For the GATE examination, a robust understanding of functions is not merely a prerequisite for this topic alone; it is intrinsically linked to the study of relations, set theory, and counting principles. We will explore the formal definition of a function, classify functions based on their mapping propertiesβnamely injectivity, surjectivity, and bijectivityβand investigate the composition of functions. Mastery of these concepts is essential for solving a significant class of problems that frequently appear in the examination, often requiring the application of function properties to arguments about set cardinalities.
A function from a non-empty set to a non-empty set , denoted as , is a rule that assigns to each element exactly one element . The set is called the domain of the function, and the set is called the codomain.
We write to denote that is the unique element in assigned by to the element .
---
Key Concepts
1. Domain, Codomain, Range, and Image
While the domain and codomain define the function's scope, the concepts of image and range describe its actual output.
- Domain (): The set of all possible inputs to the function.
- Codomain (): The set of all possible outputs, as declared in the function's definition.
- Image: The image of an element under is the output element .
- Range (or Image of ): The set of all actual output values produced by the function. The range of is a subset of the codomain , denoted as or . Formally, .
In the diagram, , , and . The domain is . The codomain is . The range is , which is a proper subset of the codomain.
---
2. Types of Functions
The properties of the mapping give rise to a critical classification of functions.
Injective (One-to-One) Function
A function is injective if distinct elements in the domain map to distinct elements in the codomain.
A function is injective (or one-to-one) if for every , the following implication holds:
Equivalently, its contrapositive form is often useful: .
For finite sets, an injection from to can only exist if the number of elements in the domain is less than or equal to the number of elements in the codomain.
Surjective (Onto) Function
A function is surjective if every element in the codomain is an image of at least one element from the domain.
A function is surjective (or onto) if for every , there exists at least one such that .
This is equivalent to stating that the range of the function is equal to its codomain: .
For finite sets, a surjection from to can only exist if the number of elements in the domain is greater than or equal to the number of elements in the codomain.
Bijective Function
A function is bijective if it is both injective and surjective.
A function is bijective if it is both injective and surjective. This means every element in the codomain is mapped to by exactly one element from the domain.
A bijection establishes a perfect one-to-one correspondence between the elements of two sets.
---
3. Cardinality and Functions
For finite sets, the existence of certain types of functions imposes constraints on their cardinalities. These rules are fundamental for solving many GATE problems.
Let and be two finite sets.
- If there exists an injective function , then it must be that .
- If there exists a surjective function , then it must be that .
- If there exists a bijective function , then it must be that .
Furthermore, we can count the number of functions between two finite sets.
The total number of functions from a finite set to a finite set is given by:
Variables:
- = Cardinality of the domain
- = Cardinality of the codomain
When to use: This formula is used when asked to find the total possible mappings from one finite set to another, which is a common scenario in combinatorial problems related to functions (as seen in PYQ 3).
Worked Example:
Problem: Let be the set of all functions from to . Let be the set of all binary matrices. Does a bijection exist between and ?
Solution:
Step 1: Calculate the cardinality of the set .
The domain is with . The codomain is with . The number of functions from to is .
Step 2: Calculate the cardinality of the set .
A binary matrix has entries. Each entry can be either 0 or 1 (2 choices).
Step 3: Compare the cardinalities to determine if a bijection can exist.
A bijection between two finite sets can only exist if their cardinalities are equal.
Since , no bijection can exist between and .
Answer:
---
---
4. Composition of Functions
We can combine functions to create new ones through an operation called composition.
Let and be two functions. The composition of and , denoted (read "g composed with f"), is a function from to defined by:
The output of becomes the input to .
The properties of a composite function depend on the properties of its constituent functions. These relationships are frequently tested in GATE.
Let and be two functions.
- If and are both injective, then is injective.
- If and are both surjective, then is surjective.
- If is injective, then must be injective. ( is not necessarily injective).
- If is surjective, then must be surjective. ( is not necessarily surjective).
Worked Example:
Problem: Let be defined by , and be defined by . Is the composite function surjective? Is surjective?
Solution:
Part 1: Analyze
Step 1: Define the composite function .
Step 2: Check for surjectivity.
A function is surjective if its range equals its codomain (). The range of consists of all odd integers.
Step 3: Compare the range to the codomain.
The range (all odd integers) is a proper subset of the codomain (all integers). For example, there is no integer such that . Therefore, the function is not surjective.
Part 2: Analyze
Step 1: Define the composite function .
Step 2: Check for surjectivity.
The range of consists of all even integers.
Step 3: Compare the range to the codomain.
The range (all even integers) is a proper subset of the codomain (all integers). For example, there is no integer such that . Therefore, this function is also not surjective.
Answer: Neither nor is surjective.
---
Problem-Solving Strategies
When a question asks about the existence of an injection, surjection, or bijection between two finite sets (which might be described in complex ways, e.g., sets of matrices or sets of functions), the first and most efficient step is to calculate the cardinalities of the two sets.
- If , a bijection is impossible.
- If , an injection is impossible.
- If , a surjection is impossible.
---
Common Mistakes
- β Confusing Codomain and Range: Students often assume the range is the entire codomain. A function is only surjective if this is true. Always distinguish between the set of potential outputs (codomain) and the set of actual outputs (range).
- β Incorrectly Applying Composition Properties: A common error is to assume that if is surjective, then must also be surjective. This is false.
- β Assuming Existence from Cardinality: While is a necessary condition for an injection to exist between finite sets, it does not describe the property of a given function. A specific function where is not automatically injective. You must check its definition.
---
Practice Questions
:::question type="MCQ" question="Let and be functions. If their composition is an injective function, which of the following must be true?" options=[" is injective.", " is injective.", " is surjective.", " is surjective."] answer=" is injective." hint="Consider the definition of injectivity for the composite function:
Step 1: State the premise.
We are given that is injective. This means that for any :
Step 2: Expand the definition of composition.
Step 3: Analyze the implication for function .
We want to prove that is injective. To do this, we must show that
Let us assume
Step 4: Apply function to both sides.
If , then applying the function to these equal elements must yield an equal result:
Step 5: Use the premise from Step 2.
From our premise, we know that if
Step 6: Conclude the proof for .
We have successfully shown that assuming
(Note: is not necessarily injective. Consider , with and . Here is injective, but is not.)
"
:::
:::question type="NAT" question="Let denote the power set of a set . Let be a finite set. A bijective function exists from to the set . What is the cardinality of set ?" answer="10" hint="Recall the formula for the cardinality of a power set. A bijection implies that the domain and codomain have equal cardinality." solution="
Step 1: Understand the relationship between bijection and cardinality.
The existence of a bijective function from a set to a set implies that their cardinalities are equal, i.e., .
Step 2: Identify the sets and their cardinalities.
The domain is , the power set of . The codomain is .
The cardinality of the codomain is .
Step 3: Use the bijection property to equate cardinalities.
Step 4: Use the formula for the cardinality of a power set.
The cardinality of the power set of a set with is given by . Let .
Step 5: Solve for .
We have the equation:
We recognize that is a power of 2.
Therefore,
Result:
The cardinality of set is 10.
"
:::
:::question type="MSQ" question="Let and . Let be the set of all functions from to . Which of the following statements is/are correct?" options=["The total number of functions in is 81.", "No function in can be surjective.", "There exists at least one function in that is injective.", "The total number of functions in is 64."] answer="No function in can be surjective.,There exists at least one function in that is injective.,The total number of functions in is 64." hint="First, calculate the cardinalities of and . Then, apply the cardinality rules for the existence of injections and surjections. Use the formula for the total number of functions." solution="
Statement 1 & 4: Total number of functions
The number of functions from a set to a set is .
Here, and .
Total functions = .
Therefore, "The total number of functions in is 64" is correct, and "The total number of functions in is 81" is incorrect.
Statement 2: Surjective functions
For a surjective function from to to exist, we must have .
Here, and . Since , it is not possible to create a surjective function from to . The range of any function from can have at most 3 elements, but the codomain has 4 elements. Thus, the range can never equal the codomain.
Therefore, "No function in can be surjective" is correct.
Statement 3: Injective functions
For an injective function from to to exist, we must have .
Here, and . Since , an injective function can exist.
For example, we can define . This is a valid injective function as distinct elements in map to distinct elements in .
Therefore, "There exists at least one function in that is injective" is correct.
The correct options are the ones stating that the total number of functions is 64, no function can be surjective, and at least one injective function exists.
"
:::
---
Summary
- Function Types are Defined by Mapping: A function is injective (one-to-one) if no two inputs map to the same output. It is surjective (onto) if every element in the codomain is an output. It is bijective if it is both.
- Cardinality Rules are Crucial: For finite sets and , an injection implies , a surjection implies , and a bijection implies . These rules are powerful shortcuts for problem-solving.
- Master Composition Properties: Understand the implications of composite functions. If is surjective, then must be surjective. If is injective, then must be injective. Memorize these one-way implications as they are frequently tested.
- Know How to Count Functions: The total number of functions from set to set is . This is fundamental for combinatorial problems involving functions.
---
---
What's Next?
This topic provides a foundation for several other areas in Discrete Mathematics.
- Relations: A function is a specific type of binary relation where every element in the domain is related to exactly one element in the codomain. Understanding functions helps clarify the properties of more general relations.
- Group Theory: Bijections from a set to itself, known as permutations, form a group under the operation of function composition. The study of bijective functions is central to abstract algebra.
- Combinatorics: Counting the number of injective, surjective, and bijective functions are classic combinatorial problems that build directly upon the definitions learned here.
---
Now that you understand Functions, let's explore Partial Orders and Lattices which builds on these concepts.
---
Part 4: Partial Orders and Lattices
Introduction
In our study of discrete mathematical structures, relations form a fundamental building block. While equivalence relations partition a set into disjoint classes, another class of relations, known as partial orders, imposes a hierarchical structure. Partial orders allow us to compare elements of a set in a way that captures notions of precedence, containment, or hierarchy, without requiring that every pair of elements be comparable. This is a natural generalization of the familiar "less than or equal to" relation on numbers.
This chapter introduces the formal definition of a partially ordered set (poset) and its standard graphical representation, the Hasse diagram. We will then explore key concepts within posets, such as bounds, maximal and minimal elements, which culminate in the definition of a lattice. A lattice is a special type of poset with a highly regular structure, ensuring that any two elements have a unique least upper bound and a unique greatest lower bound. Though not frequently tested in GATE, a firm grasp of these concepts is essential for a complete understanding of discrete structures.
A relation on a set is a partial order if it is reflexive, antisymmetric, and transitive. A set together with a partial order is called a partially ordered set, or poset, and is denoted by or , where is a generic symbol for a partial order relation.
- Reflexive: For all , , or .
- Antisymmetric: For all , if and , then . (If and , then ).
- Transitive: For all , if and , then . (If and , then ).
---
Key Concepts
1. Hasse Diagrams
A finite poset can be represented by a directed graph. However, this graph often contains redundant information. A Hasse diagram is a simplified graphical representation that captures the essential structure of a finite poset.
To construct a Hasse diagram for a poset :
The resulting graph, with vertices as points and covering relations as lines, is the Hasse diagram.
Worked Example:
Problem: Let and let the relation be divisibility, denoted by ''. Draw the Hasse diagram for the poset .
Solution:
Step 1: Verify that is a poset.
- Reflexivity: for any integer . (True)
- Antisymmetry: If and , then for positive integers . (True)
- Transitivity: If and , then . (True)
Step 2: Identify the covering relations.
We draw an edge from to if and there is no (where ) such that and .
- 1 covers 2, 3.
- 2 covers 4, 6.
- 3 covers 6.
- 4 covers 12.
- 6 covers 12.
Step 3: Draw the Hasse diagram.
Place the elements at different levels. The "smaller" elements (divisors) are at the bottom.
Answer: The diagram above is the Hasse diagram for the poset .
---
2. Bounds and Lattices
Within a poset, we can analyze the relationship between elements of a subset. This leads to the concepts of upper and lower bounds.
Let be a poset and let be a subset of .
- An element is an upper bound of if for all .
- An element is a lower bound of if for all .
- An element is the least upper bound (lub) or supremum of if is an upper bound of , and for any other upper bound of , we have .
- An element is the greatest lower bound (glb) or infimum of if is a lower bound of , and for any other lower bound of , we have .
The lub and glb, if they exist, are unique. The existence of a unique lub and glb for every pair of elements gives a poset a special structure, which we define as a lattice.
A poset is called a lattice if for every pair of elements , both the least upper bound (lub) and the greatest lower bound (glb) exist in .
The lub of is often denoted by (join).
The glb of is often denoted by (meet).
When to use: To determine if a given poset is a lattice, one must check if every possible pair of elements has a well-defined meet and join within the poset.
In the Hasse diagram for , consider the subset .
- The upper bounds are elements that are multiples of both 4 and 6. In , only 12 is a multiple of both. So, the set of upper bounds is . The lub is therefore 12.
- The lower bounds are elements that divide both 4 and 6. In , these are 1 and 2. The set of lower bounds is . The greatest among these is 2. The glb is therefore 2.
---
---
Problem-Solving Strategies
For a finite poset represented by a Hasse diagram, to quickly check if it is a lattice, you do not need to test every single pair of elements. Instead, focus on pairs that are "incomparable" (neither nor ).
- Identify all pairs of incomparable elements. For example, in the diagram above, and are incomparable pairs.
- For each such pair, find their set of common upper bounds and common lower bounds by visually tracing paths upwards and downwards in the Hasse diagram.
- Verify that each of these sets has a unique least element (for upper bounds) and a unique greatest element (for lower bounds).
- If this condition holds for all incomparable pairs, the poset is a lattice. If you find even one pair that lacks a unique lub or glb, it is not a lattice.
---
Common Mistakes
- β Confusing Maximal/Minimal with Greatest/Least: A maximal element has no element "above" it. A greatest element is "above" all other elements. A poset can have multiple maximal elements but at most one greatest element.
- β Assuming any Poset is a Lattice: Not every poset is a lattice. The existence of a lub and glb for every pair is a strong condition.
---
Practice Questions
:::question type="MCQ" question="Let . Which of the following relations on the power set is a partial order but NOT a total order?" options=["Set Equality (=)","Set Intersection ()","Set Union ()","Set Subset ()"] answer="Set Subset ()" hint="A total order requires every pair of elements to be comparable. Consider two sets like and from and check if they are comparable under the given relations." solution="Let us analyze the options for the poset .
- Reflexive: for any set . (True)
- Antisymmetric: If and , then . (True)
- Transitive: If and , then . (True)
Therefore, is a poset.
Is it a total order? A total order requires that for any two elements , either or . Consider and . Neither nor is true. Thus, the elements are incomparable, and it is not a total order.
Hence, set subset () is the correct answer."
:::
:::question type="NAT" question="Consider the set with the partial order of divisibility. What is the greatest lower bound (glb) of the set ?" answer="5" hint="The glb of two numbers under the divisibility relation is their greatest common divisor (GCD)." solution="
Step 1: Identify the poset and the subset.
The poset is , where is the set of divisors of 30. The subset is .
Step 2: Find the set of all lower bounds of .
A lower bound must satisfy and . In other words, we are looking for the common divisors of 10 and 15.
Divisors of 10 are .
Divisors of 15 are .
The set of common divisors (lower bounds) is .
Step 3: Find the greatest element in the set of lower bounds.
The set of lower bounds is . The greatest element in this set under the divisibility relation (or standard ) is 5.
Result:
Answer: \boxed{5}
"
:::
:::question type="MSQ" question="Let be the poset represented by the following Hasse diagram. The set is . Which of the following statements are true?
" options=["The poset has a unique minimal element.","The lub of is .","The poset is a lattice.","The element is the least element."] answer="The element is the least element.,The poset has a unique minimal element." hint="Analyze the structure of the diagram. A least element is one that is 'below' all others. For the lattice property, check if incomparable pairs like have a unique lub and glb." solution="
Let's evaluate each statement:
"
:::
---
Summary
- A Partially Ordered Set (Poset) is defined by a relation that is reflexive, antisymmetric, and transitive. This structure imposes a hierarchy without requiring all elements to be comparable.
- A Hasse Diagram is a standard, simplified visualization of a finite poset, where direction is implied by vertical placement, and redundant (reflexive, transitive) edges are removed.
- A Lattice is a special type of poset where every pair of elements has a unique Least Upper Bound (lub, or ) and a unique Greatest Lower Bound (glb, or ). To verify if a poset is a lattice, check this condition for all pairs, especially the incomparable ones.
---
What's Next?
This topic provides foundational knowledge for more advanced structures in discrete mathematics.
- Boolean Algebra: A Boolean algebra is a complemented, distributive lattice. Understanding lattices is the first step toward grasping the algebraic structure of logic and digital circuits.
- Graph Theory: While Hasse diagrams are a specific type of graph, the general study of directed acyclic graphs (DAGs) shares many conceptual similarities with posets, particularly in scheduling and dependency analysis problems.
Mastering the fundamentals of posets and lattices will provide a solid base for these related and more frequently tested GATE topics.
---
Chapter Summary
From our comprehensive study of sets, relations, and functions, we have established several core principles that are indispensable for the GATE examination. The following points encapsulate the most critical concepts to be mastered.
- Set Cardinality and the Principle of Inclusion-Exclusion: A firm grasp of set operations is fundamental. For finite sets, we must be proficient in applying the Principle of Inclusion-Exclusion to determine the cardinality of the union of multiple sets, as this is a frequent source of numerical problems. The cardinality of a power set, , is another essential result.
- Properties of Binary Relations: The ability to classify a binary relation is a primary skill. We must be able to systematically test a given relation for reflexivity, irreflexivity, symmetry, antisymmetry, and transitivity. These properties are the building blocks for the more complex structures that follow.
- Equivalence Relations and Partitions: We have seen the profound connection between equivalence relations and partitions. An equivalence relation on a set partitions into disjoint equivalence classes. Conversely, any partition of defines a unique equivalence relation. Counting the number of possible equivalence relations on a finite set is a common advanced problem.
- Partially Ordered Sets (Posets) and Hasse Diagrams: A relation that is reflexive, antisymmetric, and transitive defines a partial order. We must be adept at translating a poset on a finite set into its Hasse diagram and, from the diagram, identifying maximal, minimal, greatest, and least elements.
- Lattices: A lattice is a special type of poset where every pair of elements has a unique least upper bound (join, ) and a greatest lower bound (meet, ). We must be able to determine if a given poset constitutes a lattice. The power set lattice is the canonical example, exhibiting properties of being both complemented and distributive.
- Classification of Functions: The concepts of injective (one-to-one), surjective (onto), and bijective (one-to-one correspondence) functions are central. Many counting problems in discrete mathematics reduce to the problem of counting the number of functions of a certain type between two finite sets.
---
Chapter Review Questions
:::question type="MCQ" question="Let and let be a relation on defined as for some function . Which of the following statements about must be true, regardless of the choice of ?" options=[" is a partial order."," is an equivalence relation.","The number of ordered pairs in is at most 4."," is the identity relation, i.e., "] answer="B" hint="Test the properties of reflexivity, symmetry, and transitivity based on the definition ." solution="
The relation is defined on such that if and only if . We must check the properties that hold for any function .
Since is reflexive, symmetric, and transitive, it is an equivalence relation. This holds true for any function .
Let us examine why the other options are not necessarily true:
- A) is a partial order: A partial order must be antisymmetric. If we choose a function that is not injective, e.g., and , then and , but . Thus, is not necessarily antisymmetric.
- C) The number of ordered pairs in is at most 4: If we choose a constant function, e.g., for all , then for all pairs . In this case, , and . This is greater than 4.
- D) is the identity relation: This only occurs if the function is injective (one-to-one). However, since and the codomain has size 3, by the Pigeonhole Principle, no injective function from to exists. Therefore, can never be the identity relation in this specific case.
Thus, the only statement that must be true is that is an equivalence relation.
"
:::
:::question type="NAT" question="Let be a set with 5 elements and be a set with 3 elements. The number of surjective (onto) functions from to is ______." answer="150" hint="Use the Principle of Inclusion-Exclusion. Start with the total number of functions and subtract those that are not onto." solution="
Let and .
The total number of functions from to is .
A function is surjective if every element in the codomain is mapped to by at least one element from the domain . We can count the number of surjective functions using the Principle of Inclusion-Exclusion.
The formula for the number of surjective functions from a set of size to a set of size is:
Here, and .
Let's calculate each term:
- Term 1: . (This is the total number of functions).
- Term 2: . (This subtracts functions that miss at least one specific element).
- Term 3: . (This adds back functions that miss at least two specific elements, as they were subtracted twice).
- Term 4: . (This subtracts functions that miss three elements, which is impossible).
Combining these results:
Therefore, the number of surjective functions from to is 150.
Answer: \boxed{150}"
:::
:::question type="MCQ" question="Consider the set of divisors of 36, . Let the relation be 'divides', denoted by ''. Which of the following statements about the poset is FALSE?" options=["The poset is a lattice.","The greatest lower bound of is 6.","The least upper bound of is 36.","The element 2 is a minimal element."] answer="D" hint="Recall the definitions of minimal element, GLB (meet), LUB (join), and lattice. A minimal element is one with no elements strictly smaller than it." solution="
Let us analyze the poset . The relation is divisibility.
In this context:
- The greatest lower bound (GLB) of two numbers is their greatest common divisor (GCD).
- The least upper bound (LUB) of two numbers is their least common multiple (LCM).
We will evaluate each statement:
A) The poset is a lattice.
For any pair of elements in , their GCD and LCM must also be in . Since all elements are divisors of 36, the GCD of any two elements will also be a divisor of 36. Similarly, the LCM of any two elements that are divisors of 36 will also be a divisor of 36. For example, , which is in . , which is in . This holds for all pairs. Therefore, the poset is a lattice. This statement is TRUE.
B) The greatest lower bound of is 6.
. The divisors of 12 are . The divisors of 18 are . The greatest common divisor is 6. This statement is TRUE.
C) The least upper bound of is 36.
. Since , the . This statement is TRUE.
D) The element 2 is a minimal element.
A minimal element is an element such that there is no other element in the set for which and . In our set , the element 1 is present. We have and . Therefore, 2 is not a minimal element. The only minimal element in this poset is 1, which is also the least element. This statement is FALSE.
"
:::
:::question type="NAT" question="In a class, 40% of students enrolled for Mathematics, 70% enrolled for Computer Science. If 15% of the students enrolled for both Mathematics and Computer Science, and every student enrolled for at least one of the two subjects, what is the total number of students in the class if 35 students enrolled for Mathematics only?" answer="200" hint="Let the total number of students be . Express the number of students in each category as a percentage of and use the given absolute number to solve for ." solution="
Let be the set of students enrolled for Mathematics and be the set of students enrolled for Computer Science. Let the total number of students in the class be .
From the problem statement, we have:
The number of students who enrolled for Mathematics only is given by .
We are given that this number is 35.
So, we can set up the equation:
Substituting the percentage values in terms of :
The information that "every student enrolled for at least one" leads to . If every student enrolled for at least one, then , which implies , or , meaning . This is a contradiction with the existence of 35 students. We proceed by assuming this clause is an error in the problem statement, as the rest of the data is consistent and allows for a unique solution for .
The total number of students in the class is 140.
Answer: \boxed{140}"
:::
---
What's Next?
Having completed this chapter on Set Theory, Relations, and Functions, we have established a firm foundation in discrete mathematics. The abstract structures and rigorous definitions discussed herein are not isolated topics; rather, they form the essential vocabulary for many advanced areas of computer science and engineering.
Key connections to upcoming chapters include:
- Graph Theory: A binary relation on a set can be directly visualized as a directed graph, where the elements of the set are vertices and the ordered pairs in the relation are edges. Properties like reflexivity (self-loops), symmetry (bidirectional edges), and transitivity find natural graphical interpretations.
- Combinatorics and Probability: The counting techniques explored, particularly those involving functions and the Principle of Inclusion-Exclusion, are cornerstones of combinatorics. These skills are indispensable for solving problems in permutation, combination, and the calculation of probabilities in a discrete sample space.
- Group Theory: The concept of a function is generalized to that of a binary operation, which is central to the study of algebraic structures like groups, rings, and fields. The properties of relations, such as associativity and the existence of identity and inverse elements, are formalized in this context.
- Mathematical Logic: Set theory is the bedrock upon which formal logic is built. The set operations of union, intersection, and complement correspond directly to the logical operators OR (), AND (), and NOT (), respectively. This correspondence is formalized in the study of Boolean Algebra.