Relations and Functions · Lesson 2 of 5
Relations, Domain, Range and Codomain
“Select the pairs that satisfy a relationship and describe precisely where their entries come from.”
• Express a relation as a subset of a Cartesian product. • Translate between a rule, roster form and an arrow diagram. • Distinguish the domain, range and codomain of a relation. • Use restrictions in the two sets when selecting pairs. • Count relations between finite sets and explain the counting argument.
Selecting pairs by a relationship
A Cartesian product lists every possible pair, but a relationship usually selects only some of them. Imagine matching letters to names that begin with those letters. You do not want every letter paired with every name; you want the pairs that satisfy the stated condition.
Take P = {a, b, c} and Q = {Ali, Bhanu, Binoy, Chandra, Divya}. Their product has fifteen pairs. If the first entry records the initial letter of the second entry, the selected pairs are (a, Ali), (b, Bhanu), (b, Binoy) and (c, Chandra). We treat the initials without case distinctions in this example. Divya is not selected because d is absent from P.
A relation R from A to B is a subset of A × B. A stated condition may specify which pairs are included, but any subset—including the empty subset—is a relation.
Roster form lists the selected pairs inside braces. Set-builder form describes a condition: R = {(x, y) ∈ P × Q : x is the initial letter of y}. The two forms describe the same set. An arrow diagram provides a third view: draw the sets separately and draw an arrow for each selected pair.
The direction of an arrow matters. An arrow from b to Bhanu records (b, Bhanu), not (Bhanu, b). If (x, y) belongs to a relation, y is called an image of x under that relation. At this stage an entry may have no image, one image or several images.
Domain, range and codomain
Three sets help us describe a relation. The declared destination set tells us which second entries are allowed. The actual selected pairs tell us which first and second entries are used. Keeping these roles separate prevents a common source of confusion.
The domain is the set of first entries that actually occur in the relation’s ordered pairs.
The range is the set of second entries that actually occur in the relation’s ordered pairs.
For a relation declared from A to B, the codomain is the whole set B. It includes all allowed second entries, whether or not they occur in a selected pair.
| Set | How to identify it | In the initial-letter relation |
|---|---|---|
| Domain | Collect first entries used by pairs | {a, b, c} |
| Range | Collect second entries used by pairs | {Ali, Bhanu, Binoy, Chandra} |
| Codomain | Read the declared destination set | {Ali, Bhanu, Binoy, Chandra, Divya} |
The range is always a subset of the codomain, written range ⊆ B. It may equal B or be smaller. A relation’s domain is similarly a subset of its starting set A, but need not equal A. Repeated entries are written just once when collecting a domain or range, because these are sets.
A roster determines the domain and range, but several declared destination sets can contain that same range. You need the statement “from A to B” to know the codomain. Do not automatically rename the range as the codomain.
A rule must respect both sets
A formula is not permission to use entries outside the stated sets. When a rule proposes a second entry, check that the entry belongs to the destination set. This check can remove some first entries from the domain of the relation.
Problem
Let A = {1, 2, 3, 4, 5, 6}. Define R from A to A by y = x + 1. Find its pairs, domain, range and codomain.
- 1.For x = 1, 2, 3, 4 and 5, the proposed values y are 2, 3, 4, 5 and 6. All belong to A.
- 2.For x = 6, the proposed value is 7. Since 7 is not in A, (6, 7) is not a pair in this relation.
- 3.Thus R = {(1, 2), (2, 3), (3, 4), (4, 5), (5, 6)}. The domain is {1, 2, 3, 4, 5}, and the range is {2, 3, 4, 5, 6}.
- 4.The codomain is the whole declared set A, including 1. Notice that 6 is allowed as a starting element but is not actually used as a first entry.
Problem
Let P = {4, 9, 25} and Q = {−5, −3, −2, 1, 2, 3, 5}. Define R from P to Q by x = y².
- 1.For first entry 4, both y = 2 and y = −2 satisfy y² = 4. For 9, y = 3 and y = −3 work. For 25, y = 5 and y = −5 work.
- 2.Roster form is R = {(4, 2), (4, −2), (9, 3), (9, −3), (25, 5), (25, −5)}. Set-builder form is {(x, y) ∈ P × Q : x = y²}.
- 3.The domain is {4, 9, 25}. The range is {−5, −3, −2, 2, 3, 5}. The codomain is Q, which also contains the unused entry 1.
- 4.The rule says the first entry is the square of the second. Replacing it by y = x² would describe a different relation.
Problem
Let A = {1, 2, 3, 5}, B = {4, 6, 9}, and select pairs for which x − y is odd.
- 1.The difference of two integers is odd precisely when one is odd and the other is even. Negative odd differences also count as odd.
- 2.The odd first entries 1, 3 and 5 therefore pair with the even second entries 4 and 6. The even first entry 2 pairs with the odd second entry 9.
- 3.R = {(1, 4), (1, 6), (3, 4), (3, 6), (5, 4), (5, 6), (2, 9)}. Its domain is all of A and its range is all of B.
A relation from A to A is called a relation on A. For instance, “the second entry is divisible by the first” defines a relation on a set of positive integers. Each a is related to itself because a/a = 1 is an integer. That observation may help identify its domain and range without listing every pair. By contrast, a rule using prime numbers smaller than 10 selects only 2, 3, 5 and 7 before any calculation is performed.
Problem
On ℤ, define R = {(a, b) : a − b is an integer}. Find the domain and range.
- 1.ℤ is the set of integers: ..., −2, −1, 0, 1, 2, .... Subtracting any two integers gives an integer.
- 2.Every pair in ℤ × ℤ satisfies the condition, so R = ℤ × ℤ.
- 3.Every integer occurs as a first entry and as a second entry—for example in (a, a). Both domain and range are ℤ. A rule can select the whole product rather than a smaller subset.
Counting all possible relations
Counting pairs answers how many choices are available. Counting relations answers how many different selections of those choices are possible. Since a relation is a subset, each available pair independently has two possibilities: include it or leave it out.
If A has p elements and B has q elements, their product has pq pairs. For each of these pq pairs make an include-or-exclude decision. Multiplying the two choices for every pair gives 2 raised to pq. The empty relation and the full product are both included in this count.
Problem
Take A = {1, 2} and B = {3, 4}. How many relations go from A to B?
- 1.A × B = {(1, 3), (1, 4), (2, 3), (2, 4)}, so there are four available pairs.
- 2.Each pair has two independent inclusion choices. There are 2⁴ = 16 possible relations.
- 3.For example, ∅, {(1, 3)} and the whole product are three of the sixteen relations. We are counting sets of pairs, not the four pairs themselves.
Knowing that there are sixteen possible relations does not tell you which pairs one chosen relation contains. It also does not tell you whether that chosen relation is a function; that needs a separate check of its pairs and declared starting set.
Quiz
For R = {(1, 4), (2, 4)} from {1, 2, 3} to {4, 5}, what is its domain?
For that same relation, which is the codomain?
Which statement about a relation from A to B is always true?
A has 3 elements and B has 2 elements. How many relations go from A to B?
On A = {1, 2, 3}, the rule y = x + 1 selects which pairs?
What does an arrow from 9 to −3 represent?
Practice Problems
- On A = {1, 2, ..., 14}, select pairs satisfying y = 3x. List the relation and distinguish its domain, range and codomain.
- For x a natural number less than 4, write {(x, x + 5)} in roster form and identify its domain and range. Take natural numbers as 1, 2, 3, ....
- On A = {1, 2, 3, 4, 6}, select (a, b) when b is divisible by a. List all pairs and explain why both domain and range equal A.
- For prime x less than 10, list pairs (x, x³). Explain why composite numbers are excluded before applying the cube rule.
- Draw a relation from {p, q, r} to {1, 2, 3, 4} whose domain is {p, r} and range is {2, 4}. Give its roster form.
- How many relations go from a four-element set to a two-element set? Distinguish the number of pairs from the number of relations.
- Give two different codomains compatible with the relation {(1, 2), (3, 4)}. Explain what stays fixed and what changes.
Key Takeaways
• A relation is any subset of a Cartesian product, described by pairs, a rule or arrows. • Domain and range collect entries actually used; the codomain is the declared destination set. • A relation may leave starting elements unused or give one element several images. • Check both set restrictions before including a pair selected by a rule. • With p and q elements in the two sets, there are pq available pairs and 2^(pq) possible relations.