How to solve a Sudoku?

The rule to solve a Sudoku puzzle is really simple :

Fill in the grid so that every row, every column, and every 3x3 box contains the digits 1 through 9.

There are a lot of articles and websites about solving a Sudoku. But, here we tried a more formal description of the patterns to solve a Sudoku. In this way we can up, with more general rules and new patterns, as the 'Generalized X-Wing', and the 'Burma' patterns. We have also tried to prove, why the patterns work and what the relation is between the different patterns. For each pattern we have looked for a clear example, which contributes to the solution of the puzzle, but for the difficult patterns it isn't easy, because they are very rarely, and only appear in a very hard Sudoku.

In the explanation that follows, about how to solve a Sudoku puzzle, some words need some clarification:

Value :  one of the digits 1 through 9
Cell :  one of the 81 grid entries for a value
Box :  one of the 3x3 squares
Unit :  a row, column or box
Buddy :  the 'buddies' of a cell are the cells that share a row, column or box.
Candidate :  a possible value for a cell
Single Candidate:  a cell with only one possible value

Rows are counted from top to bottom, starting from 1 to 9.
Columns are counted from left to right, starting from 1 to 9.
A cell is indicated with a row and column number, for example r1c5.
The buddies of r3c7 are shown below. Every square has 20 buddies.
The value of a cell is never the same than the value of one of its buddies.
.

It is important to understand what a unit is (a row, column or box). A unit is a set of cells and when we use the set theory we can do operations on sets. As you see rows and columns have the same properties, but boxes have other properties. Each row intersects each column once. But a row or a column intersects only 3 boxes. Or the other way around a box intersects just 3 rows and 3 columns. The intersection between a row or a column and a box contains always 0 or 3 cells. You use this properties all the time, even without notice it. It 's so obvious that you do it automatically.

1. Single Candidates

This is the first thing you do. Be aware single candidates occur in two forms:

In the example you see the trivial placement of the number 9 in row 2 and column 9, because all other candidates in the box are eliminated due to the number 9 in row 3 and the number 9 column 8 (see the red lines). In the same way the number 9 can now be placed in row 8 (and in column 7).

We now used only the first part of the definition of a single candidate. The second part of the definition can be used, when the puzzle is almost finished, to find single candidates in a unit, where only a few unsolved cells (or just one) are left in a unit. Then it is easy to check what possible values can be entered for these cells. But be aware, some Sudoku puzzles are design, that you can only start solving it with the second part of the definition of a single candidate.

As you see, solving a Sudoku is that simple, just looking for single candidates. But not everything is, as it seems to be. Unfortunately, we ran out of single candidates, and with the simple rule we can't find new ones. So, it is time to switch to another strategy.

2. Single Unit Candidates

If all candidates for a value in a unit lie also in only one other unit ,
all candidates for this value may be eliminated from the other cells in that other unit.

This can be for 1, 2 or 3 candidates. Of course, for 1 candidate we have a single candidate and this was already solved in the first step. For 2 and 3 candidate we must always have a combination of a row and a box or a column and a box, because only the intersection of these units has 3 cells. (The intersection of a row and a column is always one cell). In some articles, people talk of finding pairs (twins) or triples, which is a practical interpretation of this rule here.

Again we have two possibilities:

If you look carefully, what we did in the first step. You find out, the obvious thing, just removing all possible candidates for a value in a unit, until only one cell (a single candidate) was left, for that value in the unit. (As shown with the red lines in the previous example). In step two, we do just the same, but we now remove all possible candidates for a value in a unit, until only 2 or 3 cells are left, for that value in the unit. When these cells are also in only one other unit, then they are the only candidates for that value in that other unit. These candidates are normally called single unit candidates.

When we look back to the Sudoku and try to solve value 5 for the bottom-left box we find 2 possibilities, both in the second column. With the set theory, we can now prove that the value 5 can not be somewhere else in the second column:

Both sets, the box and the column, must have the values 1 to 9 just only once. When we look to the box we find that the value 5 only can be in one of the cells from the intersection. As the value 5 can only be once in the second column, the value 5 can not be in the cells out side the intersection. So, these candidates for the value 5 in the second column can be removed. This gives us new information. (Marked with a red 5).

