Lesson Explainer: Cartesian Products Mathematics

In this explainer, we will learn how to perform a Cartesian product and use the operations applied on sets.

Recall that a set is a collection of numbers such as 𝐴={1,2}. We denote sets using braces, and the numbers between them are the elements, which can go in any order. Recall that we can also perform operations on multiple sets, such as finding the union, intersection, or difference between them. If we let 𝐵={2,3,4}, then we have 𝐴𝐵={1,2,3,4},𝐴𝐵={2},𝐴𝐵={1}.

The symbol denotes the union and is the set of all elements that belong to either set, which in this case is 1, 2, 3, and 4 (the 2 is repeated but we do not have to include it twice). The symbol is for the intersection, and this means the set of elements that are common to both sets, which is just 2 since it is the only element in both sets. Finally denotes the subtraction of one set from another, which means taking away any elements from the first set that are present in the second set. Here, this just means taking the 2 away from {1,2}, leaving only 1.

Let us now consider a fourth operation, the Cartesian product, which we define as follows.

Definition: Cartesian Product

The Cartesian product 𝐴×𝐵 of two sets 𝐴 and 𝐵 is the set of all ordered pairs (𝑥,𝑦) such that 𝑥𝐴 and 𝑦𝐵.

To demonstrate how this works, let us take the Cartesian products of our example sets, 𝐴={1,2} and 𝐵={2,3,4}. To take an ordered pair using these sets, we take one element from 𝐴 and one element from 𝐵 and put them into a pair in brackets. Taking the first element from each set, we have (1,2). We want to take every possible combination of pairs between the two sets, which we illustrate in the following arrow diagram.

The Cartesian product is therefore 𝐴×𝐵={(1,2),(1,3),(1,4),(2,2),(2,3),(2,4)}.

Note that this gives us 6 different elements, which means the size of the set 𝑛(𝐴×𝐵) is equal to 6. It is worth noting that we can also take the opposite product, 𝐵×𝐴: 𝐵×𝐴={(2,1),(2,2),(3,1),(3,2),(4,1),(4,2)}.

It is important to realize that the two sets 𝐴×𝐵 and 𝐵×𝐴 are not the same, since the order of the pairs matters. For example, (1,2)(2,1). In this situation, the only pair that is common to both sets is (2,2). In general, we note that 𝐴×𝐵𝐵×𝐴, which means that Cartesian products are noncommutative.

It is also possible to take the product of a set with itself, which we denote by 𝐴=𝐴×𝐴. In this case, we would have 𝐴={(1,1),(1,2),(2,1),(2,2)}.

We note that 𝐴 is one of two exceptions where the Cartesian product is commutative (i.e., 𝐴×𝐵=𝐵×𝐴), since if 𝐴=𝐵, then clearly the order does not matter. The other case is when either 𝐴 or 𝐵 is the empty set (the set with no numbers in it) denoted by , since 𝐴×= and ×𝐵=. In this sense, it is basically the same as multiplying by 0.

Considering the size of set 𝐴×𝐵, both in the above case and in general, we can see that 𝑛(𝐴×𝐵)=𝑛(𝐴)𝑛(𝐵).

That is, the number of elements in 𝐴×𝐵 is equal to (the number of elements in 𝐴) × (the number of elements in 𝐵), since it is the total number of ordered pairs we can make between the two sets. Note that if we reverse the order, we have 𝑛(𝐵×𝐴)=𝑛(𝐵)𝑛(𝐴)=𝑛(𝐴)𝑛(𝐵)=𝑛(𝐴×𝐵).

So we can see that 𝑛(𝐴×𝐵)=𝑛(𝐵×𝐴), which means 𝐴×𝐵 and 𝐵×𝐴 always have the same number of elements.

To practice taking the Cartesian product of two sets, let us consider an example similar to the one above, where we are given the Cartesian product in arrow diagram form.

Example 1: Finding Cartesian Products Using Arrow Diagrams

Use the arrow diagram below to find 𝑋×𝑌.


Recall that the Cartesian product 𝑋×𝑌 of two sets 𝑋 and 𝑌 is the set of all ordered pairs (𝑥,𝑦) such that 𝑥𝑋 and 𝑦𝑌.

To form these pairs, we take each element 𝑥 belonging to 𝑋, follow the arrows connected from it to each element 𝑦 in 𝑌, and for each such arrow, construct a pair of the form (𝑥,𝑦).

To begin, we see that 4 is connected via the orange arrows to 9, 3, and 8, resulting in the ordered pairs (4,9),(4,3),(4,8).

Next, 0 is connected via blue arrows to 9, 3, and 8. This gives us the ordered pairs (0,9),(0,3),(0,8).

Combining these elements into one set, we have 𝑋×𝑌={(4,9),(4,3),(4,8),(0,9),(0,3),(0,8)}.

As we have just seen, using an arrow diagram to find the Cartesian product is fairly straightforward. In some cases, however, we have to find the Cartesian product of sets given in set notation. We may also have to combine the Cartesian product with other set operations. The following example will help us test these skills.

Example 2: Finding the Cartesian Product of a Set and an Intersection of Sets

