Mathwords logoMathwords

Sudoku — Definition & Example

Sudoku is a logic puzzle in which you fill a partly completed grid so that every row, every column, and every outlined box contains each symbol exactly once. The standard version uses a 9×9 grid with nine 3×3 boxes and the digits 1 through 9.

A Sudoku grid of order nn is an n2×n2n^2 \times n^2 array divided into n2n^2 non-overlapping n×nn \times n boxes. A completed grid is a Latin square on the symbols {1,2,…,n2}\{1, 2, \dots, n^2\} with one extra condition: each box also contains every symbol exactly once. A Sudoku puzzle is a partial grid with exactly one valid completion. The digits act only as labels, so the puzzle requires no arithmetic.

Worked Example

Problem: A 4×4 Sudoku (order n=2n = 2) uses the digits 1 to 4 and has four 2×2 boxes. Rows 1 to 4 read: (1, _, _, 4), (_, 4, 1, _), (2, _, _, 3), (_, 3, 2, _). Find the digits in row 1, columns 2 and 3. 1⋅⋅4⋅41⋅2⋅⋅3⋅32⋅\begin{array}{|cc|cc|} \hline 1 & \cdot & \cdot & 4 \\ \cdot & 4 & 1 & \cdot \\ \hline 2 & \cdot & \cdot & 3 \\ \cdot & 3 & 2 & \cdot \\ \hline \end{array}
Step 1: Row 1 already contains 1 and 4. The empty cell in column 2 must therefore hold one of the remaining digits.
{1,2,3,4}∖{1,4}={2,3}\{1,2,3,4\} \setminus \{1,4\} = \{2,3\}
Step 2: Column 2 already contains 4 and 3, so you can rule out 3. Only one candidate is left.
{2,3}∖{3,4}={2}\{2,3\} \setminus \{3,4\} = \{2\}
Step 3: Row 1 now reads 1, 2, _, 4, so the last empty cell must be 3. Check it against the other constraints. Column 3 holds only 1 and 2, and the top-right box holds only 4 and 1, so 3 breaks no rule.
{1,2,3,4}∖{1,2,4}={3}\{1,2,3,4\} \setminus \{1,2,4\} = \{3\}
Answer: Row 1 is 1, 2, 3, 4. The cell in column 2 is 2 and the cell in column 3 is 3.

Why It Matters

Sudoku is a standard example of a constraint satisfaction problem, the same kind of problem a computer solves when it builds a class schedule or assigns radio frequencies. Mathematicians have counted exactly 288 completed 4×4 grids and about 6.67 sextillion completed 9×9 grids. A 2012 computer search showed that a 9×9 puzzle with a unique solution needs at least 17 given clues.

Common Mistakes

Mistake: Checking only the row and column before placing a digit and ignoring the box.
Correction: A grid that satisfies only the row and column rules is a Latin square, not a Sudoku. Before you place a digit, also confirm that it does not already appear in the same box.

Related Terms

  • Magic Square — Grid puzzle governed by equal sums, not placement rules
  • Knight's Tour — Another constraint puzzle played on a square grid
  • Pentomino — Another grid puzzle: the 12 pentominoes tile a 6×10 rectangle in exactly 2,339 ways
  • Latin Square — Sudoku is a Latin square with extra box rule
  • Constraint — Each row, column, and box rule limits allowed digits