GATE 2026 CS2 Q.26
Let be a binary relation on the set , where if the product of and is square of an integer. Which of the following properties is/are satisfied by ?
- (A)
Reflexive
- (B)
Symmetric
- (C)
Transitive
- (D)
Antisymmetric
GATE CS
This topic covers sets, relations, functions, partial orders and lattices, the vocabulary used all through discrete mathematics. Typical questions ask you to count objects (relations with a given property, functions, partitions), to test a relation for its properties, or to decide whether a poset is a lattice and of what kind. The definitions and counting formulas below are stated with their conditions; read each question's own conventions first.
8 previous-year questions · 8 solved · 6 practice questions
A set is a collection of distinct objects. is the number of elements of a finite set . The power set is the set of all subsets of (including and ). The symmetric difference holds the elements in exactly one of the two sets. The Cartesian product is the set of ordered pairs with , . Complements are taken inside a universe that contains every set in the question: .
SIZE OF THE POWER SET
For a finite set A; each element is either in or out of a subset.
SIZE OF A CARTESIAN PRODUCT
Finite sets. A relation from A to B is any subset of A × B, so there are of them.
INCLUSION-EXCLUSION FOR TWO SETS
Finite sets; this is the basis of Venn-diagram counting.
INCLUSION-EXCLUSION FOR THREE SETS
Finite sets; add singles, subtract pairs, add the triple.
SIZE OF THE SYMMETRIC DIFFERENCE
Finite sets.
Set identities to know
De Morgan: and .
Distributive: and .
.
; is associative and commutative, and .
if and only if if and only if .
EXAM TIP
In Venn-diagram problems first count the region common to all the sets, then work outwards. At the end check that the regions 'in none', 'in exactly one', 'in exactly two' and 'in all three' add up to .
A set is countable if it is finite or can be put in one-to-one correspondence with (countably infinite). Otherwise it is uncountable. Here ; starting from 1 changes nothing about countability. A subset of a countable set is countable. A countable union of countable sets is countable. A finite Cartesian product of countable sets is countable.
Which common sets are countable
Set | Countable? | Reason in one line |
|---|---|---|
, | Yes | List as |
Yes | Each rational is a pair of integers; list the pairs in a diagonal order | |
Finite strings over a finite alphabet | Yes | List by length, then alphabetically |
Finite subsets of | Yes | For each , the subsets with largest element are finitely many; a countable union of finite sets |
, any interval with | No | Cantor's diagonal argument |
No | Cantor's theorem: for every set | |
All functions | No | Same size as : a subset corresponds to its 0/1 indicator |
All functions | No | Contains all functions |
All infinite binary strings | No | Same as the functions |
EXAM TIP
Countable union and finite product keep countability. The power set of an infinite set, and the set of all functions from an infinite set to a set with at least two elements, are uncountable. is uncountable, since removing a countable set from an uncountable one leaves an uncountable set.
A relation on a set is a subset of . Write for . For the relation has an 0/1 matrix with exactly when . The identity relation is . The inverse is .
Properties of a relation R on A
Property | Definition | In the matrix |
|---|---|---|
Reflexive | All diagonal entries are 1 | |
Irreflexive | All diagonal entries are 0 | |
Symmetric | ||
Antisymmetric | No pair with | |
Asymmetric | Diagonal 0 and no symmetric pair of 1s (irreflexive and antisymmetric) | |
Transitive | Whenever then |
EXAM TIP
Symmetric and antisymmetric are not opposites. The empty relation and the identity relation are both. A relation that is not symmetric need not be antisymmetric. The empty relation is symmetric, antisymmetric, asymmetric, irreflexive and transitive, and is reflexive only when .
ALL RELATIONS ON AN N-ELEMENT SET
Each of the ordered pairs is in or out.
REFLEXIVE RELATIONS
The n diagonal pairs are forced; the other are free. Irreflexive relations have the same count.
NEITHER REFLEXIVE NOR IRREFLEXIVE
For , where no relation is both reflexive and irreflexive: subtract the reflexive and the irreflexive relations from all relations.
SYMMETRIC RELATIONS
Choose freely for each of the diagonal pairs and each of the unordered pairs with .
ANTISYMMETRIC RELATIONS
Diagonal pairs are free (); each unordered pair with has 3 choices: none, only, only.
ASYMMETRIC RELATIONS
Diagonal pairs are excluded; each unordered pair has the same 3 choices. Reflexive and antisymmetric relations have the same count (diagonal forced in instead of out).
REFLEXIVE AND SYMMETRIC RELATIONS
Diagonal forced to 1; each unordered pair with is in or out. Irreflexive and symmetric relations have the same count.
RELATIONS BOTH SYMMETRIC AND ANTISYMMETRIC
Such a relation is a subset of the identity relation, so only the diagonal pairs are free.
EXAM TIP
There is no simple closed form for the number of transitive relations on elements; for the counts are , and small cases are done by listing. The other counts above all come from one idea: separate the diagonal pairs from the unordered off-diagonal pairs, and count the choices for each.
WORKED EXAMPLE
How many antisymmetric relations are there on a set with 4 elements?
Diagonal pairs: 4, each free, giving choices.
Unordered pairs with : , each with 3 choices (none, one direction, other direction), giving .
Total: .
Answer: 11664
An equivalence relation is reflexive, symmetric and transitive. The equivalence class of is . The classes are non-empty, pairwise disjoint and their union is , so they form a partition of . Conversely every partition defines an equivalence relation ( when and lie in the same block). Equivalence relations on and partitions of correspond one to one, and the equivalence relations with exactly classes correspond to the partitions into blocks.
EQUIVALENCE RELATIONS ON N ELEMENTS
(Bell number) counts partitions of an n-element set; (Stirling number of the second kind) counts partitions into exactly non-empty blocks.
RECURRENCES FOR BELL AND STIRLING NUMBERS
With for , and .
PARTITIONS INTO TWO BLOCKS
For : the number of equivalence relations on n elements with exactly two classes.
The reflexive, symmetric and transitive closures of are the smallest relations containing with that property. For relations from to and from to , this page writes composition in the same order as functions: , so is applied first, just as applies first. Some texts write the same relation as ; always read the definition in the question. Powers do not depend on the convention: and .
Closures and composition
Operation | Formula | Matrix view |
|---|---|---|
Reflexive closure | Set the diagonal to 1 | |
Symmetric closure | ||
Transitive closure | for | Warshall's algorithm, or the union of Boolean powers of |
Reflexive-transitive closure | Transitive closure with diagonal set to 1 | |
Composition ( first) | Boolean product (AND for multiply, OR for add), in that order |
Warshall's algorithm for the transitive closure
Start with the matrix .
For each element in turn, and for every pair : set .
After the last , is the matrix of the transitive closure.
More facts
, and composition of relations is associative.
The intersection of two equivalence relations on is an equivalence relation.
The union of two equivalence relations need not be one: on , the relation joining 1 and 2 and the relation joining 2 and 3 have a union containing and but not .
WORKED EXAMPLE
Find the transitive closure of on .
: from get ; from get ; from get . So .
: and give ; and give ; and give . So .
contains all 9 ordered pairs.
Answer: (all 9 pairs).
EXAM TIP
For the smallest equivalence relation containing , take the reflexive and symmetric closures (in either order) and the transitive closure last: the transitive closure of a reflexive, symmetric relation stays reflexive and symmetric. Taking the symmetric closure after the transitive one can lose transitivity: is transitive, but its symmetric closure is not, since it lacks .
A function assigns to every exactly one ; is the domain, the codomain and the range. It is injective (one-to-one) if implies ; surjective (onto) if every equals for some ; bijective if both. The composition means apply first: . A function has an inverse function exactly when it is a bijection.
Facts about composition
If is injective then is injective (nothing is said about ).
If is surjective then is surjective (nothing is said about ).
So if is a bijection, is injective and is surjective.
The composition of injective functions is injective; of surjective functions is surjective; of bijections is a bijection.
for bijections .
A function between finite sets of the same size is injective if and only if it is surjective.
ALL FUNCTIONS FROM A TO B
Each element of independently picks an image.
INJECTIVE FUNCTIONS
, , ; when there are none (the product form gives 0).
BIJECTIONS BETWEEN SETS OF EQUAL SIZE
; this is also the number of permutations of an n-set.
SURJECTIVE FUNCTIONS (INCLUSION-EXCLUSION)
, ; zero when .
PARTIAL FUNCTIONS FROM A TO B
, ; each element of maps to one of the elements or is left undefined.
WORKED EXAMPLE
How many surjective functions are there from a 5-element set onto a 3-element set?
Here , .
Count all functions: .
Subtract functions missing at least one of the 3 targets: .
Add back functions missing two targets (counted twice): .
Functions missing all three targets: none, since .
Total: .
Answer: 150
EXAM TIP
The definition of the domain and codomain matters: the same rule can be onto for one codomain and not onto for another. Also check whether a question counts functions from to or from to ; the formulas for injective and surjective counts use (domain) and (codomain).
A partial order is a relation that is reflexive, antisymmetric and transitive; the pair is a poset. Elements are comparable if or . The poset is a total order (chain) if any two elements are comparable. Element covers if and no element has . A Hasse diagram draws one vertex per element and an edge from up to exactly when covers , leaving out the loops and all edges implied by transitivity. On this page a Hasse diagram is given by its list of covers.
Special elements of a poset (A, ⪯) and a subset S
Term | Meaning |
|---|---|
Maximal element | with no such that (there can be several) |
Minimal element | with no such that (there can be several) |
Greatest element | An element with for all (at most one; it is the only maximal element) |
Least element | An element with for all (at most one; it is the only minimal element) |
Upper bound of S | An element with for all |
Lower bound of S | An element with for all |
Least upper bound (join) of S | The least element of the set of upper bounds, if it exists |
Greatest lower bound (meet) of S | The greatest element of the set of lower bounds, if it exists |
EXAM TIP
A finite non-empty poset always has at least one maximal and one minimal element, and it has a greatest element exactly when it has only one maximal element. In an infinite poset a unique maximal element need not be greatest: in with its usual order plus one extra element comparable to nothing else, is the only maximal element but is not greatest.
SUBSETS OF AN N-SET ORDERED BY INCLUSION
Poset with : is covered by for each .
DIVISIBILITY ON THE DIVISORS OF N
Poset of positive divisors under 'divides' ( distinct primes); join is lcm and meet is gcd.
HASSE DIAGRAM EDGES FOR THE DIVISORS OF N
; is covered by whenever divides . For : .
Chains and antichains
A chain is a subset in which any two elements are comparable; an antichain is a subset in which no two distinct elements are comparable.
In a finite poset, the largest size of an antichain equals the smallest number of chains that together cover the poset.
In a finite poset, the largest number of elements in a chain equals the smallest number of antichains that together cover the poset.
In with , the largest antichain has elements (all subsets of size ).
Every finite poset has a linear extension (a total order that keeps all the given comparisons), found by repeatedly removing a minimal element. This is topological sorting. Partial orders have no simple counting formula: the number of partial orders on a labelled set of 1, 2, 3, 4 elements is 1, 3, 19, 219. The number of total orders on an n-element set is .
A lattice is a poset in which every pair of elements has a join (least upper bound) and a meet (greatest lower bound). Every finite non-empty lattice has a greatest element and a least element , so it is bounded. In a bounded lattice, is a complement of if and . The lattice is complemented if every element has at least one complement. It is distributive if for all (the dual identity then holds too). A sublattice is a subset closed under the lattice's own join and meet.
Quick tests for common lattices
Lattice | Join / meet | Distributive? | Complemented? |
|---|---|---|---|
Chain with element | max / min | Yes | Only if it has at most 2 elements |
/ | Yes | Yes (complement is set complement); a Boolean algebra | |
Positive divisors of under divisibility | lcm / gcd | Yes | Exactly when is square-free (no repeated prime); then a Boolean algebra |
Diamond | Read from the covers below | No | Yes (each atom has two complements) |
Pentagon | Read from the covers below | No | Yes ( has two complements, and ) |
Covers of the diamond and the pentagon
Lattice | Elements | Covers ( means covers ) |
|---|---|---|
Diamond | , , , , , | |
Pentagon | , , , , |
Facts and tests
A lattice is distributive if and only if it has no sublattice isomorphic to the diamond or the pentagon .
A lattice is modular if implies . It is modular if and only if it has no sublattice isomorphic to . Every distributive lattice is modular; is modular but not distributive.
In a bounded distributive lattice an element has at most one complement.
A Boolean algebra is a complemented distributive lattice. A finite Boolean algebra has elements and is isomorphic to the power set of a -element set.
A finite poset is a lattice when every pair has a join and a meet. Shortcut: a finite poset with a least element in which every pair has a join is a lattice; dually, a finite poset with a greatest element in which every pair has a meet is a lattice.
Lattice laws: idempotent ; commutative; associative; absorption and .
WORKED EXAMPLE
Consider the divisors of under divisibility, and the divisors of under divisibility. Decide for each whether it is a Boolean algebra.
Divisors of 30: is square-free, with divisors; it is a distributive lattice (lcm and gcd) and every divisor has complement , since and .
So the divisors of 30 form a Boolean algebra, isomorphic to .
Divisors of 12: is not square-free; the divisors are .
Take the element : we need with and . Then must be odd, so has only one factor of 2, which cannot be .
So has no complement; the lattice is distributive but not complemented, hence not a Boolean algebra.
Answer: Divisors of 30: Boolean algebra. Divisors of 12: distributive but not complemented, so not a Boolean algebra.
PREVIOUS-YEAR QUESTIONS
Try each question first, then open the answer. We placed each question under a topic ourselves; the exam paper does not label topics.
See these papers in full: GATE CSE 2026 Set 2 · GATE CSE 2025 Set 1 · GATE CSE 2025 Set 2 · GATE CSE 2024 Set 1 · GATE CSE 2024 Set 2 · GATE CSE 2023 · GATE CSE 2020 · GATE CSE 2018
Let be a binary relation on the set , where if the product of and is square of an integer. Which of the following properties is/are satisfied by ?
Reflexive
Symmetric
Transitive
Antisymmetric
is a function from to , is a function from to , and their composition defined as is a mapping from to .
If and are onto (surjective) functions, which ONE of the following is TRUE about the function ?
must be an onto (surjective) function.
must be a one-to-one (injective) function.
must be a bijective function, that is, both one-to-one and onto.
is not required to be a one-to-one or onto function.
Let be the set of all functions from to . Define the binary relation on as follows:
if and only if , where .
Which of the following statement(s) is/are TRUE?
is a symmetric relation
is a partial order
is a lattice
is an equivalence relation
Let and be non-empty finite sets such that there exist one-to-one and onto functions (i) from to and (ii) from to . The number of possible values of is ______
Let be the partial order defined on the set as follows
The number of total orders on that contain is __________
Let be an onto (or surjective) function, where and are nonempty sets. Define an equivalence relation on the set as
where . Let be the set of all the equivalence classes under . Define a new mapping as
Which of the following statements is/are TRUE?
is NOT well-defined.
is an onto (or surjective) function.
is a one-to-one (or injective) function.
is a bijective function.
Let be the set of all binary relations on the set . Suppose a relation is chosen from at random. The probability that the chosen relation is reflexive (round off to 3 decimal places) is ______.
Let be the set of natural numbers. Consider the following sets.
: Set of Rational numbers (positive and negative)
: Set of functions from to
: Set of functions from to
: Set of finite subsets of .
Which of the sets above are countable?
and only
and only
and only
, and only
PRACTICE
How many asymmetric relations are there on a set with exactly 4 elements? (A relation on is asymmetric if implies for all , including .)
Answer:
Asymmetric forces the diagonal pairs out, so no diagonal pair is in .
There are unordered pairs with .
Each has 3 choices: neither, only, or only.
Total .
Let be the set of positive divisors of ordered by divisibility. Which statement is true?
is a lattice, is distributive, and is complemented
is a lattice, is distributive, but is not complemented
is a lattice but is not distributive
is not a lattice
Answer: (B)
Any two divisors have an lcm (join) and a gcd (meet) among the divisors, so is a lattice, and it is distributive because gcd and lcm distribute over each other.
is not square-free, so is not complemented.
Direct check: for we need with and ; the second needs , which contradicts the first.
So the answer is B.
How many surjective functions are there from a set with 4 elements onto a set with 3 elements?
Answer:
Use inclusion-exclusion with , : .
.
Check: .
How many equivalence relations on the set have exactly two equivalence classes?
Answer:
Equivalence relations with exactly two classes correspond to partitions into two non-empty blocks.
The count is .
Check by block sizes: one block of size 1 and one of size 3 gives 4 partitions; two blocks of size 2 gives ; total .
Consider the poset of all subsets of ordered by inclusion. How many edges does its Hasse diagram have?
9
12
16
27
Answer: (B)
An edge joins to for (a cover).
Total edges .
Check by levels: sizes 0 to 1 give 3 edges, 1 to 2 give 6 edges, 2 to 3 give 3 edges, total 12.
Let be the relation on the set of integers defined by if and only if . Which of the following properties does have?
Reflexive
Symmetric
Antisymmetric
Transitive
Answer: (A), (B)
, so is reflexive.
, so is symmetric.
and but , so not antisymmetric.
and but , so not transitive.
Correct options: A and B.
OFFICIAL GATE 2027 SYLLABUS WORDING
Copied from the GATE 2027 syllabus; see all 2027 syllabi.
GATE CS
Sets, relations, functions, partial orders and lattices
Preparing in Kolkata? IAE Academy's course for GATE CSE.