When we now look to the third row, the only candidates left for value 5 lie in the upper-right box. We find again the same pattern, but now we start from a row and can remove candidates in a box. (See again the red marks). This gives us new information over the value 5 in column 8. If we now look carefully, the value 5 can only be in the last row of column 8. Looking back again to the lower-left box, we can now fill in the value 5 in row 8, and we are back at ower starting point. We also met some of the magic of Sudoku, indeed, the value 5 was on option for the lower-right box, but we went around the grid and found it.

In fact, finding the 5 in the last row was the clue to solve this puzzle. At this point we have reduced a medium puzzle to a gentle puzzle. The rest of the puzzle can now be solved with the single candidate strategy of the first step.

3. Disjoint subsets

When N cells, in a unit, have only N candidates between then ,
those N candidates may be eliminated from the other cells in the unit.

This is easy to prove, when apply one of the candidates outside this N cells, then the candidate must be removed from this N candidates and we end up with only N-1 candidates for N cells, which is impossible.

When we apply the first two steps to this Sudoku, we find only 2 single unit candidates, which give us the following information:

When we fill in the pencil marks for all possible candidates in row 8. (See the red and green values). We can group the first four cells together, as four candidates for the values 1, 6, 7 and 9.

{1,6,7,9} = {1,7} U {6,7,9} U {1,6,7,9} U {1,7}

As we have exactly four values for four places, these values can't occur somewhere else in the row, and the candidates for this values may eliminated, from the rest of the row (see the red values). After elimination, the intersection of the set {1,6,7,9} with the candidates, of the cells that didn't contribute to this set must be empty. They are disjoint subset of the values 1 to 9. When we now look to cell r8c5 the only possible candidate left is value 4.

In practice, it is easier to start with the smallest sets. In the example here, it is easy to see that there are 2 cells with the only 2 candidates {1,7}, so this candidates can be removed from all other cells (see the orange values). This gives us 2 cells with the only 2 candidates {6,9}. But, we can still group four cells with four candidates for the values 1, 6, 7 and 9.

{1,6,7,9} = {1,7} U {6,9} U {6,9} U {1,7}

And remove this candidates from the other cells, in the same way as above.

It is also possible to work the other way around. When we take the following set of candidates:

{2,3,4,8}

This four candidates lie exactly in four cells, which means that each value must lie in one of this cells, and no other values can occur in this cells, and can be eliminated. So, we find again that we can eliminate the red values. This gives us an alternatively formulation of the disjoint subsets rule:

When all candidates for N values, lie also exactly in N cells, then all other candidates for this cells can be eliminated.

It is now clear, that in the example, all canditades of the unsolved cells can be divided in 2 disjoint and complemented subsets:

  1. The Naked Subset formed by the N cells in the unit with only N candidates for this cells.
  2. The Hidden Subset formed by the M values with only candidates in M cells in the unit.

Where N and M is the size of the subset, which must lie between 2 and the number of unsolved cells in the unit minus 2. The number of unsolved cells is equal to the sum of N and M. Since every Naked Subset is complemented by a Hidden Subset, the smallest of both sets will be no larger than 4 in a standard sized Sudoku. This also means that all subsets can be found, when looking for all hidden pairs, hidden triples, hidden quads and all naked pairs, naked triples and naked quads. Unpossible candidates are always removed from a Hidden Subset, which becomes a Naked Subset after removing this candidates. Most solvers are just looking for all possible naked subsets, when solving all the hidden subsets.

When a Naked Subset is locked in a single intersection of 2 units, it's called a Locked Subset. Because the intersection is part of 2 units, the Locked Subset can cause eliminations in both of them. A Locked Subset of size 2 is called a Locked Pair and one of size 3 is a Locked Triple. Because the intersection between 2 units can have maximum 3 cells, it is not possible to find Locked Quads. Locked Subsets are easy to spot, because the cells are very close to each other.

A Single Candidate can also be seen as a disjoint subset with only one value, and again this subset can be naked or hidden, which are the 2 possible occures of a Single Candidate explained above.

4. Simple Coloring

This technique is base on the very simple rule: when a number has only 2 candidates left in a unit, one candidate must be the solution and the other isn't. Now we can apply a different color to this candidates (called conjugate pairs), and one color will become the color of the solution, but we don't know which color yet.

