Sudoku Solver

Hard

X-Wing (Row)

A rectangular pattern formed by a candidate appearing twice in two rows.

The X-Wing (Row) is the horizontal counterpart to the X-Wing (Col). It finds a logical restriction based on rows that eliminates candidates from columns.

Interactive Example

1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1
1 2 3 4 5 6 7 8 9
8
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
5
1 2 3 4 5 6 7 8 9
4
1 2 3 4 5 6 7 8 9
7
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
4
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
7
1 2 3 4 5 6 7 8 9
1
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
9
1 2 3 4 5 6 7 8 9
8
1 2 3 4 5 6 7 8 9
8
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
2
1 2 3 4 5 6 7 8 9
9
1 2 3 4 5 6 7 8 9
4
1 2 3 4 5 6 7 8 9
3
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
5
1 2 3 4 5 6 7 8 9
9
1 2 3 4 5 6 7 8 9
7
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
2
1 2 3 4 5 6 7 8 9
8
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
4
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
5
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
7
1 2 3 4 5 6 7 8 9
7
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
6
1 2 3 4 5 6 7 8 9
1
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
5
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
4
1 2 3 4 5 6 7 8 9
1
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
6
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
3
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
4
1 2 3 4 5 6 7 8 9
5
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
2
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
7
1 2 3 4 5 6 7 8 9
4
1 2 3 4 5 6 7 8 9
5
1 2 3 4 5 6 7 8 9

Click "Apply Logic" to see the strategy in action.

Real Example Explanation

In the interactive example above, we are tracking the number 8:

  1. Scan Rows: Look at Row 5 and Row 9.
  2. Count Candidates:
    • In Row 5, the number 8 can only go in Column 3 (R5C3) and Column 6 (R5C6).
    • In Row 9, the number 8 can only go in Column 3 (R9C3) and Column 6 (R9C6).
  3. The Rectangle: These four spots form a perfect rectangle.
  4. The Logic:
    • We need two 8s to fill these two rows.
    • They must be either in the "Top-Left & Bottom-Right" corners OR the "Top-Right & Bottom-Left" corners.
    • In either case, Column 3 gets one 8, and Column 6 gets one 8.
  5. The Elimination: Since these two columns are effectively "claimed" by the X-Wing pattern in these rows, no other cell in Column 3 or Column 6 can contain an 8. We can safely remove 8 from the cells highlight in Red.

How the Logic Works

It helps to think of this as Horizontal Chutes.

You have two horizontal tubes (Row 5 and Row 9) that each need to hold a ball (number 8). The balls can only sit at position A (Col 3) or position B (Col 6).

If you put a ball at position A in the top tube, the ball in the bottom tube must go to position B (because position A is taken for that column? No, actually, it's simpler). Because both rows are restricted to the same two columns, those two columns become "locked" for those specific row intersections.

Why does it eliminate from Columns? Because the premise started with Row constraints. The logic forces the columns to behave a certain way. If you start with restricted Columns (X-Wing Col), you eliminate from Rows. If you start with restricted Rows (X-Wing Row), you eliminate from Columns.

How to Spot It

  1. Pick a Number: Focus on one number (e.g., 8).
  2. Scan Horizontal Lines: Look for rows where that number appears as a candidate exactly twice.
  3. Check Verification: If you find two rows that align perfectly (same two columns), you have an X-Wing (Row).
  4. Eliminate Vertically: Remove that number from the rest of the columns.

Related Strategies