X-Wing

When a digit fits in only two cells in each of two rows, and those cells sit in the same two columns, the two rows fill both columns with that digit. Every other cell in those columns loses it. The same holds with rows and columns swapped.

FishHard8 min readChapter 5 of the learning path
In one line

When a digit fits in only two cells in each of two rows, and those cells sit in the same two columns, the two rows fill both columns with that digit. Every other cell in those columns loses it. The same holds with rows and columns swapped.

Removes candidates
Before thisHidden SingleClaiming Pairs and TriplesClaiming group. An X-wing uses the same idea, a digit locked into part of a line, with two lines working together. It also needs one digit's pencil marks written in across the grid.
the house we are working incells the deduction touchescells the pattern ownscandidates that must goShading marks the rows and columns being read, and the four corner cells of the pattern are highlighted. Pencil marks appear only on the cells a board is about.

How to spot it

Every technique before this one finds its pattern inside a single house. An X-wing needs two rows at once, and it reads one digit at a time.

Pick a digit and go down the rows, counting the places where that digit can still go in each one. Most rows give three, four or five. You want a row that gives exactly two. Note its two columns and keep going. If a second row also gives exactly two places, in the same two columns, the four cells are the corners of a rectangle. That rectangle is the X-wing.

The two rows do not have to be neighbours, and the corners do not have to share a box. On the grid below they sit in four different boxes.

1

Count the 3s row by row

Go down the grid looking for the 3. Rows four and six already have theirs. Rows one, two, five, seven and eight each leave it three to five places. Row three has three empty cells, and the 3 fits in two of them: the fourth and the seventh.

Row three pencilled. The 3 fits in two of its three empty cells.
2

Find a second row with the same two columns

Row nine also has exactly two places for the 3, and they are in columns four and seven as well. Two rows, two columns, four cells at the corners of a rectangle. No other row on this grid has the 3 in only two places, so this is the one pair of rows to check.

Rows three and nine. The 3 sits in the same two columns in both.
3

Follow the two ways it can go

Row three needs a 3, so one of its two corners takes it. Say it is the fourth cell. Then column four has its 3, and row nine has to use its other corner, in column seven. If row three's 3 goes in the seventh cell instead, row nine's goes in column four. The two 3s always sit on a diagonal of the rectangle, and either diagonal puts one 3 in column four and one in column seven.

Two diagonals. Each one puts a 3 in column four and a 3 in column seven.
4

Clear the 3 from the rest of both columns

Columns four and seven each get their 3 from these corners, whichever diagonal turns out to be right. No other cell in those columns can hold one. Five marks go: the 3 from the seventh and eighth cells of column four, and from the second, fifth and eighth cells of column seven. The four corners keep their 3s.

Five candidates struck from two columns. The rectangle's own cells do not change.
5

Read what the strike left behind

In column four, the cell in row seven showed only 1 and 3. Without the 3 it is a 1. The cell below it, in row eight, showed 3 and 6 and is now a 6. Both are naked singles. Before the strike this grid had no single of either kind anywhere. The X-wing is what opened it.

Column four after the strike. Two cells are down to one candidate.

Why the corners decide it

The argument never asked which diagonal is the true one. It needed two facts. Each row has to place the 3 somewhere, and each row has only these two columns to place it in. Two rows, each putting one 3 into the same pair of columns, fill both columns between them. A column holds one 3, so there is no room left for another.

On this grid the second diagonal is right: the 3 goes in the seventh cell of row three and the fourth cell of row nine. You can make the whole strike without knowing that.

Rows and columns can swap. If a digit fits in only two cells in each of two columns, and those cells share the same two rows, the digit leaves every other cell of those two rows. The question at the end of this page uses a column X-wing on the same grid.

Two places in each row are not enough

Rows seven and eight each have exactly two places for a 9. In row seven they are the sixth and the last cell. In row eight they are the sixth and the seventh. The rows share column six, and at a glance that looks like a rectangle.

Count the columns, though, and there are three: six, seven and nine. Two rows can put their 9s into three columns without filling any one of them, so nothing is locked. Treat it as an X-wing on columns six and nine anyway and you would strike the 9 from the last cell of row five. On this grid that cell is where column nine's 9 goes.

Before you strike, check the columns as well as the count. Both rows have to use the same two columns.

Rows three and nine: an X-wing

Columns four and seven, then four and seven again. Two columns. Both of them get their 3 here.

Rows seven and eight: not an X-wing

Columns six and nine, then six and seven. Three columns. Nothing can be struck.

The same four cells from the columns

After the strike, column four has the 3 in only two places, rows three and nine, and so does column seven. Read from the columns, the same four cells are an X-wing again. It removes nothing this time, because rows three and nine have no other cells with a 3. Every X-wing looks like this from the other side once it has been used.

A swordfish is the same argument with three rows and three columns. Each row can have two or three places for the digit, as long as all of them fall in the same three columns. It is the next technique on the path.

1Columns four and seven after the strike
The 3 now has two places in each column, rows three and nine. The same four cells, read the other way.
Rule of thumb

Work one digit at a time. Find two rows where it has exactly two places, then check the columns. The same two columns in both rows means the digit leaves the rest of those columns. A third column anywhere and there is nothing to strike.

Where this sits on the path

An X-wing places nothing. Like the subsets before it, it removes candidates and leaves the placing to the singles. On the grid above it made two naked singles in column four.

It opens the fish chapter. Patterns of this kind are called fish, and the X-wing is the smallest of them. The hidden triple, the last of the subsets, finds a lock inside one house. A fish finds one across several lines of the same direction. The swordfish comes next and adds a third row.

One question

Columns five and nine each have the 1 in only two places, and in both columns those places are in rows one and five. Which 1s can you strike?

Work out which two lines the columns fill with a 1 between them. That is where the strike happens.

Recap

Look for
One digit with exactly two places in each of two rows, in the same two columns in both. The four cells make a rectangle.
Scope
Two rows, with the strike in their two columns. Or two columns, with the strike in their two rows.
Result
The digit comes out of every other cell in those two columns. The four corners keep it.
Tell-tale
A row with only two places for a digit. Note the columns and look for a second row that matches.
If it fails
If the second row uses a different column, there is no X-wing. Try the same digit with columns as the base, or move to the next digit. If three rows share the same three columns, look for a swordfish.
0 of 44 techniques understoodBack to libraryNext · Swordfish
X-Wing in Sudoku: two rows, two columns, one digit