Let's have a look to the image, the value 6 has only 2 candidates in the first box, r2c1 and r3c3, so we can start coloring. We now look if this candidates also belong to another unit, with only two candidates for this value 6. For cell r2c1 we have column one with cell r5c1, as we have already apply the blue color to the cell r2c1, we must apply the green color to r5c1. We can go on with this cell to cell r4c3, which is in the same box. Starting with the cell r3c3 we can color the chain r3c3, r2c1, r5c1, r4c3, r4c6, r9c6, r9c5, r2c5. We can not go on with cell r2c5, because the row and the box of this cell have 3 candidates for the value 6.

We can also coloring cell r3c4 from cell r3c3.

And cell r5c4 from cell r5c1 or cell r4c6.

When we look to the blue color, it is twice in row 2, twice in column 4 and twice in box 2. As a value can only be once in a unit, the cells with the blue color can't have the value 6 and all cells with the green color must have the value 6.

There is a second possibility, where Simple Coloring can help to eliminate candidates. When we look to the coloring for value 1, in the next image, no contradiction can be found. But, here are 2 lines with a green and a blue colored cell and with other cells that have the value 1 as candidate. Because the green or the blue cell will get the value 1, the other candidates on this lines can be removed, cells r6c4, r6c5 and r8c4. (In the next topic, the X-Wing, another technique is explained, to solve this example, in another way).

This give us another Simple Coloring rule, after coloring a value:

When there is a green and a blue cell in an unit, all other candidates for this value in that unit, can be eliminated.

This technique is also called 'Single Value Chains' or 'Single's Chains. We build a chain of colors starting with one color and ending with the other color, (a chain with a even number of elements), as the chains in the example:

green-blue-green-blue-green-blue  r6c1-r8c1-r9c3-r9c7-r8c8-r6c8  ==> eliminates r6c4 and r6c5
blue-green-blue-green             r8c1-r9c3-r9c7-r8c8            ==> eliminates r8c4
All candidates, that are a buddy of the first cell and the last cell of the chain can be eliminated, because, as a buddy, they are connected with a green and a blue cell. This gives us a more general rule, after coloring a value, (or looking to all the possible chains):

All candidates, that are a buddy of two cells with a different colors can be eliminated.

Possible chains for the first Simple Coloring example are:

r2c1-r5c1-r5c4-r4c6-r9c6-r9c5  ==> eliminates r2c5
r5c1-r5c4-r4c6-r9c6-r9c5-r2c5  ==> eliminates r2c1
r3c3-r4c3-r5c1-r5c4            ==> eliminates r3c4
r3c4-r3c3-r4c3-r5c1            ==> eliminates r5c4

Now, the relation between Simple Coloring until a contradiction occurs and Single Value Chains is clear. The cell, that causes the contradiction, can be eliminated, because it is a buddy of a green and a blue cell, (or a buddy of the first and last cell of a Single Value Chain).

The next example, shows a Sudoku, that is very hard to solve, without the following Single Value Chain:

Single Value Chain for value 9: r4c5 - r4c9 - r6c8 - r7c8
The Value 9 is no candidate for Cell r7c5.

5. X-Wing

When there are only two possible cells for a value in each of two different rows,
and these candidates lie also in the same columns,
then all other candidates for this value in the columns can be eliminated.

Likewise for 2 columns with 2 common rows.

This is easy to prove, when we apply a candidate for the value on one of the 2 columns but not on one of the 2 rows. This eliminates all other candidates of the column, and we end up with 2 rows with only one candidate for the value, on the same column, (which is allready impossible). When we now apply one of the single candidates left, the other single candidate is eliminated and we end up with a row with no candidates for the value, which is impossible.

Note that there are only two possible positions for the value 6 in each of row 1 and row 9 and that, critically, the candidate positions lie on the same columns. Consider the rectangle formed from the cells r1c6, r1c9, r9c6 and r9c9. Clearly, 6s must occupy two of those four cells - the pair r1c6 and r9c9 or the pair r1c9 and r9c6 - but we don't know which at this stage. (These pairs make an X-pattern, see the blue lines). However, regardless of which pair is occupied, we are able to eliminate the value 6 as a possibility from each cell in columns 6 and 9 apart from the vertices of our rectangle. In particular, we eliminate 6 as a possibility for the cell r7c9, which leaves 9 as the only possibility. The remainder of the problem is now solved easily.

