Mathematics · Ch 2 — Relations and Functions
Relations
Relations
2.3 Relations
From Cartesian Product to Relation
When we have two sets, the Cartesian product gives us every possible pairing of elements. But in mathematics, we rarely need all possible pairs — we usually care about pairs that satisfy some specific condition. That subset of the Cartesian product is what we call a relation.
Consider the sets and . Their Cartesian product contains 15 ordered pairs. Now suppose we only want pairs where the first element (a letter) is the first letter of the second element (a name). This gives us:
This set is a relation from to . It is a subset of , and it was obtained by describing a specific relationship between the first and second elements of the ordered pairs.
Formal Definition of a Relation
Definition 2: A relation from a non-empty set to a non-empty set is a subset of the Cartesian product . The subset is derived by describing a relationship between the first element and the second element of the ordered pairs in .
In a relation, the second element of an ordered pair is called the image of the first element. So in the pair , is the image of .
Domain, Range, and Codomain
Every relation comes with three important sets associated with it.
Definition 3: The set of all first elements of the ordered pairs in a relation from a set to a set is called the domain of .
Definition 4: The set of all second elements in a relation from a set to a set is called the range of . The whole set is called the codomain of .
A critical observation: the range is always a subset of the codomain. Not every element of needs to appear as the second element of some ordered pair in , but every second element that does appear must belong to .
Range Codomain. The domain is a subset of , and the range is a subset of (the codomain).
Representing Relations
Relations can be represented in three ways:
- Roster form — listing all ordered pairs explicitly within curly braces.
- Set-builder form — describing the condition that defines the relation.
- Arrow diagram — a visual representation where arrows connect elements of the domain to their images in the codomain.
Counting Relations
Since a relation from to is simply a subset of , the number of possible relations equals the number of subsets of .
If and , then , and the total number of relations from to is .
Example 9: Counting Relations Between Small Sets
Let and .
First, . So . …
A relation from a non-empty set to a non-empty set is any subset of the Cartesian product .
That is, .
The subset is formed by picking only those ordered pairs from for which a specific condition or relationship holds between (the first element) and (the second element).
The second element in such an ordered pair is called the image of the first element .
If and are the same set, we often say " is a relation on " instead of "from to ".
Intuition: A relation is like a filter on the full list of all possible pairings — you keep only those pairs where the two things are connected in a particular way.
Example:
Let and .
Then .
Define a relation by the rule " is one more than " (i.e. ). …
The domain of a relation from a set to a set is the set of all first elements of the ordered pairs that belong to .
In other words, if and you list every ordered pair in , then the domain is the collection of all the 's that actually appear in those pairs. The textbook (Definition 3) states this exactly: "The set of all first elements of the ordered pairs in a relation from a set to a set is called the domain of the relation ."
Intuition: Think of a relation as a set of connections — each connection is an arrow from some element of to some element of . The domain is simply the group of "starting points" from that actually have at least one arrow leaving them. Not every element of needs to be in the domain; only those that are used as a first coordinate in some ordered pair of . …
Definition 4 states: The set of all second elements in a relation from a set to a set is called the range of the relation . The whole set is called the codomain of the relation . Note that .
In other words, if is a relation, then:
- Range of = .
- Codomain of = the entire set (given in advance, regardless of which elements actually appear in ).
The range is always a subset of the codomain — it collects only those second elements that actually get paired with some first element. The codomain is the full target set, which may contain elements that never appear as a second element in any ordered pair of .
Intuition: Think of a relation as a matching between two groups. The codomain is the whole group on the right side; the range is just the set of people from that group who actually get matched.
Concrete example (from Example 7 of the textbook):
Let and define . Then:
- . …
Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.
What Fig. 2.4 Shows
The arrow diagram presents two sets side by side. On the left is set , written inside an oval. On the right is set , inside another oval. Indigo arrows connect elements of to elements of according to a specific rule: points to Ali, points to both Bhanu and Binoy, and points to Chandra. Divya receives no arrow at all.
This is not just a random collection of arrows. The diagram is a visual representation of a relation — a subset of the Cartesian product . The rule that decides which arrows exist is: is the first letter of the name . So is the first letter of Ali, is the first letter of both Bhanu and Binoy, and is the first letter of Chandra. Divya starts with D, which is not in , so no arrow reaches her.
The arrow diagram makes two key ideas immediately visible. First, a relation can map one element of to multiple elements of (like mapping to two names). Second, not every element of needs to be the image of something — Divya is in the codomain but not in the range.
The Physical Idea
The figure teaches that a relation is fundamentally a matching rule between two sets. The Cartesian product contains all 15 possible ordered pairs, but the relation picks out only those pairs that satisfy the given condition. The arrow diagram shows this selection at a glance: each arrow corresponds to one ordered pair in the relation.
The textbook then formalises this into three definitions. The domain is the set of all first elements that actually appear in the relation — here , which happens to be the whole of . The range is the set of all second elements that receive arrows — . The codomain is the entire set , which includes Divya even though she is not related to any element of .
The range is always a subset of the codomain, but they need not be equal. In this figure, range codomain because Divya is in but not in the relation.
The Key Formula
The central result that this figure introduces is the number of possible relations between two finite sets. If and , then:
Why ? A relation is a subset of . The Cartesian product has ordered pairs. For each pair, you have two choices: include it in the relation or leave it out. So the total number of distinct relations equals the number of subsets of a set with elements, which is . …
Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.
Fig 2.5 is the arrow diagram for the relation defined on the set . The diagram uses two vertical lists (often drawn as ovals or columns) of the numbers 1 through 6, placed side by side. The left list represents the domain (the set of first elements ), and the right list represents the codomain (the set of possible second elements , which is also here).
From each element in the left list, an arrow slants downward to the right, pointing to the element in the right list that is exactly one more. So you see arrows: , , , , . The element on the left has no arrow leaving it — because , and is not in the set . This visual gap is the whole point of the figure: it shows that a relation need not pair every element of the domain with an image.
The relation itself is given by the rule , which generates the ordered pairs . The arrow diagram makes it instantly clear that the domain is (the elements that actually have arrows), the range is (the elements that receive arrows), and the codomain is the full set .
The arrow diagram teaches a core distinction: the domain is the set of first elements that actually appear in the relation, not necessarily the whole set . Here is in but not in the domain. Similarly, the range is a subset of the codomain — here is in the codomain but never appears as an image.
The central formula the textbook develops with this figure is simply the rule defining the relation:
…
Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.
Fig 2.6 is an arrow diagram that shows a relation between two sets, P and Q. The set P is written on the left as a slate oval containing the numbers 9, 4, and 25. The set Q is on the right as another slate oval containing the numbers 5, 3, 2, 1, −2, −3, and −5. Crossing indigo arrows connect elements of P to elements of Q: 9 points to both 3 and −3, 4 points to both 2 and −2, and 25 points to both 5 and −5. The element 1 in Q has no arrow coming to it from any element of P.
The relation shown is “x is the square of y”. In set-builder form, this is written as
In roster form, the relation is
The domain of this relation is the set of all first elements: . The range is the set of all second elements that actually appear: . The codomain is the whole set Q, which includes 1 as well — but 1 has no pre-image in P, so it is not part of the range.
A common mistake is to think the range must equal the codomain. Here, the codomain Q has seven elements, but the range has only six. The element 1 is in the codomain but not in the range, because no arrow lands on it. …
Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.
Fig 2.7 is the arrow diagram for the relation defined by between the sets and . The diagram shows two ovals: the left oval labelled contains the numbers 5, 6, 7; the right oval labelled contains 3, 4, 5. Three horizontal arrows run from left to right, each connecting an element of to its image in : , , and .
The physical idea is straightforward: each element in is related to exactly one element in through the rule "subtract 2". This is a relation — a subset of the Cartesian product . In roster form, the relation is
In set-builder form, it is
From the diagram you can read off the three key sets:
- Domain = (all first elements, i.e., the entire set ).
- Range = (all second elements that actually appear; here it equals ).
- Codomain = (the whole set ).
In this example the range and codomain are the same set, but that is not always true. The range is always a subset of the codomain — never larger. …