Advanced 9 min read
X-Wing — when one digit has four possible homes
Four cells in a rectangle, one digit, and a guarantee strong enough to cross out candidates in two whole lines.
The short version
An X-Wing happens when a single digit has exactly two possible cells in each of two parallel lines, and both lines point at the same pair of perpendicular lines. Four cells, one rectangle, one digit.
The guarantee it buys you is narrow but absolute: inside the two crossing lines, that digit cannot appear anywhere outside the four corners. You delete it and keep going.
The shape
Pick a digit. Pick two rows. In each of those rows, the digit must have exactly two possible cells, and both rows must use the same two columns. The four cells where they meet form a rectangle — the corners.
Equivalently, transpose the whole thing: two columns, each with exactly two homes for the digit, both using the same two rows.
The two versions are the same pattern viewed from different directions, and the eliminations follow the direction you came from. This is the part people get wrong, so it is worth naming:
- Base — the two lines where the digit is confined (the ones with exactly two homes each).
- Cover — the two perpendicular lines crossing the corners.
- Eliminations happen in the cover lines, outside the rectangle. Never inside it.
Why it works
The proof is a two-case argument, and it is short enough to hold in your head.
Say the digit is confined in columns 3 and 7, with possible cells only in rows 1 and 3. Now consider where the digit sits in column 3. It is either in row 1 or in row 3 — there is nowhere else.
- If it is in row 1 (column 3), then row 1 already has its digit. So in column 7, the digit cannot be in row 1. Column 7 only allows rows 1 and 3, so it must be in row 3.
- If it is in row 3 (column 3), the mirror applies: column 7's digit must be in row 1.
Either way, rows 1 and 3 each end up containing the digit exactly once, and both times it lands in column 3 or column 7. Therefore, in rows 1 and 3, the digit cannot be anywhere else. Delete it from the rest of both rows.
You never learn which corner holds the digit. That is fine — the elimination does not depend on knowing.
A real board
Here is the pattern on a live grid. The candidate lists are filtered down to the 4s — the filled cells stay as they are, everything else is noise.
Walk through it:
- In column 4, the 4 can only go in R8C4 or R9C4. Two cells, nothing else — and that column has seven empty cells.
- In column 8, the 4 can only go in R8C8 or R9C8. Two cells again.
- Same two rows both times. That is the rectangle: R8C4, R8C8, R9C4, R9C8.
Now apply the conclusion. Row 8 must contain a 4, and it must be in column 4 or column 8 — so the 4 pencilled into R8C3 and R8C2 is impossible. Row 9 offers one more: its 4 can only be at R9C4, R9C8 or R9C3, so R9C3 goes as well.
Three eliminations, and both rows are closed: their 4s can only sit in the rectangle. Note that how full a line looks tells you nothing. Column 8 was nearly finished, column 4 was wide open, and both had exactly two homes for the digit. The count is the only thing that matters.
How to scan for one
X-Wings are found digit by digit, and they are much easier to find if you scan the sparse lines first.
- Take one digit at a time. Do not look for shapes on the board; look for a specific number.
- Count homes per line. For the chosen digit, walk down each column and note how many cells can hold it. You want lines with exactly two. One is a hidden single, three or more is not usable here.
- Compare the two-home lines. If two columns both have two homes and they sit in the same two rows, you have an X-Wing. If the rows differ, keep going.
- Repeat across. The mirror version — two rows with two homes each, pointing at the same two columns — is the same search with rows and columns swapped. Most solvers scan rows, so column-based X-Wings get missed more often.
- Clear the cover lines. Remove the digit from the rest of the two crossing lines, outside the corners.
A practical shortcut: when a digit is nearly finished, it has few homes left, and nearly-finished digits are where X-Wings live. Start with the digit that appears most often on the board.
What it does not prove
An X-Wing says nothing about which corner holds the digit. It also says nothing about the two base lines — inside columns 3 and 7, the candidate positions are untouched. Every elimination happens in the perpendicular direction.
This asymmetry is the single most common error. Given a rectangle, people delete the digit from the columns instead of the rows, which is not justified by the pattern and will eventually break the board.
There is a second, subtler trap: the pattern requires exactly two homes per line. If a column has three cells for the digit, the rectangle does not exist even if two of those cells are corners. Three homes means the digit could escape to a third position, and the case argument collapses.
X-Wing and Swordfish
Swordfish is the same reasoning with three lines instead of two: three columns where the digit has two or three homes, all contained within three rows. It produces up to nine cells and eliminates across three rows.
If X-Wing is comfortable, Swordfish is not a new technique — it is the same counting exercise with a wider net. The scanning order is identical, and so is the rule that eliminations happen perpendicular to the base.
The family continues upward (Jellyfish uses four lines), but at that point the patterns become rare enough that other techniques usually finish the puzzle first.
Where to use it
X-Wings appear in puzzles that are otherwise stuck: no singles, no pairs, everything at three or four candidates. That is exactly when it is worth the thirty seconds of counting.
They are also the first technique that makes sudoku feel like chess rather than arithmetic — a move whose value is not a number, but a restriction on where numbers can go later.
Questions people actually ask
What is an X-Wing in sudoku?
A pattern where one digit is confined to the same two rows in two different columns, or the same two columns in two different rows. The four cells form a rectangle, and the digit can be eliminated from the rest of those two rows or columns.
How do I know whether to eliminate from rows or columns?
The base is the pair of lines where the digit is confined. If the digit has two homes in each of two columns, you eliminate from the two rows that cross them. If it has two homes in each of two rows, you eliminate from the two columns.
Does an X-Wing place a number?
Never directly. It removes candidates, and that often creates a naked single or another pattern. Treat it as a move that unlocks a move.
What is the difference between X-Wing and Swordfish?
Swordfish is the same idea with three lines instead of two, producing nine cells rather than four. Anything you can say about X-Wing generalises to Swordfish, and the scanning method is identical.