Look back to the second Simple Coloring example, to find two X-Wings for the value 1:
r4c3,r4c7,r9c3,r9c7 and r6c1,r6c8,r8c1,r8c8

6. Generalized X-Wing

The funny thing about X-Wings is, people seem to forget that there are 3 kind of units (rows, columns and boxes). They only talk about rows and columns. But when we rewrite the rule for all units we get:

When there are only 2 candidates for a value, in each of 2 different units of the same kind,
and this candidates lie also on 2 other units of the same kind,
then all other candidates for that value can be eliminated from the last 2 units.

Now we have the 6 possiblities:

In the first example we have 2 boxes with only 2 candidates for a value (marked in green), these candidates lie also on 2 common rows, now all other possible candidates of the rows can be eliminated (marked in red).

When you always search for Single Unit Candidates first, then this pattern has no practical use. Indeed, when we look at the second row, the only possible candidates for the value lie all in the third box, which gives us a Single Unit Candidate and the same candidates (marked in red) can be eliminated.
(This proves the correctness of the pattern).

In the second example we have 2 rows with only 2 candidates for a value (marked in green), these candidates lie also on 2 common boxes, now all other possible candidates of the boxes can be eliminates (marked in red). Once again, with Single Unit Candidates, the same result is found.

In the next images, all the 81 different X-Wing patterns, for 2 (odd) rows and 2 (successive) boxes, are shown:
On a column, you find all 9 patterns for a constant pair of candidates of the first box.
On a row, you find all 9 patterns for a constant pair of candidates of the second box.

When we now connect the 4 possible candidates we get a trapezium and the 2 possible solutions are still the 2 diagonals.

Until now we have treated a box, as a kind of slanted row or slanted column, but we have not used the property that boxes can have 3 cells in common with a row or a column. In the example below, the X-Wing for value 9 is now drawn between 4 different sets of cells, in stead of 4 different single cells. We have started with 2 boxes and all candidates for the value 9 of these boxes (marked in blue), lie on 2 common rows. All other candidates of the rows can be eliminated (marked in red). Again this is easy to prove, when we apply a candidate marked in red as a solution, then all other candidates on the same row must be eliminated. We now end up with all possible candidates for the 2 boxes on the same row, which is an impossible situation, because the value can only be once on the row. (Or using one of the remaining single unit candidates eliminates all the candidates of the other box).

The general rule is now:

When all candidates for a value, in each of 2 different units of the same kind,
lie also on only 2 other units of the same kind,
then all other candidates for that value can be eliminated from the last 2 units.

In practise, the rule isn't check, but one is looking to the placement (the pattern) of the candidates for a number. As you can see in the next two examples, the pattern is directly seen, without counting numbers.

7. Swordfish

This is a generalisation of the X-Wing.

Look for N columns (2 for X-Wing, 3 for the Swordfish, 4 for a Jellyfish, 5 for a Squirmbag) with only two candidate cells for a given value.
If these fall on exactly N common rows, and each of those rows has at least 2 candidate cells, then all N rows can be cleared of that value (except in the defining cells!).


Likewise for N rows with N common columns.

8. Burma

This is a generalisation of the Swordfish (and the X-Wing).

Look for N columns with only C candidate cells for a given value, with N >= C.
If these fall on exactly N common rows, and each of those rows has at least C candidate cells, then all N rows can be cleared of that value (except in the defining cells!).


Likewise for N rows with N common columns.

Some Burma patterns are listed below:

 Pattern name CNPossible placements
of the value in the pattern
Burma(1,1)Single Candidate 111
Burma(2,2)X-Wing 222
Burma(2,3)Swordfish 232
Burma(2,4)Jellyfish 242
Burma(2,5)Squirmbag 252
Burma(3,3)Burma 336

If we look to the possible placements of the value in the pattern we find some interessing properties. For an X-Wing we have 2 possibities, (one of the two diagonals of the surrounding rectangle, see above). His also means, when we can place the value in one of the cells of the pattern, the other value can also be placed. Because, when we place a value, two other candidates can be eliminated (from the same row and column), and only one candidate for the value is left. The same property works also for all the Burma patterns with 2 candidates. When we place one value, whe have a chain of eliminations, because each placement gives eliminations, and this eliminations generate new single candidates until the whole pattern is solved.

