Among all the advanced Sudoku techniques, XY-Wing consistently gets the reaction "how did you see that?" from solvers who watch it being applied for the first time. It involves just three cells and produces an elimination that seems to come from nowhere — a distant cell losing a candidate because of a configuration in a completely different part of the grid. Once you understand the logic, it feels inevitable. Until you do, it genuinely looks like magic.
The Setup: Pivot and Two Wings
XY-Wing requires three bivalue cells — cells containing exactly two candidates each. They're named the pivot, wing 1, and wing 2. The candidates in the pivot cell are X and Y. Wing 1 contains X and Z. Wing 2 contains Y and Z. The pivot must see both wings (share a row, column, or box with each). The two wings do not need to see each other.
Wing 1: {X, Z} — sees the pivot
Wing 2: {Y, Z} — sees the pivot
Note: Z is the shared digit between the two wings.
X is shared between pivot and wing 1.
Y is shared between pivot and wing 2.
The Logic: Why Z Gets Eliminated
Here's the elegant reasoning. The pivot cell must be either X or Y — there's no other option. Follow both cases:
If the pivot is X: Wing 1 sees the pivot and the pivot is X, so Wing 1 cannot be X. Wing 1 only has two candidates ({X,Z}), so Wing 1 must be Z.
If the pivot is Y: Wing 2 sees the pivot and the pivot is Y, so Wing 2 cannot be Y. Wing 2 only has two candidates ({Y,Z}), so Wing 2 must be Z.
In both cases — regardless of whether the pivot resolves to X or Y — Z is placed in one of the two wings. Therefore, any cell that sees both Wing 1 and Wing 2 cannot be Z. It will always be eliminated by whichever wing ends up containing Z. The elimination is certain, and Z can be removed from every cell that sees both wings simultaneously.
Finding XY-Wing Patterns
With full candidate notation, scan for cells with exactly two candidates. These are your candidate pivot cells. For each such cell containing {X,Y}, look at all cells it can see (its row, column, and box) for cells containing {X,Z} (for any value of Z). Those are candidate Wing 1 cells. For each Wing 1 found, look for a cell the pivot also sees that contains {Y,Z} — the matching Wing 2.
When you find the triplet, identify all cells that see both wings and check if any of them contain Z as a candidate. If they do, eliminate Z from those cells. A single elimination might be all you get — but in a hard puzzle, that one elimination frequently opens up a cascade of simpler deductions that carry the rest of the solve.
XY-Wing vs. XYZ-Wing
Once XY-Wing is intuitive, XYZ-Wing is a natural extension. In XYZ-Wing, the pivot contains three candidates {X,Y,Z} instead of two. The elimination logic extends similarly, but only cells that see all three of the pivot, Wing 1, and Wing 2 can have Z eliminated — a tighter constraint but one that appears with reasonable frequency in very hard puzzles. Master XY-Wing first, and XYZ-Wing will follow naturally from the same underlying reasoning.