Home » Math Theory » Algebra » Cartesian Product

Cartesian Product

Quick answer

The Cartesian product A × B of two sets is the set of all ordered pairs (a, b) with a in A and b in B: A × B = {(a, b) : a ∈ A, b ∈ B}. For A = {1, 2} and B = {x, y}, A × B = {(1, x), (1, y), (2, x), (2, y)}. If A has m elements and B has n, then A × B has m × n elements.

Reviewed by the Helping with Math Team · Updated 10 October 2026

What is a Cartesian product?

Cartesian product is the product of any two sets, in an ordered form. This means that the resultant set of the Cartesian product of two sets contains all possible and ordered pairs such that the first element of the pair belongs to the first set and the second element belongs to the second set.

Let us recall what we mean by ordered pair.

An ordered pair consists of two objects or elements in a given fixed order. Let us understand it through an example. Suppose we have A and B as two sets. Then by ordered pair of elements we mean a pair (a, b) in that order, where a ∈ A and b ∈ B. It is important to note here that an ordered pair is not a set consisting of two elements. The ordering of the two elements in an ordered pair is important and the two elements need not be distinct. Now let us learn about the Cartesian product of sets.

How to find a Cartesian product

Let A and B be two non-empty sets. The set of all ordered pairs (a, b) such that a ∈ A and b ∈ B is called the Cartesian product of the sets A and B and is denoted by A × B. Thus,

A × B = {(a, b) : a ∈ A and b ∈ B}

Let us understand it through an example.

Suppose we have two sets, A = {2, 4, 6} and B = {1, 2}, then what would be the value of A × B?

We will have,

A × B = {2, 4, 6} × {1, 2} = {(2, 1), (2, 2), (4, 1), (4, 2), (6, 1), (6, 2)}

A × B12
2(2, 1)(2, 2)
4(4, 1)(4, 2)
6(6, 1)(6, 2)
Rows are the elements of A, columns the elements of B. Each cell is one ordered pair, so there are 3 × 2 = 6 pairs.

What would be the value of B × A?

B × A = {1, 2} × {2, 4, 6} = {(1, 2), (1, 4), (1, 6), (2, 2), (2, 4), (2, 6)}

It can be seen from the above example that to write A × B we take an element from set A and form all ordered pairs with this element as the first element and elements of B as second elements. Next, we choose another element from A and corresponding to each element in B we form ordered pairs with this element as the first element and elements of B as the second element. This process is continued till all elements of A are exhausted.

A × Bxy
1(1, x)(1, y)
2(2, x)(2, y)
3(3, x)(3, y)

n(A × B) = 3 × 2 = 6 ordered pairs. A gives the first number of each pair.

Try it: type up to four short elements in each set (up to 4 characters each), separated by commas. The table lists every ordered pair and counts them. Press Show B × A to see the pairs flip.

Let us consider another example.

Example If A = {a, b} and B = {1, 2, 3}, find A × B, B × A, A × A, B × B and (A × B) ∩ (B × A)

Solution We have been given the sets, A = {a, b} and B = {1, 2, 3}. We need to find A × B, B × A, A × A, B × B and (A × B) ∩ (B × A).

Let us find them one by one.

We have, A = {a, b} and B = {1, 2, 3}, therefore,

A × B = {a, b} × {1, 2, 3} = {(a, 1), (a, 2), (a, 3), (b, 1), (b, 2), (b, 3)}

Hence, A × B = {(a, 1), (a, 2), (a, 3), (b, 1), (b, 2), (b, 3)} . . . . . . . . . . (1)

B × A = {1, 2, 3} × {a, b} = {(1, a), (1, b), (2, a), (2, b), (3, a), (3, b)}

Hence, B × A = {(1, a), (1, b), (2, a), (2, b), (3, a), (3, b)} . . . . . . . . (2)

A × A = {a, b} × {a, b} = {(a, a), (a, b), (b, a), (b, b)}

Hence, A × A = {(a, a), (a, b), (b, a), (b, b)} . . . . . . . . . . . . . . . . . . . (3)

B × B = {1, 2, 3} × {1, 2, 3} = {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3)}

Hence, B × B = {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3)} . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (4)

Now, to find the value of (A × B) ∩ (B × A), from (1) and (2) we have,

A × B = {(a, 1), (a, 2), (a, 3), (b, 1), (b, 2), (b, 3)} and

B × A = {(1, a), (1, b), (2, a), (2, b), (3, a), (3, b)}

We can see above that A × B and B × A have no elements in common. Hence, (A × B) ∩ (B × A) = ∅

Properties of the Cartesian product

The following are the properties of Cartesian product –

  1. Cartesian product does not satisfy commutative law, i.e. it is not commutative. This means that if we change the order of sets the result usually changes (the only exceptions are A = B or one of the sets being empty). For instance, if A and B are two sets, then the Cartesian product of A and B, A × B ≠ B × A.
  2. Cartesian product does not satisfy associative law, i.e. is not associative. This means that if we regroup the sets in the Cartesian product, then it will change the result. For instance, if A, B and C are three sets, then (A × B) × C ≠ A × (B × C)
  3. Distributive property of Cartesian product over the intersection of sets is given by A × (B ∩ C) = (A × B) ∩ (A × C)
  4. Distributive property of Cartesian product over the union of sets is given by A × (B ∪ C) = (A × B) ∪ (A × C)
  5. The result of the Cartesian product of sets is a set of all ordered pairs.

