Tool to generate Cartesian products of lists/sets by combining the elements to generate the complete list of possible choices.
Cartesian Product - dCode
Tag(s) : Combinatorics
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
A Cartesian product is a combination of elements from several sets. The product is written with the symbol ×. It is the totality of the possible combinations among the sets of elements.
Enter the sets (1 per line) in the generator table and click on generate.
Example: Generation of all playing card figures (jack, queen, king) of each color (spade, heart, diamond, club)
The first set consists of the 3 figures {J,Q,K}, the second set of the 4 colors {♠,♥,♦,♣}.
The Cartesian product is:
J | ♠ |
J | ♥ |
J | ♦ |
J | ♣ |
Q | ♠ |
Q | ♥ |
Q | ♦ |
Q | ♣ |
K | ♠ |
K | ♥ |
K | ♦ |
K | ♣ |
The cardinality (total number of combinations) is equal to the multiplication of the cardinality of each set.
Example: A garment with 3 color choices and 5 sizes will have $ 3 \times 5 = 15 $ different possibilities
Example: A padlock with 4 wheels that can define a 4-letter code (26 possible letters for each wheel) will have a cardinality of $ 26 \times 26 \times 26 \times 26 = 456976 $ possible words.
dCode retains ownership of the "Cartesian Product" source code. Except explicit open source licence (indicated Creative Commons / free), the "Cartesian Product" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "Cartesian Product" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "Cartesian Product" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!
Reminder : dCode is free to use.
The copy-paste of the page "Cartesian Product" or any of its results, is allowed (even for commercial purposes) as long as you credit dCode!
Exporting results as a .csv or .txt file is free by clicking on the export icon
Cite as source (bibliography):
Cartesian Product on dCode.fr [online website], retrieved on 2024-12-04,