Cartesian product

Martin McBride

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.

Calculating probabilities

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.

More dimensions

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.

See also

⇐ Previous Next ⇒

Join the GraphicMaths Newletter

Sign up using this form to receive an email when new content is added:

Popular tags

angle cartesian equation chord circle combinations cosh cosine cosine rule cube diagonal directrix ellipse equilateral triangle exterior angle focus horizontal hyperbola hyperbolic function interior angle inverse hyperbolic function isosceles triangle locus major axis minor axis normal parabola parametric equation permutations quadrilateral radius sine rule sinh sloping lines solving equations solving triangles square standard curves straight line graphs tangent tanh triangle vertical