For the Burma(3,3) pattern we have 6 different placements. But now when we place one value, we get after elimination, a Burna(2,2) or an X-Wing, which gives us still 2 possibilies for the rest of the pattern. For each of the three cell of a row or a column of the pattern we have an X-Wing left, 3 X-Wings give us 6 possibilites.

9. Forcing chains

A simple forcing chain is when you have lots of cells with just 2 candidates. And everytime a value is set for one cell, the next cell in the chain is forced to be just one of its two values. Look to the example:

We start the chain by picking the cell r5c3 with the two possible candidates {2,8}. If we pick 8, we look for another buddy of this cell, with two candidates where 8 is one of the candidates. In this case, a cell to the right at r5c5 will do... if r5c3 took the value 8, then r5c5 could not be 8, hence it would have to be 9. Now we have to look for a buddy of cell r5c5, with two candidates where 9 is one of the candidates ... After some more cells we come back to the starting cell.

The whole chain becomes: r5c3=8 => r5c5=9 => r2c5=5 => r2c3=9 => r7c3=8 => r5c3=2
or the connected candidates are 28-89-95-59-98-82

And it's that last step that seals the deal for this technique... if we start cell r5c3 with the value 8, a chain occurs which suggests the same cell would have to take the value of 2. Clearly, that is an impossible situation! So, the value 8 can be removed as candidate for cell r5c3, which gives us directly value 2 as the only candidate left for cell r5c3.

A chains of the form ab-bc-cd-...-xy-yz, of pairs where the second element of each pair (except the last) equals the first element of the next pair, also called 'a simple bivalue xy-chain'. If the field corresponding to the first pair has the second value b, then the next has the second value c, etc., and the last has the second value z. If that is a contradiction - for example because the chain was a cycle, the first and last pair belong to the same square, and the last pair is ba - then the field corresponding to the first pair must be a.

The first element of the chain can have more than 2 candidate, because this element is not triggered by another cell. So, a chain of the form Xa-ab-bc-...-za-aX , where X stands for one or more candidates, proves that the first element is not a.

Read more about forcing chains in the next topic, the XY-Wing.

10. XY-Wing

A rather common version of a forcing chain is the short chain Az-zx-xy-yz-zA, called 'XY-Wing'. Its name comes from the pattern formed by the numbers and is not related to X-Wing.

In practice, this chain is build from its center cell (called the pivot). We are looking for three cells, each of which contains exactly two candidates. The center cell contains XY and we require a buddy of this cell to contain XZ, and another buddy of the XY cell to contain YZ (this 2 buddies are called the pincers).

All the cells that are buddies to both XZ and YZ cannot contain Z. This is simple to prove, because it doesn't matter whether the XY is X or Y, the Z will be in either XZ or YZ and hence can be removed from their buddies.

This is intresting, we can look to a forcing chain in the same way as we look to the XY-Wing and omitt the starting point. Then we have a chain ab-bc-cd-...-xy-yz-za that always starts and ends with the same value. There are only two possible solutions for this chain: a-b-c-...-x-y-z and b-c-d-...y-z-a. The first cell or the last cell of the chain must have the value a. So, all the cells that are buddies of both, the first and last cell of the chain, can not contain a.

When we look back to our forcing chain example:

We take a cell somewhere in the chain, let's take r2c3, this cell can have the values 5 & 9. When now try each possible value and work to the end of the chain, each value results in a different cell at the end of the chain, but with the same value 8.

r2c3=5 => r2c5=9 => r5c5=8
r2c3=9 => r7c3=8

For the 2 possible values of cell r2c3, the value 8 must be in cell r5c5 or in cell r7c3 and can not be in cell r5c3, because cell r5c3 is one of the two cells, that is a buddy of cell r5c5 and cell r7c3.

Of course, depending of the place of the pincers of the chain, more than two cells can be a buddy of both. Because each row intersects each column, there are always at least two common buddies for pincers, and one is the pivot. This can be seen in the next real XY-Wing example with 6 common buddies for the pincers (twice an intersection of a row and a box). Up to 5 eliminations are possible in this formation. (The 6 common buddies without the pivot).

