The **Cartesian product** comprises two words – Cartesian and product. The word Cartesian is named after the French mathematician and philosopher René Descartes (1596-1650). In this article, you will learn the definition of Cartesian product and ordered pair with properties and examples.

## Cartesian Product of Sets

Suppose A and B are two sets such that A is a set of 3 colors and B is a set of 2 objects, i.e.,

A = {green, black, red}

B = {b, p},

where b and p represent a selective bag and pen, respectively.

Let’s find the number of pairs of colored objects that we can make from these two sets, A and B.

Proceeding in a quite thorough manner, we can recognize that there will be six different pairs. They can be written as given below:

(green, b), (green, p), (black, b), (black, p), (red, b), (red, p)

The above-ordered pairs represent the Cartesian product of given two sets.

## Cartesian Product and Ordered pairs Definition

The Cartesian product of two non-empty sets *A* and *B* is denoted by \( A × B \) and defined as the “collection of all the ordered pairs (*a,b*) such that \( a \in A \) and \( b \in B \) “.

\(~~~~~~~~~~~~~~~\) \( A × B \) = { \( ( a,b):a \in A, b\in B \) }

It is also called the cross product, set direct product or the product set of *A* and *B* .

Learn more on: Types of Sets

One very important thing to note here is that it is the collection of ordered pairs. By ordered pair, it is meant that two elements taken from each set are written in particular order. So, if a ≠ b , ordered pairs (*a,b*) and *(b,a) * are distinct.

## Cartesian Product and Ordered pairs Examples

**Example 1:**

To take an example, let us take *P* as the set of grades in a school from set *Q* as the sections for the grades. So, we have *P* and *Q* as:

\(~~~~~~~~~~~~~~~~~~~\) P = {8,9,10}

\(~~~~~~~~~~~~~~~~~~~\) Q = *{A,B,C,D*}

So,\( P × Q \) , according to the definition will be equal to,

\( P × Q \) = { (8*,A*)* , *(8*,B*)* , *(8*,C*)* ,* (8*,D*) ,(9*,A*)* , *(9*,B*) ,(9*,C*),(9*,D*),(10*,A*),(10*,B*),(10*,c*),(10,*D*)}

There are a total of 12 ordered pairs. If *n*(*P*) and *n*(*Q*) represent the number of elements in the sets *P* and *Q* respectively, then *n*(*P*) = 3 and *n*(*Q*) =4. So, *n(P×Q*) = 3 × 4 = 12. Refer figure 1 for the depiction of the same. In the figure, we can clearly observe how \( P × Q \) forms a plane, also referred to as a Cartesian plane. Each point represents an ordered pair which has first element from set *P* and second element from set *Q*. If number of elements in set *A* and *B* is *p* and *q* respectively, then number of elements in the Cartesian product of sets will be *pq* i.e.

If *n*(*A*) = p and *n*(*B*) = q and , then *n*( *A × B*) = *pq*.

From this property, we can draw two conclusions:

- When one or both the sets are empty,
*A*×*B*= \( \phi\) . - If anyone of the sets is infinite, even
*A*×*B*is an infinite set.

Figure 1: Depiction of all possible ordered pairs for \( P × Q \)

**Example 2:**

For two ordered pairs to be equal, their corresponding elements must be equal. E.g. If ordered pairs (9,13) and (x+3 , y+6) are equal,

\(~~~~~~~~~~~~~~~~~~~~\) x + 3 = 9 ⇒ x = 6

\(~~~~~~~~~~~~~~~~~~~~\) y + 6 = 13 ⇒ y = 7

The Cartesian product of sets is not limited to only two sets. It also holds for more than two sets. But the complexity increases as we increase the number of sets. For three sets *A, B* and *C*, an element of *A* ×*B* × *C* is represented as (*a, b, c*) and it is called an ordered triplet. If we take the Cartesian product of two sets as, *R* × *R* where *R* is the set of real numbers, that represents the entire two-dimensional Cartesian plane. Similarly, R × R × R represents three-dimensional Cartesian space.

It is interesting to know what is the Cartesian product and what are ordered pairs. But what is even more interesting is how Descartes got this idea. He was lying on his bed when he saw a fly. After a lot of buzzing from the fly, he noticed something very simple yet outstanding. He could mark the position of the fly using three parameters, distance from the two adjacent walls and distance from the floor. And each time the fly moved, there was a new set of values for the new position. This gave Descartes an idea and he invented Coordinate systems.

## Cartesian Product in Relational Algebra

Cartesian product in relational algebra is a binary operator. Thus, for the Cartesian product to be determined, the two relations included must possess disjoint headers that mean there should not be a common attribute name. The Cartesian Product in relational algebra is defined on two relations, i.e. on two sets of tuples. It will take every tuple one by one from the left set (relation) and pair it up with all the tuples in the right set (relation).

### Cartesian Product of Three sets

The Cartesian product of three sets is explained here using an example.

Consider three sets A = {1, 2}, B = {3, 4} and C = {5, 6}

Now, we need to get the Cartesian product of these three sets.

As we know, the number of ordered pairs in A × B × C = 2 × 2 × 2 = 8 {since the number of elements in each of the given three sets is 2}

Thus, the ordered pairs of A × B × C can be tabulated as:

Elements |
Elements to be selected from sets |
Ordered pairs |

1st element | {1, 2} × {3, 4} × {5, 6} |
(1, 3, 5) |

2nd element | {1, 2} × {3, 4} × {5, 6} |
(1, 3, 6) |

3rd element | {1, 2} × {3, 4} × {5, 6} |
(1, 4, 5) |

4th element | {1, 2} × {3, 4} × {5, 6} |
(1, 4, 6) |

5th element | {1, 2} × {3, 4} × {5, 6} |
(2, 3, 5) |

6th element | {1, 2} × {3, 4} × {5, 6} |
(2, 3, 6) |

7th element | {1, 2} × {3, 4} × {5, 6} |
(2, 4, 5) |

8th element | {1, 2} × {3, 4} × {5, 6} |
(2, 4, 6) |

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

To learn more about relations and range functions, visit www.byjus.com and download BYJU’S – The Learning App and fall in love with learning!