raw Math
RAW Math Combinatorics Finite Geometry

The Mathematics of Dobble

Robert Eisele

Pick any two Dobble cards. They can look completely different, yet exactly one picture appears on both. Not zero. Not two. How can an entire deck keep that promise? The answer is a geometry in which cards become lines, pictures become points, and even parallel lines get a meeting place.

Original Dobble card with a tree, drop, snowflake, carrot, sunglasses, sun, dolphin and yellow symbol
Another original Dobble card with a smaller, rotated tree among different symbols
Original Dobble card excerpts; artwork © respective rights holders. The models below use labels.

The Trick Is in the Sets, Not the Pictures

The original game's rulebook describes 55 cards with eight symbols each. It guarantees exactly one shared symbol for every pair of different cards. Shrinking a picture, rotating it, or moving it around a card makes the visual search harder, but none of those changes affects the underlying rule.

For the mathematics, a card is just a set of symbol identities. If the cards are \(C_1,C_2,\ldots\), the rule is

\[|C_i\cap C_j|=1\qquad(i\ne j).\]

That is the entire matching mechanism: two different cards have an intersection of size one. We will first build a much smaller version, then scale it up. No commercial pictures are needed to construct the arrangement.

A Tempting Shortcut That Makes a Bad Game

Put the same star on every card and fill the remaining spaces with fresh symbols. Every pair now matches exactly once. You can make as many cards as you like, but the answer is always the star.

{A, B, C}{A, D, E}{A, F, G}

To rule out this uninteresting shortcut, require that no single symbol appears on every card. We also use distinct cards, the same number of symbols on each card, and no repeated symbol within a card. These assumptions matter: without them, a claim about a largest possible deck can be false.

Another easy construction gives each pair of cards its own private matching symbol. Four cards then need six symbols, each appearing twice. It works, but scales badly: \(B\) cards need \(B-1\) symbols per card and \(\binom{B}{2}\) different symbols. The more efficient idea is to reuse a symbol on several cards without ever creating a second match.

Seven Symbols Are Enough for a Complete Miniature

Use seven labels, A through G, and put three on each card. The seven sets below form a complete miniature: any two of them share exactly one label. Select two cards and follow their shared point in the diagram.

Shared: E

The drawing introduces an important change of viewpoint:

In the gameIn the geometry
A symbolA point
A cardA line: the set of points on it
The symbol shared by two cardsThe intersection of two lines

The circle in the diagram is one of its seven lines. Here, a line means a specified set of points, not necessarily a straight mark on the page. A crossing of drawn strokes is not an extra point unless one of the seven labelled dots is there. The diagram is a map of relationships, not a ruler-and-compass model of ordinary space.

This seven-point structure is the Fano plane, the smallest nondegenerate projective plane. The labels and placement are arbitrary; the pattern of which points lie on which lines is what matters.

Why the Number 57 Appears

In a complete balanced design, suppose each card contains \(s\) symbols and each symbol appears on \(s\) cards. Choose one symbol. Its \(s\) cards each contain \(s-1\) other symbols. None of those other symbols can repeat between these cards: that would give two cards two common symbols.

E A · CB · DF · G Card 1Card 2Card 7 1 + 3 × 2 = 7
Count the chosen symbol once, then add the other symbols on its cards. In the complete plane, this reaches every symbol.

Thus the number of symbols in the complete plane is

\[v=1+s(s-1).\]

Count the cards from one fixed card in the same way: each of its \(s\) symbols leads to \(s-1\) other cards, with no duplication. The number of cards is also \(1+s(s-1)\). With eight symbols per card,

\[1+8\cdot7=57.\]

This is why a complete design corresponding to the familiar eight-symbol game has 57 cards and 57 symbols. It does not yet explain how to build it, nor does the counting formula alone prove that such a design exists for every possible value of \(s\). The construction comes next.

Start with a Tiny Coordinate Grid

A normal grid seems promising: let its points be symbols and its lines be cards. But it immediately has two problems. It contains too many points, and parallel lines have no common point. We solve the first problem by changing the arithmetic, then the second by adding direction symbols.