XY-Wing: r9c3 - r7c2 - r7c5
The Value 8 must lie in Cell r7c5 or in Cell r9c3
The Value 8 is no candidate for Cell r9c4, r9c5 and r7c1.

Also the shortest chain ab-ba of 2 cells, can be seen as a forcing chain. This cells are part of a same unit, (2 successive cells in a chain are always part of a same unit), and are called naked pairs, as described above.

11. XYZ-Wing

The XYZ-Wing is an extension of the XY-Wing, where the pivot cell also carries the Z candidate. Upto 2 candidates can be eliminated by an XYZ-Wing, because they need to be also a buddy of the pivot. For this reason the pattern is always of the form: One of the pincers shares a row or column with the pivot, the other shares a box with the pivot. The proof of this pattern is easy, the Z value must be in one of the 3 cell of the XYZ-Wing, so each cell, that is a buddy of this 3 cells can not contain Z.

XYZ-Wing: r7c8 - r7c7 - r3c7.
The Value 8 must lie in Cell r7c8, r7c7 or r3c7.
The Value 8 is no candidate for Cell r8c7.

A XY-Wing or XYZ-Wing with all cells in a same unit, is a naked triple with the values {X,Y,Z}.

The next example shows how different solving techniques can be combined, we have the XYZ-wing r3c2 - r3c7 - r4c7 and the Single Value Chain of value 4: r3c2 - r2c3 - r2c8. When we enter the 2 possible value for the cell r3c2 we find out that the value 4 is no candidate for cell r1c7:

With the value 2 for cell r3c2, we use the naked pair left from the XYZ-wing (or the single candiate for the value 2 in column 7).
With the value 4 for cell r3c2, we follow the Single Value Chain.

Remark, also Simple Coloring could be used to find the same result.

12. Unique Rectangle

This method is actually a bit controversial, because the logic it uses, assumes the fact that the Sudoku puzzle, you are working on, has only one unique solution.

For a rectangle of four unsolved cells, that share exactly two rows, two columns and two boxes, where three of the four cells have the exact same two candidates in them, those candicate can be removed from the fourth cell.

Let 's have a look to the example:
See the four cells that make up the corners of the red rectangle? Notice how three of them have only the values 3 & 5 in them? Well, we can safely remove the 3 & 5 from the fourth cell. They just canít possibly be candidates if this is a true Sudoku puzzle. This is simple to prove, let's take value 5 as the solution for the corner r1c3. This gives us the chain of solutions: r1c2=5 => r1c7=3 => r2c7=5 => r2c2=3, so far, so good we have a solution, but we can simple swap the 3 and the 5 in the chain: r1c2=3 => r1c7=5 => r2c7=3 => r2c2=5 and we have another solution, this is not possible in a real Sudoku with only one solution. So, the chain can not start with the value 3 or 5 and this candidates can be removed.

One thing is very important, when we swap 2 values in a unit, cells in other units must also change, and this changes can affect again other cells in other units. When the four cells share exactly two rows, two columns and two boxes this changes are just limited to this four cells, and no other cells are affected. In our example, swapping the values in the rows, swaps at the same time also the values in the boxes.

As seen in the example, the Unique Rectangle technique works as follow: For all Unique Rectangles look for potential deadly patterns and take advantage of them. Use the following definition to find a deadly pattern:

A rectangle of four unsolved cells, that share exactly two rows, two columns and two boxes, where all four cells have the same two candidates in them, is a deadly pattern for this values.

Depending of the placement of the other candidates, eliminations are sometimes possible, as a result of breaking the deadly pattern and looking for an unique solution. This is again shown in the next example:

To get an unique solution the value 8 must be in cell r2c1 or r2c9 and can't be somewhere else in row 2. So, the value 8 can be eliminated as candidate for cell r2c7.

The next Sudoku can be solved, by using two times the Unique Rectangle method in again another way:

The only possible placement, of the value 4, is on one of the diagonals of the Unique Rectangle (on r5c8 and r9c9 or on r5c9 and r9c8). The other diagional may not contain two times the value 9, because this give us a deadly pattern of the candidates 4 and 9. Lets try to enter the value 9 in cell r5c8 this solves the Unique Rectangle to the deadly pattern: r5c8=9 => r5c9=4 => r9c9=9 => r9c8=4, so value 9 is no candidate for cell r5c8. In the same way, we find out, that the value 9 is no candidate for cell r5c9.

