- Practice
- About 15 min
- 5 practice questions
Relations: domain, co-domain and range
Recognise a relation from A to B as a subset of A × B, write it in roster form, set-builder form and as an arrow diagram, find its domain, co-domain and range, and count the relations between two finite sets.
If something looks wrong, please tell us.
By the end of this lesson you can
- Decide whether a given set of ordered pairs is a relation from A to B.
- Write a relation described in words in roster form and set-builder form, and draw its arrow diagram.
- Find the domain, co-domain and range of a relation, and count all possible relations from A to B.
'Is the capital of', 'is less than', 'is a factor of', 'is perpendicular to': everyday language and mathematics are full of rules that connect one object with another. Mathematics records each such connection as an ordered pair, and the collection of pairs that obey the rule is called a relation.
Definition of a relation
Let A and B be non-empty sets. A relation R from A to B is a subset of A × B made of the pairs that satisfy some stated condition. If (x, y) ∈ R we say x is related to y and write x R y. A relation from A to A is called a relation on A.
- Domain of R: the set of first coordinates that actually appear in R. It is a subset of A.
- Co-domain of R: the whole set B.
- Range of R: the set of second coordinates that actually appear in R. It is a subset of B.
R ⊆ A × B. Domain of R ⊆ A, co-domain of R = B, range of R ⊆ B.
Worked example 1: 'is a factor of'
Let A = {2, 3, 4} and B = {4, 6, 8, 9}. Define x R y if x is a factor of y. Working: test each element of A against each element of B. 2 divides 4, 6 and 8 (not 9). 3 divides 6 and 9. 4 divides 4 and 8. So in roster form R = {(2, 4), (2, 6), (2, 8), (3, 6), (3, 9), (4, 4), (4, 8)}. Domain = {2, 3, 4}; co-domain = B = {4, 6, 8, 9}; range = {4, 6, 8, 9}. Here every element of B is reached, so the range equals the co-domain.
Worked example 2: a rule given as an equation
Let A = {4, 5, 6, 7} and B = {1, 2, 3, 5}. R = {(x, y) | y = x − 3, x ∈ A, y ∈ B}. Working: x = 4 gives y = 1 ∈ B; x = 5 gives y = 2 ∈ B; x = 6 gives y = 3 ∈ B; x = 7 gives y = 4, which is not in B, so 7 has no partner. Roster form: R = {(4, 1), (5, 2), (6, 3)}. Domain = {4, 5, 6}, a proper subset of A. Range = {1, 2, 3}, a proper subset of the co-domain B. The rule 'y = x − 3, x ∈ A, y ∈ B' is the set-builder form.
Ways to show a relation
-
Roster form
- List the ordered pairs inside { }
- Example: {(4, 1), (5, 2), (6, 3)}
-
Set-builder form
- State the rule the pairs obey
- Example: {(x, y) | y = x − 3, x ∈ A, y ∈ B}
-
Arrow diagram
- Two ovals for A and B
- An arrow from x to y for each pair
-
Graph
- Plot each pair (x, y) as a point
- Useful when A and B are sets of numbers
Worked example 3: is it a relation?
Let A = {1, 2, 3} and B = {a, b}. Is S = {(1, a), (3, b), (b, 2)} a relation from A to B? Working: (1, a) and (3, b) are in A × B, but (b, 2) has its first coordinate b ∉ A. So S ⊄ A × B and S is not a relation from A to B. One wrong pair is enough to fail.
The null relation
A relation can be empty. Let A = {1, 2} and B = {5, 6} with x R y if x + y = 20. No pair adds to 20, so R contains no element: R = ∅. A relation with no element is called the null relation. Since ∅ is a subset of every set, it is always a relation.
How many relations are there?
Every subset of A × B is a relation from A to B. If n(A) = m and n(B) = n, then A × B has mn elements, and a set with mn elements has 2ᵐⁿ subsets. So there are 2ᵐⁿ relations from A to B, and 2ᵐⁿ − 1 of them are non-empty.
Worked example 4: counting relations
If A = {p, q} and B = {1, 2, 3}, how many relations are there from A to B? Working: n(A × B) = 2 × 3 = 6, so the number of relations is 2⁶ = 64. Leaving out the null relation, 63 are non-empty.
| n(A) | n(B) | n(A × B) | Number of relations 2ᵐⁿ |
|---|---|---|---|
| 1 | 2 | 2 | 2² = 4 |
| 2 | 2 | 4 | 2⁴ = 16 |
| 2 | 3 | 6 | 2⁶ = 64 |
| 3 | 3 | 9 | 2⁹ = 512 |
Key takeaways: a relation from A to B is any subset of A × B, usually picked out by a rule. Its domain is the set of first coordinates used, its range the set of second coordinates used, and its co-domain is all of B. A relation can be shown in roster form, set-builder form, an arrow diagram or a graph. The empty set is the null relation, and there are 2ᵐⁿ relations in all when n(A) = m and n(B) = n.
Check your understanding
-
1. If n(A) = 3 and n(B) = 2, how many relations are there from A to B?
- 6
- 8
- 64
- 9
Show answer
Answer: C. n(A × B) = 3 × 2 = 6, and every subset of A × B is a relation, so there are 2⁶ = 64 relations.
-
2. Let A = {1, 2, 3} and B = {3, 4}. Which set is a relation from A to B?
- {(3, 1)}
- {(1, 3), (2, 4)}
- {(1, 4), (4, 1)}
- {(2, 5)}
Show answer
Answer: B. Both (1, 3) and (2, 4) have first coordinate in A and second in B, so the set is a subset of A × B. (3, 1) and (4, 1) have second coordinate 1 ∉ B or first coordinate 4 ∉ A, and 5 ∉ B.
-
3. R = {(x, y) | y = x + 2, x ∈ {1, 2, 3, 4}}. What is the range of R?
- {1, 2, 3, 4}
- {2, 4, 6, 8}
- {3, 4, 5}
- {3, 4, 5, 6}
Show answer
Answer: D. Find y for each x: 1 + 2 = 3, 2 + 2 = 4, 3 + 2 = 5, 4 + 2 = 6. The range is the set of second coordinates, {3, 4, 5, 6}. {1, 2, 3, 4} is the domain.
-
4. A = {1, 2, 3}, B = {a, b} and R = {(1, a), (1, b), (3, a)}. What is the domain of R?
- {1, 3}
- {1, 2, 3}
- {a, b}
- {1}
Show answer
Answer: A. The domain is the set of first coordinates that appear: 1, 1 and 3, so {1, 3}. The element 2 of A is not related to anything, so it is not in the domain.
-
5. There are 1024 relations from a set A with 5 elements to a set B. How many elements does B have?
- 5
- 2
- 10
- 4
Show answer
Answer: B. If n(B) = n, the number of relations is 2^(5n). Since 1024 = 2¹⁰, 5n = 10 and n = 2.
Sign in to keep track of the lessons you finish.