Skip to content

Fundamentals of Business Mathematics and Statistics · Set Theory, including Venn Diagram

Relations and Cartesian Product: Domain and Range Explained

Updated 10 October 2026 · Fact-checked

The Cartesian product A × B is the set of all ordered pairs (a, b) with a in A and b in B. A relation from A to B is any subset of A × B. Its domain is the set of first elements and its range is the set of second elements.

Understand Relations and Cartesian Product

An ordered pair (a, b) is two objects written in a fixed order. The pair (2, 3) is not the same as (3, 2). Two ordered pairs are equal only when their first elements match and their second elements match.

The Cartesian product of sets A and B, written A × B, is the set of all ordered pairs (a, b) where a ∈ A and b ∈ B. Think of it as pairing every member of A with every member of B. If A = {1, 2} and B = {x, y}, then A × B = {(1, x), (1, y), (2, x), (2, y)}.

In general A × B and B × A are different sets. They have the same number of pairs, but the pairs are written in a different order. They are equal only when A = B, or when one of the sets is empty (both products are then empty).

A relation R from A to B is any subset of A × B. You choose some of the pairs, using a rule such as "a is less than b". The domain of R is the set of all first elements of the pairs in R. The range is the set of all second elements of the pairs in R. The set B is called the codomain, and the range is always a subset of it.

If you pick pairs from A × A, you get a relation on A. Questions in this topic are mostly about listing pairs, counting pairs and reading off domain and range.

Key formulas to remember

Cartesian product
A × B = {(a, b) : a ∈ A, b ∈ B}
Order matters. In general A × B ≠ B × A.
Number of elements in A × B
n(A × B) = n(A) × n(B)
Holds for finite sets. If either set is empty, the product is empty.
Number of relations from A to B
2^(m × n), where m = n(A) and n = n(B)
A relation is a subset of A × B, and a set with mn elements has 2^(mn) subsets. This count includes the empty relation and A × B itself.
Domain and range of a relation R
Domain = {a : (a, b) ∈ R}; Range = {b : (a, b) ∈ R}
Range is a subset of the codomain B. It need not equal B.
Equality of ordered pairs
(a, b) = (c, d) if and only if a = c and b = d
Use this to find unknown values from given equal pairs.
Product with itself
n(A × A) = [n(A)]²
The number of relations on A is then 2^([n(A)]²).

How to solve Relations and Cartesian Product questions

Use this method for any question on Cartesian products or relations.

  1. 1Write down the sets and count their elements, m = n(A) and n = n(B).
  2. 2If the question only asks for a count, use n(A × B) = mn or the number of relations 2^(mn). Stop there.
  3. 3If you must list A × B, fix one element of A and pair it with every element of B. Then move to the next element of A.
  4. 4Check the count of your listed pairs against mn.
  5. 5For a relation, read the rule and test each pair of A × B. Keep only the pairs that satisfy it.
  6. 6Domain: collect the first elements of the kept pairs. Range: collect the second elements. Write each as a set without repeats.
  7. 7If the question gives equal ordered pairs, match first with first and second with second to find unknowns.
  8. 8Compare your result with the options and check order, brackets and repeated elements.

Quickest way: Count first, list only if needed

When to use it: Use it when the options are numbers, or when the options are sets of pairs that differ in size.

  1. Find m and n from the sets. Compute mn for the number of pairs in A × B.
  2. For the number of relations, compute 2 raised to mn. Do not list anything.
  3. If options are lists of pairs, reject any option whose number of pairs is not mn (for a product).
  4. Then check the first element of each pair against A and the second against B. One wrong pair eliminates an option.
  5. For domain and range, scan the pairs once. Underline first elements for domain and second elements for range.

Common mistakes in Relations and Cartesian Product

  • Treating A × B and B × A as the same set.

    Both have the same number of pairs, so they look alike.

    Fix: Check the order in each pair. In A × B the first element always comes from A.

  • Writing the number of relations as m × n instead of 2^(mn).

    Students confuse the number of pairs in A × B with the number of subsets of it.

    Fix: A relation is a subset of A × B. Find mn first, then take 2 to that power.

  • Repeating elements in the domain or range.

    The same element can appear in several pairs, and students copy it each time.

    Fix: A set lists each element once. Write each value one time.

  • Taking the range to be the whole set B.

    The words range and codomain are mixed up.

    Fix: The range contains only second elements that actually appear in R. It may be smaller than B.

  • Writing pairs in the wrong order or missing a pair when listing A × B.

    Listing without a system.

    Fix: Fix one element of A, pair it with all of B, then move on. Then check the count equals mn.

  • Forgetting that the empty relation and A × B itself are both relations.

    Students count only proper, non-empty subsets.

    Fix: Every subset counts, so the total is exactly 2^(mn).

Worked examples

Example 1

Let A = {1, 2, 3} and B = {4, 5}. Find n(A × B) and the number of relations from A to B.

Show the solution
  1. n(A) = 3 and n(B) = 2.
  2. n(A × B) = 3 × 2 = 6.
  3. A relation is a subset of A × B, which has 6 elements.
  4. Number of subsets = 2^6 = 64.

Answer: n(A × B) = 6 and the number of relations from A to B is 64.

Example 2

Let A = {1, 2, 3, 4} and R be the relation from A to A defined by R = {(a, b) : b = a + 1}. Find R, its domain and its range.

Show the solution
  1. Test each a in A: a = 1 gives b = 2, which is in A. So (1, 2) is in R.
  2. a = 2 gives b = 3, so (2, 3) is in R.
  3. a = 3 gives b = 4, so (3, 4) is in R.
  4. a = 4 gives b = 5, which is not in A. So no pair for a = 4.
  5. R = {(1, 2), (2, 3), (3, 4)}.
  6. Domain = first elements = {1, 2, 3}.
  7. Range = second elements = {2, 3, 4}.

Answer: R = {(1, 2), (2, 3), (3, 4)}; domain = {1, 2, 3}; range = {2, 3, 4}.

Exam tips

  • Count-based questions are the fastest marks. Memorise n(A × B) = mn and 2^(mn) and answer in seconds.
  • When options list pairs, first check the number of pairs, then the order of each pair.
  • Watch for questions that ask for domain or range of a relation given as a list of pairs. Read only the first or second entries and drop repeats.
  • If a question gives equal ordered pairs with unknowns such as (x + 1, 3) = (4, y), match positions directly.
  • With no negative marking, always attempt every question. Eliminate options by count before guessing.

Practice questions from Set Theory, including Venn Diagram

Relations and Cartesian Product: frequently asked questions

What is the Cartesian product of two sets?

It is the set of all ordered pairs (a, b) with a from the first set and b from the second. For A = {1, 2} and B = {3}, A × B = {(1, 3), (2, 3)}.

What is the formula for the number of relations from A to B?

If A has m elements and B has n elements, the number of relations is 2^(mn). This is because each relation is a subset of A × B, which has mn elements. The count includes the empty relation.

How do I find the domain and range of a relation?

List the pairs in the relation. The domain is the set of first elements and the range is the set of second elements. Write each value only once.

Is A × B equal to B × A?

Not in general, because the order inside each pair differs. They are equal when A = B, or when both are empty because one of the sets is empty.