In the next Unique Rectangle, only three cells have the same two candidates (values 5 and 9) and the fourth cell has only one of this two candidates (value 5), but this value 5 has an additional contrain, it forms an X-Wing.

Now the value 5 must be on one of the diagonals of the Unique Rectangle (on r5c6 and r6c9 or on r5c9 and r6c6). Now it is clear, that the other diagional may not contain the same two values, because this gives us a deadly pattern. So, the value 9 must be eliminated as candidate of cell r5c6 or r6c9. Lets try to enter the value 9 in cell r6c9 this solves the Unique Rectangle to the deadly pattern: r6c9=9 => r6c6=5 => r5c6=9 => r5c9=5, so value 9 is no candidate for cell r6c9.

For this example, the Unique Rectangle method can be defined in another way, when we start with the naked pair of this Unique Rectangle:

When one of the values of a naked pair, is also an X-Wing, that shares exactly two rows, two columns and two boxes, (as an Unique Rectangle does), then the other value can be remove from the cells of this rectangle, that doesn't belong to the naked pair.

When we look back to the last example, it isn't a real Unique Rectangle, because not all cells have the same two candidates (value 5 and 9) in them, and we have to use the definition with the naked pair and the additional X-Wing constrain. Let's call it a hidden Unique Rectangle, because we can simple at the value 9 as a candidate of cell r5c9, to get the same Unique Rectangle pattern, as in one of the examples above, that removes the 9 from cell r5c9 and cell r6c9. Now it must be clear that the additional existence of the X-Wing is crucial for the elimination of this candidates.

In the next example, the Unique Rectangle doesn't have a naked pair. But the pairs are on a diagonal of an X-Wing of one of its values. Now we can remove the value of the X-Wing from the cells of the other diagonal, because they make a deadly pattern:
r1c6=6 => r6c6=9 => r6c4=6 => r1c4=9, so value 6 is no candidate for cell r1c6.
r6c4=6 => r1c4=9 => r1c6=6 => r6c6=9, so value 6 is no candidate for cell r6c4.

The great thing about Unique Rectangle is, it is easy to spot Ė and because of that, you actually see it quite often! Most people define it as a diabolical strategy, but to me is a normal strategy as for example naked pairs is.

Some Sudoku puzzels, with normally more than one solution, can have only one solution due to other constrains, for example: every main diagonal has the numbers 1 to 9 without repetition.

13. Nishio

Will entering a particular value prevent completion of the other placements of that value? If the answer if yes, then that candidate can be eliminated.

Given a value and a candidate cell, the Nishio rule considers whether the placement of the given value within the given cell would allow the remaining instances of that value to be placed. The remaining placements have to be trivial, i.e. each value has to be placed in a row, column or box where there exists just a single candidate cell - where no trivial placement exists, the candidate can not be eliminated. When the remaining values cannot be placed, the initial candidate can be eliminated.

It's rather difficult to understand what is happening here. But when we look back to the proof of the X-Wing, it becomes clear. The Nishio pattern works just that way. We apply a candidate for a value as part of the solution and look if there are conflicts with other candidates. This is done with recursive elimination, each time a candidate is solved all other possible candidates of the same units are eliminated and new single candidates come up, which give new eliminations and so on. The Nishio pattern stops, when there is a unit with no candidates left for the value, which means, it was a bad guess, and the original candidate can never be part of the solution and can be eliminated. Or when no more single candidates for the value can be found, which means that the original candidate can't be eliminated (yet). Remark that not all patterns are detected with Nishio, some patterns give also an impossible situation, but never end up to a unit with no possible candidates left. See, the Generalized X-Wing for an example. These patterns can be found when not only single candidates are eliminated, but also single unit candidates, X-Wings, and so on.

It is clear now, the Nishio pattern is a generalization of the X-Wing, Swordfish.

Some people say, that the Nishio pattern isn't a real pattern, but a trial-and-error method. But what is trail-and-error? When we look for a single candidate and we take a cell and try if 1 goes in, 2 goes in, 3 goes in ... until we have test all the values, or until we found 2 possible candidates for the cell. This is also a trial-and-error method, isn't?