Cartesian Product Calculator
Calculate the Cartesian product A x B of sets to get all ordered pairs.
Define Sets
|A| = 3
|B| = 2
Cardinality
|A × B| = |A| × |B| = 3 × 2 = 6
Cartesian product is generally NOT commutative
A × B
6 ordered pairs
B × A
6 ordered pairs
A × A
9 ordered pairs
About Cartesian Product
Definition
A × B = {(a, b) | a ∈ A and b ∈ B} - the set of all ordered pairs where the first element comes from A and second from B.
Properties
- Not commutative: A × B ≠ B × A (usually)
- |A × B| = |A| × |B|
- A × ∅ = ∅ × A = ∅
What Is a Cartesian Product?
The Cartesian product of two sets A and B, denoted A × B, is the set of all ordered pairs (a, b) where a ∈ A and b ∈ B. For example, {1,2} × {a,b} = {(1,a), (1,b), (2,a), (2,b)}. This calculator supports up to three sets, allowing Cartesian products of 2 or 3 sets. The size of the product is the product of the sizes: |A × B| = |A| × |B|.
Cartesian products are the foundation of relational databases (every table is a subset of a Cartesian product), coordinate geometry (R × R = R² gives the Cartesian plane), and combinatorics (counting ordered selections from multiple sets).
Cartesian Product Formula
Cartesian Product
Where:
- A= First set — comma-separated values like '1, 2, 3'
- B= Second set — comma-separated values like 'a, b'
How to Use
- Enter sets: Type comma-separated values for up to three sets. Duplicates are automatically removed.
- Choose number of sets: Select 2 or 3 depending on how many sets you need to combine.
- Read the product: All ordered pairs (or triples) are displayed in a grid, with the total count shown.
Applications
Cartesian products underpin relational databases — joining two tables produces their Cartesian product filtered by a condition. In game design, combining character classes with races gives a Cartesian product of all possible character types. In product configuration, combining options for size × color × material generates all possible product variants. The Cartesian plane R² = R × R is the entire framework of 2D coordinate geometry.
Worked Examples
Two Sets
Problem:
Find the Cartesian product of {1, 2, 3} and {a, b}.
Solution Steps:
- 1Enter Set A: 1, 2, 3; Set B: a, b.
- 2Size: 3 × 2 = 6 ordered pairs.
- 3Product: {(1,a),(1,b),(2,a),(2,b),(3,a),(3,b)}.
Result:
|A × B| = 6 ordered pairs. Each element of A pairs with each element of B.
Three Sets
Problem:
A × B × C with A={x,y}, B={1}, C={red,blue}.
Solution Steps:
- 1Enter 3 sets: Set A: x, y; Set B: 1; Set C: red, blue.
- 2Size: 2 × 1 × 2 = 4 triples.
- 3Result: (x,1,red), (x,1,blue), (y,1,red), (y,1,blue).
Result:
4 ordered triples. With |B| = 1, the product has the same structure as A × C.
Tips & Best Practices
- ✓The total number of ordered pairs equals the product of the set sizes — use this to verify your result.
- ✓Duplicate elements in inputs are automatically removed — a set contains each element only once.
- ✓For large sets, the output can be very large — |A × B| = |A| × |B| grows multiplicatively.
- ✓The Cartesian product of n identical sets R × R × ... × R = R^n — this is the n-dimensional Euclidean space.
Frequently Asked Questions
Sources & References
Last updated: 2026-06-06
Help us improve!
How would you rate the Cartesian Product Calculator?
Editorial Note
MyCalcBuddy Editorial Team
This page is maintained as an educational calculator reference.
Formula Source: Handbook of Mathematical Functions
by Abramowitz & Stegun