Martin McBride, 2021-11-04

Tags Cartesian product

Categories statistics probability

The *Cartesian product* of two sets includes every possible combination of an element from the first set and an element from the second set.

Suppose you had two sets of cards:

- 3 red cards marked A, B and C
- 4 blue cards numbered 1 to 4

The Cartesian product shows all the possible combinations of a red card and a blue card:

The grid shows all the possible pairs of values.

The Cartesian product can be useful for calculating probabilities. This table shows all possible results of throwing two dice:

It shows every possibility for the first and second dice scores. Here is another table that shows the sum of the scores:

This can be used, for example, to determine the probability that the total score will be 5. There are 4 possible pairs of values that add up to 5, out of 36 possible pairs in total. This means that the probability of scoring 5 is 4/36, or 1 in 9.

If there are more than two values, for example if 3 dice were thrown, the result would be a 3-dimensional table of 6 by 6 by 6 entries. This can be extended to any number of dimensions, although it becomes less useful because it is hard to visualise.

Copyright (c) Axlesoft Ltd 2021