Begin with just the coordinates \(0,1,2\). After 2, counting wraps back to 0. This is arithmetic modulo 3: \(2+1\equiv0\) and \(2\cdot2\equiv1\pmod3\). There are now only \(3\times3=9\) grid points.

A line such as \(y=2x+1\pmod3\) contains exactly the three points \((0,1)\), \((1,0)\), and \((2,2)\). It can look broken or wrapped in an ordinary drawing. The equation, not the appearance of the connecting strokes, decides which points belong to it.

No shared grid point

Give Parallel Lines a Shared Symbol

In the grid, all horizontal lines are disjoint. Give every horizontal line the same extra symbol: call it \(\infty_0\). They now meet at that symbol. Give the vertical lines their own symbol \(\infty_v\), and do the same for every possible slope. The infinity sign is a label for a new point, not a very large coordinate.

On a \(q\times q\) grid over a finite field, there are \(q\) slopes plus the vertical direction. Add one point for each of those \(q+1\) directions. Every old line now has \(q+1\) points instead of \(q\).

One final card is needed: the card containing all direction symbols. It is called the line at infinity. It shares exactly one symbol with every other card: that card's direction.

Symbolsq² grid points + q + 1 directions
Cardsq² sloped lines + q verticals + 1 extra line

Both totals are \(q^2+q+1\), and each card contains \(q+1\) symbols. The standard eight-symbol case is \(q=7\): 49 ordinary grid points, eight direction points, and 57 lines.

Why Every Pair Has Exactly One Match

There are only three kinds of pair to check:

  1. Same direction: two parallel grid lines share no grid point, but share their one direction symbol.
  2. Different directions: they meet at one grid point and have different direction symbols.
  3. The all-directions card and any other card: their only common point is the other card's direction symbol.

For the middle case, two nonvertical lines satisfy \(y=mx+b\) and \(y=m'x+b'\). Their common point must solve

