Related Articles

# Cartesian Product of Sets

The term ‘product‘ mathematically signifies the result obtained when two or more values are multiplied together. For example, 45 is the product of 9 and 5. One must be familiar with the basic operations on sets like Union and Intersection, which are performed on 2 or more sets. Cartesian Product is also one such operation that is performed on two sets, which returns a set of ordered pairs.

### What is an Ordered Pair?

An ordered pair is a pair of objects where one element is assigned first, and the other element is assigned second, denoted by (a,b). Here ‘a’ is called the first component, and ‘b’ is called the second component of the ordered set.

Example: (5, 7) is an ordered pair of integers.

Note: (5, 7) â‰  (7, 5), an ordered pair (a, b) is equal to (x, y) only if a = x and b = y.

### Cartesian Product of Sets

A cartesian product of two non-empty sets A and B is the set of all possible ordered pairs where the first component of the pair is from A, and the second component of the pair is from B. The set of ordered pairs thus obtained is denoted by AÃ—B.

A Ã— B = {(a, b) : a âˆˆ A and b âˆˆ B}

Example:

Let A = {1, 2} and B = {4, 5, 6}

A Ã— B = {(1, 4), (1, 5), (1, 6), (2, 4), (2, 5), (2, 6)}

Here the first component of every ordered pair is from set A the second component is from set B.

The Cartesian Product of two sets can be easily represented in the form of a matrix where both sets are on either axis, as shown in the image below. Cartesian Product of  A = {1,  2} and B = {x, y, z}

### Properties of Cartesian Product

1. The Cartesian Product is non-commutative: A Ã— B â‰  B Ã— A

Example:

A = {1, 2} , B = {a, b}

A Ã— B = {(1, a), (1, b), (2, a), (2, b)}

B Ã— A = {(a, 1), (b, 1), (b, 1), (b, 2)}

Therefore as A â‰  B we have A Ã— B â‰  B Ã— A

2. A Ã— B = B Ã— A, only if A = B

Proof:

Let A Ã— B = B Ã— A then we have

A âŠ†  B  and B âŠ†  A, it follows that A = B

3. The cardinality of the Cartesian Product is defined as the number of elements in A Ã— B and is equal to the product of cardinality of both sets: |A Ã— B| = |A| * |B|

Proof:

Let a âˆˆ A then the number of ordered pair (a, b) such that b âˆˆ B is |B|.

Therefore we have |B| choices for b for each a where a âˆˆ A therefore the number of element in AÃ—B is |A| * |B|.

4. A Ã— B = {âˆ…}, if either A = {âˆ…} or B = {âˆ…}

Proof:

We know |{âˆ…}| = 0.

Now we have |A Ã— B| = |{âˆ…}| = 0

As |A Ã— B| = |A| * |B| , we get |A| * |B| = 0

Thus atleast one of |A| or |B| should be equal to 0

Hence either A = {âˆ…} or B = {âˆ…}

### Sample Problems on Ordered Pairs and Cartesian Product of Sets

Problem 1: Find the value of x and y given (2x – y,  25) = (15,  2x + y)?

Solution:

As we know from the property of ordered pairs, 2x – y = 15 and 25 = 2x + y.

Solving the linear equations we have x = 10 and y = 5.

Problem 2. Given A = {2, 3, 4 , 5} and B = {4 , 16 , 23}, a âˆˆ A, b âˆˆ B, find the set of ordered pairs such that a2 < b?

Solution:

As 22 < 16 and 23, 32 < 16 and 23, 42 < 23

We have the set of ordered pairs such that a2 < b is {(2, 16), (2, 23), (3, 16), (2, 23), (4, 23)}

Problem 3. If A = {9, 10} and B = {3, 4, 6}, find A Ã— B and |A Ã— B|?

Solution:

A Ã— B = {(9, 3), (9, 4), (9, 6), (10, 3), (10, 4), (10, 6)}

|A Ã— B| = |A| * |B| = 2 * 3 = 6

Problem 4. If A Ã— B = {(a, x), (a, y ), (b, x ), (b, y)}, find A and B?

Solution:

We know A is the set of all first components in ordered pairs of A Ã— B and

B is the set of the second component in the ordered pair of A Ã— B.

Therefore A = {a, b} and B = {x, y}

Problem 5. Given A Ã— B has 15 ordered pairs and A has 5 elements, find the number of elements in B?

Solution:

We know |A Ã— B| = |A| * |B|, 15 = 5 * |B|

Therefore B has 15 / 5 = 3 elements.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!