What Is an XY-Wing in Sudoku? Three Two-Candidate Cells

The XY-Wing is a Sudoku technique built from three cells that each have only two candidates. Call the candidates of the middle cell X and Y. If one cell that shares a row, column or box with it has X and Z, and another has Y and Z, then Z cannot go in any cell that sees both of those two cells.
In Advanced Sudoku Techniques I described the shape in words, next to the other techniques. This post does what the X-Wing post did: it takes one grid in the middle of a solve and goes from listing the candidates to the cell that gets settled once a candidate is erased.
The words are the same as before: a row runs across, a column runs down, a box is one of the 3×3 blocks, and a candidate is a digit that could still go in a cell. A cell is named by its row and column, as in “row 1, column 5”. Two cells “see” each other when they share a row, a column or a box.
Names
SudokuWiki calls this technique the Y-Wing. Its page says the name comes from the fact that it looks like an X-Wing, but with three corners, not four.
HoDoKu’s page on Wings calls it the XY-Wing and describes it as a short XY-Chain written as a pattern, so that it can be found more easily. HoDoKu calls the middle cell the pivot and the two other cells the pincers. This post uses the same words.
The grid
Here is a puzzle partway through. It has one solution. A dot is an empty cell.
1 2 3 4 5 6 7 8 9
row 1 . 2 . | 9 . 7 | 5 1 3
row 2 . 5 . | . 3 1 | 9 4 2
row 3 9 1 3 | 2 5 4 | 6 7 8
row 4 . 9 5 | . . 8 | 2 3 7
row 5 2 6 8 | 3 7 5 | 4 9 1
row 6 3 7 . | . 2 9 | 8 6 5
row 7 5 3 . | . . 6 | . 2 9
row 8 6 8 9 | 7 1 2 | 3 5 4
row 9 . 4 2 | 5 9 3 | . 8 6
There are 17 empty cells. No cell has a single candidate, and no digit has only one place left in any row, column or box. The basic techniques do not find the next cell.
Listing the candidates
If you write candidates in all 17 empty cells, 16 of them have two. The only one with three is row 4, column 4, with 1, 4 and 6. These four cells are the ones that matter:
1 2 3 4 5 6 7 8 9
row 1 W 2 . | 9 P 7 | 5 1 3
row 2 . 5 . | . 3 1 | 9 4 2
row 3 9 1 3 | 2 5 4 | 6 7 8
row 4 x 9 5 | . W 8 | 2 3 7
row 5 2 6 8 | 3 7 5 | 4 9 1
row 6 3 7 . | . 2 9 | 8 6 5
row 7 5 3 . | . . 6 | . 2 9
row 8 6 8 9 | 7 1 2 | 3 5 4
row 9 . 4 2 | 5 9 3 | . 8 6
Start with P, row 1, column 5. Row 1 already has 1, 2, 3, 5, 7 and 9, which leaves 4, 6 and 8. Column 5 has no 4, but the cell’s box has a 4 in row 3, column 6. So row 1, column 5 has the candidates 6 and 8.
The W in row 1, column 1 starts from the same 4, 6 and 8. Column 1 has a 6 in row 8, so its candidates are 4 and 8.
The other W, row 4, column 5, starts from what row 4 is missing: 1, 4 and 6. Column 5 has a 1 in row 8, so its candidates are 4 and 6.
The x, row 4, column 1, also starts from 1, 4 and 6. Column 1 has a 6, so its candidates are 1 and 4.
How the three cells fit
Row 1, column 5, with 6 and 8, is the pivot. Row 1, column 1, with 4 and 8, is in the pivot’s row. Row 4, column 5, with 4 and 6, is in the pivot’s column. Those two are the pincers.
In the letters from the start, X is 8, Y is 6 and Z is 4.
- The pivot has X and Y: 8 and 6.
- The first pincer has X and Z: 8 and 4. It shares the 8 with the pivot.
- The second pincer has Y and Z: 6 and 4. It shares the 6 with the pivot.
Both pincers have a 4. That is the digit you can erase. Each pincer shares a different digit with the pivot, and the two pincers are not the same pair. Those are the conditions for the pattern.
Erasing 4 from row 4, column 1
The pivot, row 1, column 5, is either 6 or 8.
Suppose it is 8. Row 1, column 1 is in the same row, so it cannot be 8. Its other candidate is 4, so it is 4.
Suppose it is 6. Row 4, column 5 is in the same column, so it cannot be 6. Its other candidate is 4, so it is 4.
Either way, one of the two pincers is a 4. As SudokuWiki puts it, whatever happens, the digit is certain in one of those two cells. You just do not know which one.
Row 4, column 1 shares column 1 with row 1, column 1, and row 4 with row 4, column 5. Whichever pincer holds the 4, there is a 4 in its column or its row. So row 4, column 1 cannot be 4, and you can erase that candidate.
Only cells that see both pincers
HoDoKu’s rule is that Z can be eliminated from any cell that sees both pincers.
In this grid, apart from the pivot, the only cell that sees both pincers is row 4, column 1. Take row 4, column 4 instead. It shares a row with row 4, column 5, but it has no row, column or box in common with row 1, column 1. If the 4 goes in row 1, column 1, nothing forces row 4, column 5 to be 4, so these three cells say nothing about a 4 in row 4, column 4. A cell that sees only one pincer is left open whenever the 4 lands in the other pincer.
Here the pincers sit in the pivot’s row and the pivot’s column, and with the target the four cells make the corners of a rectangle. That is the three-cornered X-Wing look that gives SudokuWiki its name. A pincer can also sit in the pivot’s box. Then the cells that see both pincers spread over a box and a row or column. The idea is the same: look only at cells that see both.
The cell that follows
Row 4, column 1 had the candidates 1 and 4. With 4 gone, it is a 1.
Once row 4, column 1 is a 1, no other cell in column 1 can hold a 1. Row 9, column 1 had 1 and 7, so it is a 7. From there, filling cells with a single candidate and digits with a single place finishes the grid.
At this point you still do not know whether the pivot is 6 or 8. Like the X-Wing, the XY-Wing tells you where a digit cannot go.
How to look for one
An XY-Wing search starts with the cells that have two candidates.
- Pick a two-candidate cell as the pivot. Call its candidates X and Y.
- Among the cells it sees, look for a two-candidate cell with X and one other digit.
- Look for one more two-candidate cell the pivot sees, with Y and that same other digit.
- Check whether any cell that sees both pincers still has that digit as a candidate.
In a grid like this one, with many two-candidate cells, there are many pairs to try. Once the pivot and the first pincer are chosen, the second pincer’s two digits are fixed: the pivot’s remaining digit and the digit from the first pincer. You only look for that pair among the cells the pivot sees.
The XY-Wing depends on correct pencil marks. If you leave out one candidate, a cell with three candidates looks like a cell with two. How to write marks is in How to Write Sudoku Pencil Marks, and an order for checking them is in Stuck on a Sudoku?. How case-splitting techniques like this one relate to guessing is in Is It OK to Guess in Sudoku?.
About Sudoku365
Sudoku365 is a Sudoku app for iPhone, iPad and Android. It uses the classic 9×9 board. It has four difficulties, Easy, Medium, Hard and Expert, with 300 puzzles each, 1,200 in total. There is a Daily Challenge with one puzzle a day and a streak, and two people can play head to head or together over Bluetooth.
Turning notes on lets you write candidates in the cells. With “Remove numbers from notes” in the settings (on by default), placing a correct digit erases the same note from the related cells. Selecting a cell highlights its row, column and box, and every cell with the same digit.
The app is free with ads, and a one-time Remove Ads purchase turns them off. Ideas for keeping a daily habit on your own are in Sudoku365 Tips, and for your first puzzle, see Getting Started with Sudoku365.
Sudoku365Daily sudoku, alone or with twoSee the app →