If 𝑋={8,4,6}, 𝑌={6,7}, and 𝑍={7}, find 𝑋×(𝑌𝑍).


Here, we have a question involving three different sets. Considering 𝑋×(𝑌𝑍), we see that since 𝑌𝑍 is in parentheses, due to the order of operations, we must calculate it first. After this, we can take the Cartesian product of the result to get the solution.

Now, 𝑌𝑍 is the intersection of {6,7} and {7}. The intersection of these sets is the set of elements that are in both {6,7} and {7}. Since 7 is in both sets but 6 is not, we have {6,7}{7}={7}.

In other words, 𝑌𝑍={7}.

Now we must calculate 𝑋×(𝑌𝑍), or {8,4,6}×{7}. As this is the Cartesian product, this means we make a set containing every ordered pair of the two sets. This results in a set containing three pairs as follows: {8,4,6}×{7}={(8,7),(4,7),(6,7)}.

Thus, we have the solution, 𝑋×(𝑌𝑍)={(8,7),(4,7),(6,7)}.

Sometimes we are given sets in set notation, but other times we have to work out what the sets are using diagrams. Let us consider an example that uses Venn diagrams to represent the sets.

Example 3: Finding the Cartesian Product of the Difference and Union of Sets given Their Venn Diagram

Determine (𝑍𝑌)×(𝑋𝑌) using the Venn diagram below.


When faced with a question involving a diagram, the best thing to do is to start off by writing down what the sets are. We can see that 𝑋={4},𝑌={7,9},𝑍={3,7,8}.

Now, in order to find (𝑍𝑌)×(𝑋𝑌), we must first work out what 𝑍𝑌 and 𝑋𝑌 are.

𝑍𝑌 is the set of elements in 𝑍 after we have taken away any elements that are also in 𝑌. Here, that is {3,7,8}{7,9}={3,8}.

We have obtained {3,8} by subtracting 7 from {3,7,8}, since it is the only element present in both sets. We can see that, in the diagram, this corresponds to the light-blue region of 𝑍 that does not intersect with 𝑌.

Next, we must find 𝑋𝑌, which is the combined set of points that are in either 𝑋 or 𝑌. This is {4}{7,9}={4,7,9}, where we have simply combined the two sets together. Finally, we must calculate (𝑍𝑌)×(𝑋𝑌), that is, {3,8}×{4,7,9}. As this is the Cartesian product, we must make a set containing all possible ordered pairs between the two sets. This gives us {3,8}×{4,7,9}={(3,4),(3,7),(3,9),(8,4),(8,7),(8,9)}.

In conclusion, the solution is (𝑍𝑌)×(𝑋𝑌)={(3,4),(3,7),(3,9),(8,4),(8,7),(8,9)}.

We have now seen how to construct Cartesian products between sets in different ways. Sometimes we might have questions where we have the inverse problem; given a set that is a Cartesian product, can we reconstruct the original sets? As we will see in the following example, this is a fairly straightforward thing to do, due to the nature of the Cartesian product.

Example 4: Finding a Set given Its Cartesian Product with Another Set

If 𝑋×𝑌={(8,0),(8,6),(1,0),(1,6),(3,0),(3,6)}, find 𝑋.


Let us recall that for a Cartesian product 𝑋×𝑌, its elements are of the form (𝑥,𝑦), where 𝑥𝑋 and 𝑦𝑌. We note that only elements of 𝑋 go into the first component, and only elements of 𝑌 go into the second. Let us consider only the first components of each element of 𝑋×𝑌, since these are elements that correspond to 𝑋. This gives us 8,8,1,1,3,3.

Now we know that 𝑋×𝑌 contains every possible combination of ordered pairings between elements of 𝑋 and 𝑌. This means that the above set of numbers must contain every element of 𝑋 in some combination. Removing the repeated numbers, this gives us the set 𝑋 in its entirety, 𝑋={8,1,3}.

Having found the solution, we could stop here, but let us verify that it is correct by finding 𝑌 too and calculating their Cartesian product. Considering the second components of each element of 𝑋×𝑌 in the same way as before gives us 𝑌={0,6}.

Next, taking 𝑋×𝑌, we get 𝑋×𝑌={(8,0),(8,6),(1,0),(1,6),(3,0),(3,6)}.

This is indeed the same set as we were given originally. Therefore, we can conclude that 𝑋={8,1,3}.

Let us continue to develop our understanding of how Cartesian products work by looking at another example where we have to carefully consider how the sets are interacting.

Example 5: Identifying Which Cartesian Product of Two Given Sets Would Contain a Given Element

Given that 𝑋={0,1} and 𝑌={8,4,3,2}, then which of the following relations would (1,4) be an element of?

  1. 𝑋
  2. 𝑋×𝑌
  3. 𝑌×𝑋
  4. 𝑌


One possible approach to this question is to calculate each of the four options and check which set (1,4) belongs to.

Let us start with 𝑋. Recall that 𝑋=𝑋×𝑋, which is the set of all ordered pairs of 𝑋 with itself. Since 𝑋={0,1}, 𝑋={0,1}×{0,1} is given by 𝑋={(0,0),(0,1),(1,0),(1,1)}.

