Cartesian Products and Relations: Domain, Co-domain, Range and Counting
Updated 17 October 2026 · Fact-checked
The Cartesian product A × B is the set of all ordered pairs (a, b) with a ∈ A and b ∈ B, and n(A × B) = n(A)·n(B). A relation from A to B is any subset of A × B, so there are 2^{mn} relations when n(A) = m and n(B) = n. The domain is the set of first elements, the range is the set of second elements, and the co-domain is B.
Understand Cartesian Products, Relations, Domain and Range
Ordered pairs. (a, b) = (c, d) if and only if a = c and b = d. The order matters: (1, 2) ≠ (2, 1).
Cartesian product. . If n(A) = m and n(B) = n, then n(A × B) = mn. In general A × B ≠ B × A (unless A = B), but n(A × B) = n(B × A). If either set is empty, the product is empty. If A × B has the pair (a, b) then a ∈ A and b ∈ B; from a given set of ordered pairs one can recover A and B as the sets of first and second elements.
Relations. A relation R from A to B is a subset of A × B. If (a, b) ∈ R we write a R b. The total number of relations from A to B is , since each of the mn pairs is either in or out. A relation on A means from A to A: relations.
Domain, co-domain, range. Domain = set of all first elements; co-domain = the set B; range = set of second elements that actually appear, so range ⊆ co-domain.
Representations. Roster form (list of pairs), set-builder form (a rule) and an arrow diagram.
Inverse relation. : swap each pair. Domain of = range of R and range of = domain of R.
Common rules. "a divides b", "y = x + 1", "x + y is odd" and "x < y" are typical rules defining a relation on a small finite set.
Cartesian Products, Relations, Domain and Range: formulas to remember
- Cartesian product
- $n(A × B) = n(A) · n(B)$
- A × B ≠ B × A in general.
- Number of relations
- $2^{mn}$ from A to B | $2^{n^2}$ on A
- m = n(A), n = n(B).
- Domain and range
- Co-domain is the whole target set.
- Inverse
- $R^{-1} = \{(b, a) : (a, b) ∈ R\}$
- Swap the entries.
Cartesian Products, Relations, Domain and Range in real life
Each concept, met in an everyday situation. Read the situation, try the problem, then check the solution. The one-line hook is what to remember.
Matching students to subjects
Suppose a school has 3 students {Ria, Sam, Tia} and 2 optional subjects {Art, Music}.
Find the number of possible student-subject pairs, and the number of ways a coordinator could define "who studies which" as a relation.
Try it first, then show the solutionSolution
- The product has ordered pairs.
- Each pair is either present or not in the relation: relations.
- Of these, one is empty (nobody studies anything) and one is the full product.
Answer: 6 pairs; 64 relations.
Memory hook: A relation is any subset of A × B.
Tricks to remember Cartesian Products, Relations, Domain and Range
Short memory aids. Say each one aloud once, then use it on a question the same day.
mn pairs, 2^{mn} relations
First count the pairs, then raise 2 to that power.
Use it when: Counting relations.
Swap for the inverse
Domain and range exchange their roles.
Use it when: Inverse relations.
Cartesian Products, Relations, Domain and Range: solved examples
Ordered from board level to HOTS. Try each one before you open the solution.
Example 1: Number of relations · 1 mark · MCQBoard level
If n(A) = 3 and n(B) = 2, the number of relations from A to B is:
(a) 6
(b) 8
(c) 32
(d) 64
Try it first, then show the solutionSolution
- A × B has 6 elements, so there are subsets, that is relations.
Answer: (d) 64
Example 2: A relation by a rule · 3 marks · Short answerBoard level
A = {1, 2, 3} and B = {4, 5}. List A × B and the relation R = {(a, b) : a + b is odd}. Find its domain and range.
Try it first, then show the solutionSolution
- A × B = {(1,4), (1,5), (2,4), (2,5), (3,4), (3,5)}. (1 mark)
- a + b odd: (1,4) → 5, (2,5) → 7, (3,4) → 7, so R = {(1,4), (2,5), (3,4)}. (1 mark)
- Domain = {1, 2, 3}; range = {4, 5}. (1 mark)
Answer: R = {(1,4), (2,5), (3,4)}; domain {1,2,3}; range {4,5}.
Example 3: Inverse relation · 3 marks · Short answerHarder board level
On A = {1, 2, 3, 4}, R = {(x, y) : y = x + 1}. Write R, its domain, co-domain and range, and R⁻¹.
Try it first, then show the solutionSolution
- R = {(1,2), (2,3), (3,4)}. (1 mark)
- Domain {1, 2, 3}; co-domain A = {1, 2, 3, 4}; range {2, 3, 4}. (1 mark)
- R⁻¹ = {(2,1), (3,2), (4,3)}. (1 mark)
Answer: R = {(1,2),(2,3),(3,4)}; R⁻¹ = {(2,1),(3,2),(4,3)}.
Example 4: Recovering sets from a product · 4 marks · Short answerHarder board level
If , find x and y. If A × B = {(1,3), (1,4), (2,3), (2,4)}, find A and B, n(B × A), and the number of relations from A to B.
Try it first, then show the solutionSolution
- Equal ordered pairs: , so ; , so . (1 mark)
- First elements give A = {1, 2}; second elements give B = {3, 4}. (1 mark)
- . (1 mark)
- Number of relations . (1 mark)
Answer: x = 2, y = 3; A = {1,2}, B = {3,4}; n(B × A) = 4; 16 relations.
Example 5: Divisibility relation · 5 marks · Long answerHOTS / competency
A = {1, 2, 3, 4, 5, 6} and R = {(a, b) : a divides b, a, b ∈ A}. List R, find its domain and range, and count the pairs with a < b. What is R⁻¹?
Try it first, then show the solutionSolution
- a = 1: (1,1) to (1,6), 6 pairs; a = 2: (2,2), (2,4), (2,6); a = 3: (3,3), (3,6); a = 4: (4,4); a = 5: (5,5); a = 6: (6,6). (2 marks)
- Total = 6 + 3 + 2 + 1 + 1 + 1 = 14 pairs. (1 mark)
- Domain = A and range = A. (0.5 mark)
- Pairs with a < b = 14 − 6 (the 6 pairs with a = b) = 8. (1 mark)
- R⁻¹ = {(b, a) : a divides b}, that is "b is a multiple of a" on A. (0.5 mark)
Answer: 14 pairs; domain = range = A; 8 pairs with a < b.
Where students lose marks in Cartesian Products, Relations, Domain and Range
The slips examiners see most often, and what to write instead.
Mistake: Counting relations as mn
Giving the number of relations as mn.
Do this: There are mn pairs and relations.
Usually costs: 2 marks.
Mistake: Reading the range as the co-domain
Listing all of B as the range.
Do this: The range contains only the second elements that appear in R.
Usually costs: 1 mark.
Mistake: Not swapping in the inverse
Keeping the same order of the pair.
Do this: R⁻¹ swaps each pair: (a, b) → (b, a).
Usually costs: 1 mark.
Exam tips
- List A × B first, then pick the pairs satisfying the rule.
- Check the domain and range from the list of pairs.
- Quote the formula for the number of relations.
- Use an arrow diagram when the relation is small.
Practice questions on Cartesian Products, Relations, Domain and Range
Write each answer on paper first. Open the hint only if you are stuck, and the answer only when you have finished.
Q1 · 1 mark · MCQBoard level
If A = {a, b} then A × A has how many elements?
(a) 2
(b) 3
(c) 4
(d) 8Hint
.
Answer
(c) 4
Q2 · 2 marks · Short answerBoard level
If A × B has 12 elements and n(A) = 3, find n(B) and the number of relations from A to B.
Hint
Divide first.
Answer
n(B) = 12/3 = 4; relations: .
Q3 · 3 marks · Short answerHarder board level
A = {1, 2, 3, 4, 5} and R = {(x, y) : y = 2x}. Write R, its domain and its range.
Hint
Test each x.
Answer
Pairs: (1,2), (2,4). R = {(1,2), (2,4)}; domain {1, 2}; range {2, 4}.
Q4 · 3 marks · Short answerHarder board level
If R = {(1, 2), (2, 3), (3, 3)} is a relation on {1, 2, 3}, write R⁻¹ and state whether R⁻¹ = R.
Hint
Swap each pair.
Answer
R⁻¹ = {(2,1), (3,2), (3,3)}. It is not equal to R.
Q5 · 3 marks · Short answerHarder board level
Show that A × B ≠ B × A for A = {1, 2} and B = {2, 3}, yet n(A × B) = n(B × A).
Hint
Write both products.
Answer
A × B = {(1,2), (1,3), (2,2), (2,3)}; B × A = {(2,1), (2,2), (3,1), (3,2)}. They are different sets (for instance (1,3) ∈ A × B only) but both have 4 elements.
Q6 · 4 marks · Case-basedHOTS / competency
Case study: Suppose a bus company has 4 routes {P, Q, R, S} and 3 drivers {x, y, z}. A relation T assigns drivers to routes, and the planner lists the allowed pairs.
(i) How many route-driver pairs are possible? (1 mark)
(ii) How many different relations could be defined? (1 mark)
(iii) A planner picks T = {(P, x), (Q, x), (R, y)}. Find its domain and range. (1 mark)
(iv) Write T⁻¹. (1 mark)Hint
Routes are first elements.
Answer
(i) . (ii) . (iii) Domain {P, Q, R}; range {x, y}. (iv) T⁻¹ = {(x, P), (x, Q), (y, R)}.
Test your recall
Answer in your head or on paper first, then open the card. Pulling an answer out of memory makes it stick far better than re-reading.
1.n(A × B)?Show answer
n(A) · n(B).
2.Number of relations from A to B?Show answer
.
3.Range ⊆?Show answer
Co-domain.
4.Inverse relation?Show answer
Swap the pairs.
Cartesian Products, Relations, Domain and Range: frequently asked questions
Is every subset of A × B a relation?
Yes. A relation from A to B is exactly a subset of A × B, including the empty set and A × B itself.
Is the order of elements in an ordered pair important?
Yes. (a, b) and (b, a) are equal only when a = b.
What is the difference between a relation and a function?
A function is a special relation in which every element of the domain has exactly one image; it is the next page.