Cartesian product of three sets

Let A, B and C be three sets. Then, A × B × C is the set of all ordered triplets having the first element of A, second element from B and third element from C. This can be stated as:

A × B × C = {(a, b, c) : a ∈ A, b ∈ B, c ∈ C}

Let us understand it through an example.

Suppose we have three sets, A = {1, 2}, B = {3, 4} and C = {4, 5, 6}, then

A × B = {1, 2} × {3, 4} = {(1, 3), (1, 4), (2, 3), (2, 4)}

Now,

A × B × C = (A × B) × C = {(1, 3), (1, 4), (2, 3), (2, 4)} × {4, 5, 6} This means that

A × B × C = {(1, 3, 4), (1, 3, 5), (1, 3, 6), (1, 4, 4), (1, 4, 5), (1, 4, 6), (2, 3, 4), (2, 3, 5), (2, 3, 6), (2, 4, 4), (2, 4, 5), (2, 4, 6)}

Strictly, ((a, b), c) and (a, (b, c)) are different objects, which is why the product is not associative. In practice both are written as the triple (a, b, c), and A × B × C means this set of triples.

Number of elements in A × B

Can we determine the number of elements that should be present in the Cartesian product of two sets? If A and B are two finite sets then n (A × B) = n (A) × n (B). This means that if a set A has m elements while a set B has n elements then, the number of elements of A × B would be m × n.

Cartesian product on a grid

Let A and B be two non-empty sets. To represent A × B graphically, we draw two mutually perpendicular lines, one horizontal and one vertical. On the horizontal line we represent the elements of set A while on the vertical line we represent the elements of set B. If a ∈ A and b ∈ B, we draw a vertical through a and a horizontal line through b. These two lines will meet in a point which will denote the ordered pair (a, b). In this manner we mark points corresponding to each ordered pair in A × B. Let us understand it through an example.

Suppose we have two sets, A = {a, b, c} and B = {1, 2}

Then, A × B = {(a, 1), (a, 2), (b, 1), (b, 2), (c, 1), (c, 2)}

The graphical representation of the above Cartesian product will be –

A × B on a gridabc12(a, 1)(a, 2)(b, 1)(b, 2)(c, 1)(c, 2)BA
A = {a, b, c} on the horizontal line and B = {1, 2} on the vertical line. Each crossing is one ordered pair, so A × B has 3 × 2 = 6 points.

Cartesian product as an arrow diagram

In order to represent A × B by an arrow diagram, we first draw Venn diagrams representing sets A and B one opposite to the other. Next, we draw line segments starting from each element of A and terminating to each element of set B.

Let us understand it through an example.

Suppose we have two sets, A = {3, 4, 5} and B = {6, 8, 10}

Now, A × B = {(3, 6), (3, 8), (3, 10), (4, 6), (4, 8), (4, 10), (5, 6), (5, 8), (5, 10)}

We can see that n(A) = 3, n(B) = 3 and n(A × B) = 3 × 3 = 9

The above Cartesian product can be represented using the arrow diagram as shown below –

Arrow diagram of A × BAB3456810
Every element of A = {3, 4, 5} is joined to every element of B = {6, 8, 10}: 3 × 3 = 9 arrows, one for each ordered pair.

More practice: cartesian coordinate plane worksheets, number lines and coordinate planes 6th grade worksheets and graphing points on the coordinate plane 5th grade worksheets.

Cartesian product FAQs

What is the Cartesian product of two sets?

The set of all ordered pairs (a, b) where a comes from the first set and b from the second: A × B = {(a, b) : a ∈ A, b ∈ B}.

How many elements are in A × B?

n(A × B) = n(A) × n(B). If A has 3 elements and B has 4, A × B has 12 ordered pairs.

Is A × B equal to B × A?

Usually not. (2, 1) is in {2} × {1} but not in {1} × {2}. They are equal only when A = B or one of the sets is empty. They always have the same number of elements.

What is A × ∅?

The empty set. There is no element of ∅ to pair with, so A × ∅ = ∅ × A = ∅.

Where is the Cartesian product used?

The coordinate plane is ℝ × ℝ, every point being an ordered pair (x, y). Relations and functions are subsets of A × B, and a database join pairs every row of one table with every row of another.

Practise with worksheets

Link/Reference Us

We spend a lot of time researching and compiling the information on this site. If you find this useful in your research, please use the tool below to properly link to or reference Helping with Math as the source. We appreciate your support!

  • "Cartesian Product". Helping with Math. Accessed on November 10, 2026. https://helpingwithmath.com/cartesian-product/.

  • "Cartesian Product". Helping with Math, https://helpingwithmath.com/cartesian-product/. Accessed 10 November, 2026.

  • Cartesian Product. Helping with Math. Retrieved from https://helpingwithmath.com/cartesian-product/.