We can see that (1,4) is not an element of this set. Moving on, let us calculate 𝑋×𝑌. Since 𝑋×𝑌={0,1}×{8,4,3,2}, we have to take every ordered pair between the two sets, which is 2×4=8 pairs in total. This gives us 𝑋×𝑌={(0,8),(0,4),(0,3),(0,2),(1,8),(1,4),(1,3),(1,2)}.

Here, we find that (1,4) is the sixth element in our list, so at this point we could conclude that the answer is B. However, for the sake of completeness, let us continue calculating the other sets. For 𝑌×𝑋, we must find {8,4,3,2}×{0,1}, which is actually just the elements of 𝑋×𝑌 but with the order of the pairs swapped around. Specifically, we have 𝑌×𝑋={(8,0),(4,0),(3,0),(2,0),(8,1),(4,1),(3,1),(2,1)}.

Note that this gives us (4,1), which is almost (1,4). However, since the order of the pair matters, they are not the same. Finally, we have 𝑌={8,4,3,2}×{8,4,3,2}. Since this set has 16 elements, it is probably easiest to represent it in a table:


Here 𝑌 is the set of all the elements in the table. As expected, we do not see (1,4) among the elements.

Therefore, as we found earlier, the solution is B: 𝑋×𝑌.

Further Comments: Although we have calculated all the sets for completeness, it is important to note that we could have found the solution to this problem much more simply if we used our knowledge of the positions that elements of 𝑋 and 𝑌 take in each pair. Considering (1,4), we see that 1 is only an element of 𝑋, and 4 is only an element of 𝑌. The only Cartesian product that assigns an element of 𝑋 to the first position, and an element of 𝑌 to the second position, is 𝑋×𝑌.

We have now seen how the Cartesian product works in a variety of examples, but perhaps the most important application of the Cartesian product is Cartesian coordinates. Cartesian coordinates is another term for the 𝑥𝑦 coordinate system used to plot graphs and points.

As we can see from the diagram, Cartesian coordinates are ordered pairs, with the first component relating to the 𝑥-axis and the second relating to the 𝑦-axis. The three points plotted on the diagram are (1,2)1𝑥2𝑦,(3,1)3𝑥1𝑦,(0,0)0𝑥0𝑦.onthe-axisandonthe-axisonthe-axisandonthe-axisonthe-axisandonthe-axis

This coordinate system can in fact be defined in terms of the Cartesian product. If , the set of real numbers, represents the 𝑥-axis and also represents the 𝑦-axis, then their product, ×, or , is the 2-dimensional plane with which we can represent points of the form (𝑥,𝑦) and functions of the form 𝑦=𝑓(𝑥). We note that is in fact an infinite set, which slightly differentiates it from the finite sets we have considered so far, although the concept is still the same.

The following example will demonstrate exactly how a Cartesian diagram relates to the Cartesian product.

Example 6: Finding the Cartesian Product from a Cartesian Diagram

Using the Cartesian diagram below, determine the relation 𝑋×𝑌.


It is important to realize exactly what the question is asking us here. We are being asked to find a set 𝑋×𝑌 such that when its elements are plotted on a Cartesian diagram, it produces the points that are shown. To do this, we have to find what the points are and then how they are represented as a Cartesian product.

To find the values of the points on the diagram, we just have to find what their 𝑥- and 𝑦-values are by looking at how they line up with the 𝑥- and 𝑦-axes.

  • For the bottom-left value, we have a value of 1 for 𝑥 and a value of 1 for 𝑦, giving us the point (1,1).
  • For the top-left value, 𝑥=1 and 𝑦=2, giving us (1,2).
  • For the bottom-right value, 𝑥=6 and 𝑦=1, giving us (6,1).
  • Finally, for the top-right value, 𝑥=6 and 𝑦=2, giving us (6,2).

Now we have to represent these points as a set 𝑋×𝑌. Firstly, let us note that the sets 𝑋 and 𝑌 in this product represent the 𝑥- and 𝑦-axes respectively. Thus, if we wanted to express 𝑋 and 𝑌 separately, we would have 𝑋={1,6},𝑌={1,2}.

Their product 𝑋×𝑌, is the collection of these points as ordered pairs. Therefore, our answer is 𝑋×𝑌={(1,1),(1,2),(6,1),(6,2)}.

Let us finish by summarizing the main properties of Cartesian products that we have learned.

Key Points

  • The Cartesian product 𝐴×𝐵 of two sets 𝐴 and 𝐵 is the set of all ordered pairs (𝑥,𝑦) such that 𝑥𝐴 and 𝑦𝐵.
  • The operation of taking the Cartesian product is noncommutative (so 𝐴×𝐵𝐵×𝐴 in most cases).
  • We can combine the Cartesian product with other set operations such as ,, and . The order of operation is important to consider.
  • Cartesian products can be represented using arrow diagrams and Cartesian diagrams. The 𝑥𝑦 plane is a form of Cartesian product.

Nagwa uses cookies to ensure you get the best experience on our website. Learn more about our Privacy Policy.