The Math Behind the Card Game Set

The card game Set is a fast-paced puzzle game that challenges players to spot groups of three cards that form a “set”. While the gameplay seems straightforward, it is built on deep mathematical principles rooted in combinatorics and geometry. Let’s explore the math that makes Set both entertaining and complex.


The Structure of the Game

Each card in Set is defined by four features:

There are \(3^4 = 81\) unique cards, as each feature can take one of three possible values.


What Constitutes a Set?

A “set” is made up of three cards where, for each of the four features, the cards must either all share the same value or all have different values. For example, if one card has an oval shape, the other two cards must either also have an oval shape (same value) or one must have a squiggle and the other a diamond (different values).


Finite Geometry and Vector Spaces

The game’s mathematical foundation comes from finite geometry. The 81 cards can be thought of as points in a four-dimensional vector space over the finite field \(\mathbb{Z}_{3}\), where each feature represents one dimension. In this space:

Each feature in Set can take one of three values, which can be represented by \(\{0, 1, 2\}\) in the finite field \(\mathbb{Z}_3\). Let’s assume a “set”, that is a collection of three cards, where each feature has the same value, or all three features have different values.

A “set” of three cards corresponds to a line within this space.

As we have just seen, for three cards represented by vectors \(\mathbf{v}_1\), \(\mathbf{v}_2\), and \(\mathbf{v}_3\), the condition for a “set” is:

\(\mathbf{v}_1 + \mathbf{v}_2 + \mathbf{v}_3 \equiv 0 \mod 3\).

This condition implies:

This shows that \(\mathbf{v}_1\), \(\mathbf{v}_2\), and \(\mathbf{v}_3\) lie on the same line in the 4-dimensional space. Therefore, a “set” corresponds to a line in the affine space \(\mathbb{Z}_3^4\).

Note that every pair of cards has a unique card that completes the set. This means that the number of sets is equal to the number of ways to choose two cards from 81, which is \(\binom{81}{2} = 3,240\). However, each set is counted three times, once for each configuration of the three cards that can complete it. Therefore, the number of unique sets is \(\frac{3,240}{3} = 1,080\).


At its heart, Set is more than just a fun card game—it’s a puzzle built on fascinating mathematical structures. Whether you’re a math enthusiast or simply enjoy the gameplay, knowing the geometry and combinatorics behind it adds an extra layer of appreciation to every round.