- Foundation
- About 16 min
- 5 practice questions
Relations: domain, codomain and range
Define a relation as a subset of A × B, write it in roster and set-builder form or as an arrow diagram, find its domain, codomain and range, and count all relations from A to B.
If something looks wrong, please tell us.
By the end of this lesson you can
- Define a relation from A to B as a subset of A × B.
- Write a relation in roster form and set-builder form, and read an arrow diagram.
- Find the domain, codomain and range of a relation.
- Use the fact that there are 2^(pq) relations from a set with p elements to a set with q elements.
In daily life we speak of relations such as is the mother of or is taller than. In mathematics we meet is less than, divides, is the square of. Each relation picks out certain ordered pairs from a Cartesian product: exactly the pairs whose first and second elements are related.
What a relation is
A relation R from a non-empty set A to a non-empty set B is a subset of A × B. The subset is chosen by a rule connecting the first element x and the second element y of a pair. If (x, y) ∈ R, we say x is related to y, and y is called the image of x. A relation from A to A is called a relation on A.
| Term | Meaning |
|---|---|
| Domain | The set of all first elements of the pairs in R |
| Range | The set of all second elements of the pairs in R |
| Codomain | The whole of the second set B |
| Image of x | Any y with (x, y) ∈ R |
Since every second element comes from B, range ⊂ codomain. The range can be smaller than the codomain, because some elements of B may not be the image of anything.
A relation can be shown in three ways: in roster form as a list of pairs, in set-builder form by stating the rule, and as an arrow diagram, in which the two sets are drawn as ovals and an arrow joins x to y whenever (x, y) ∈ R.
Parts of a relation R from A to B
-
Domain
Elements of A that have at least one arrow leaving them.
- Always a subset of A
-
Codomain
The whole set B.
- Fixed when R is defined
-
Range
Elements of B that receive at least one arrow.
- Range ⊂ codomain
- Collection of all images
Worked example 1: a rule on a finite set
Let A = {1, 2, 3, 4, 5, 6, 7, 8, 9} and define R on A by R = {(x, y) : y = 2x + 1}. Working: test x = 1, 2, 3, ...: y = 3, 5, 7, 9, 11, .... Only images inside A are allowed, so R = {(1, 3), (2, 5), (3, 7), (4, 9)}. Domain = {1, 2, 3, 4}, range = {3, 5, 7, 9}, and codomain = A = {1, 2, ..., 9}. Notice that 5 is not in the domain: 2 × 5 + 1 = 11 is outside A.
Worked example 2: an element with two images
Let P = {1, 4, 16} and Q = {−4, −2, −1, 1, 2, 3, 4} and let R = {(x, y) : x = y², x ∈ P, y ∈ Q}. Working: 1 = (−1)² = 1², 4 = (−2)² = 2², 16 = (−4)² = 4². So R = {(1, −1), (1, 1), (4, −2), (4, 2), (16, −4), (16, 4)}. Domain = {1, 4, 16}; range = {−4, −2, −1, 1, 2, 4}; codomain = Q. The element 3 of Q is not an image, so the range is a proper subset of the codomain. Each element of P has two images here, and that is allowed in a relation.
Worked example 3: divisibility
Let A = {2, 3, 4, 6} and R = {(a, b) : a, b ∈ A and a divides b exactly}. Working: 2 divides 2, 4 and 6; 3 divides 3 and 6; 4 divides 4; 6 divides 6. So R = {(2, 2), (2, 4), (2, 6), (3, 3), (3, 6), (4, 4), (6, 6)}. Domain = {2, 3, 4, 6} and range = {2, 3, 4, 6}.
How many relations are there?
Every subset of A × B is a relation from A to B, including φ and A × B itself. If n(A) = p and n(B) = q, then n(A × B) = pq, and a set with pq elements has 2^(pq) subsets. So the total number of relations from A to B is 2^(pq).
A relation from A to B is any subset of A × B. If n(A) = p and n(B) = q, there are 2^(pq) relations from A to B.
Worked example 4: counting relations
Let A = {a, b, c} and B = {0, 1}. Working: n(A × B) = 3 × 2 = 6, so there are 2⁶ = 64 relations from A to B.
Worked example 5: a relation on Z
Let R be the relation on Z given by R = {(a, b) : a − b is even}. Then (a, a) ∈ R for every integer a, because a − a = 0 is even. If (a, b) ∈ R then b − a = −(a − b) is also even, so (b, a) ∈ R. And if (a, b) and (b, c) are in R, then a − c = (a − b) + (b − c) is a sum of two even numbers, so it is even and (a, c) ∈ R. For instance (9, 3) ∈ R, since 9 − 3 = 6, but (9, 4) ∉ R, since 9 − 4 = 5 is odd.
Key takeaways: a relation is a subset of A × B picked out by a rule; the domain is the set of first elements, the range the set of second elements, and the codomain is all of B, with range ⊂ codomain. One element may have several images in a relation. There are 2^(pq) relations from A to B.
Check your understanding
-
1. Let A = {1, 2, 3, ..., 20} and R = {(x, y) : y = 4x, x, y ∈ A}. What is the range of R?
- {1, 2, 3, 4, 5}
- {4, 8, 12, 16, 20}
- {4, 8, 12, 16, 20, 24}
- {1, 2, 3, ..., 20}
Show answer
Answer: B. x = 1 to 5 give y = 4, 8, 12, 16, 20, all in A; x = 6 gives 24, which is not. So the domain is {1, 2, 3, 4, 5} and the range is {4, 8, 12, 16, 20}.
-
2. For a relation R from A to B, which statement is always true?
- Range = codomain
- Codomain ⊂ range
- Range ⊂ codomain
- Domain = A
Show answer
Answer: C. Every image lies in B, which is the codomain, so range ⊂ codomain. Some elements of B may receive no arrow, so the range can be smaller. The domain need not be all of A.
-
3. If n(A) = 2 and n(B) = 3, how many relations are there from A to B?
- 6
- 9
- 32
- 64
Show answer
Answer: D. n(A × B) = 2 × 3 = 6, and each subset of A × B is a relation, so the number of relations is 2⁶ = 64.
-
4. Let A = {2, 3, 4, 7} and B = {5, 8, 10}, and R = {(x, y) : x + y is even, x ∈ A, y ∈ B}. Which pair is in R?
- (2, 5)
- (3, 8)
- (4, 10)
- (7, 10)
Show answer
Answer: C. 4 + 10 = 14, which is even, so (4, 10) ∈ R. The others give 2 + 5 = 7, 3 + 8 = 11 and 7 + 10 = 17, all odd.
-
5. Let R = {(x, 2x − 1) : x ∈ {1, 2, 3, 4}}. What are the domain and range of R?
- Domain {1, 2, 3, 4}, range {1, 3, 5, 7}
- Domain {1, 3, 5, 7}, range {1, 2, 3, 4}
- Domain {1, 2, 3, 4}, range {2, 4, 6, 8}
- Domain {1, 2, 3, 4}, range {1, 2, 3, 4}
Show answer
Answer: A. The first elements are x = 1, 2, 3, 4, so that is the domain. The images 2x − 1 are 1, 3, 5 and 7, so the range is {1, 3, 5, 7}. Doubling without subtracting 1 would wrongly give {2, 4, 6, 8}.
Sign in to keep track of the lessons you finish.