\[(m-m')x=b'-b.\]

If \(m\ne m'\), the nonzero coefficient \(m-m'\) has an inverse in a field. There is therefore exactly one solution for \(x\), and hence one for \(y\). A vertical line \(x=c\) meets a nonvertical line at the unique point \((c,mc+b)\). This is the algebraic reason the construction never produces zero or two matches.

In the completed structure, two points also determine exactly one line. These two rules, together with a nondegeneracy condition (four points with no three on one line), define a projective plane. Removing cards preserves the matching rule, but generally destroys the stronger completeness and balance properties.

Why 55 Cards Still Work

The official deck contains 55 cards, not the 57 of the complete plane. There is no contradiction: remove any two cards from a complete order-7 design and every remaining pair still has its original single match. Deleting a card cannot change the contents of two cards you kept. This mathematical observation does not establish a manufacturer's reason for selling a particular number of cards.

The two removed cards share one symbol. It loses two appearances; each of their fourteen other symbols loses one. The remaining forty-two symbols lose none. Starting from eight appearances per symbol, the result is:

SymbolsAppearances eachWhat happened?
16On both removed cards
147On exactly one removed card
428On neither removed card
55cards kept
57symbols used
1,485pairs checked
Every pair shares exactly one symbol.

The inspector constructs a mathematical example, not a transcription of the commercial deck. It deletes the first one or two constructed cards and checks every remaining pair. At the classic size, the frequency total is \(1\cdot6+14\cdot7+42\cdot8=440=55\cdot8\), exactly the number of printed symbol appearances.

Nor is every symbol equally likely to be the match after deletion. If a symbol appears on \(r\) cards, it is the common symbol for \(\binom{r}{2}\) card pairs. For a uniformly chosen unordered pair from \(B\) cards,

\[\Pr(\text{match is }a)=\frac{\binom{r_a}{2}}{\binom{B}{2}}.\]

In the full 57-card plane this is the same for every symbol, namely \(1/57\). After removing two cards, a six-appearance symbol matches in 15 pairs, while an eight-appearance symbol matches in 28. The unique-match rule survives; uniform matching frequencies do not.

Why Prime Powers Work, but Modulo 4 Does Not

For a prime \(p\), the residues modulo \(p\) form a field: every nonzero number has a multiplicative inverse. Modulo 5, multiplying by 2 rearranges the residues as \(0,2,4,1,3\). It does not collapse different inputs together. That is precisely what the one-intersection argument needs.

Modulo 4, however, \(2\cdot0\equiv2\cdot2\equiv0\). The coefficient 2 has no inverse. For example, \(y=0\) and \(y=2x\pmod4\) meet at both \((0,0)\) and \((2,0)\): two matches, so the construction breaks.

Nevertheless, a valid 21-card system with five symbols per card exists. It uses a different arithmetic: the four-element field \(\mathbb F_4\), not the integers modulo 4. Write its elements as \(0,1,\alpha,\alpha+1\), with coefficients modulo 2 and the rule \(\alpha^2=\alpha+1\). Then

\[\alpha(\alpha+1)=\alpha^2+\alpha=1.\]

So \(\alpha\) and \(\alpha+1\) are inverses. The multiplication tables make the difference visible:

Finite fields exist for every prime-power size \(q=p^k\), so the construction works for 2, 3, 4, 5, 7, 8, 9, and every other prime power. The inspector includes the four-element example using exactly this arithmetic. It deliberately does not pretend that ordinary remainders modulo a composite number are a field.

What Is the Largest Possible Deck?

The number \(s^2-s+1\) is more than a pattern in small examples. Under the equal-card-size and no-universal-symbol assumptions above, it is an upper bound. Here is a short proof.

Suppose symbol \(a\) appears on \(r_a\) cards. There is a card not containing \(a\). It must meet all those \(r_a\) cards in different symbols: using the same symbol twice would give two cards both that symbol and \(a\). Since it has only \(s\) symbols, \(r_a\le s\).

Now fix one card \(C\). Every other card meets it once, so grouping other cards by their matching symbol gives

\[B-1=\sum_{a\in C}(r_a-1)\le s(s-1).\]

Therefore \(B\le s^2-s+1\). Equality forces every used symbol to occur \(s\) times; counting incidences then gives \(v=B\). No symbol pair can be used twice, and at equality the cards cover all \(\binom{v}{2}\) symbol pairs. For \(s\ge3\), this is exactly the complete projective-plane situation.

A counting bound is not an existence proof. Projective planes of order 6 and order 10 do not exist. Thus seven symbols per card do not give a complete 43-card plane, and eleven symbols per card do not give a complete 111-card plane. Smaller valid decks can still exist. Prime-power orders are guaranteed by finite fields; whether any projective plane of non-prime-power order exists remains open, including order 12.

A Compact Construction You Can Implement

The geometry translates directly into a deck generator. Give each grid point the integer label \(qx+y\), and reserve labels \(q^2\) through \(q^2+q\) for direction points. For prime \(q\), ordinary modular arithmetic suffices:

function buildDeck(q) {
  const cards = [];

  for (let slope = 0; slope < q; slope++) {
    for (let intercept = 0; intercept < q; intercept++) {
      const card = [];
      for (let x = 0; x < q; x++) {
        const y = (slope * x + intercept) % q;
        card.push(q * x + y);
      }
      card.push(q * q + slope);
      cards.push(card);
    }
  }

  for (let x = 0; x < q; x++) {
    const card = [];
    for (let y = 0; y < q; y++) card.push(q * x + y);
    card.push(q * q + q);
    cards.push(card);
  }

  cards.push(Array.from({ length: q + 1 }, (_, index) => q * q + index));
  return cards;
}

The code assumes a prime input; for nonprime prime powers its addition and multiplication must be replaced with field operations. Check every pair before using a generated deck. Finally, assign a different image to each label, keep that image identity consistent, and vary only its position, size, and orientation. The pictures hide the structure from the eye. They do not create it.

References