Here is my second draft of "The Ultimate Guide to Unique Rectangles" for your comments and suggestions. This is largely based on my documentation of the heuristic in the Sudoku Susser manual.
This version covers Type-1, -2, -2B, -3 and -3B (locked sets only), -4 and -4B variants. When I get sample puzzles for -3 (hidden set), I will add them. Also, please specifically comment upon sub-variants that I have missed (such as when one of the digits forms a conjugate pair)
As this document evolves, I will post complete new versions of it into this thread.
Changes in 0.2 : added Type-4 Unique Rectangles
The Ultimate Guide to Unique Rectangles - version 0.2The Unique Rectangles pattern was first noticed by ??? and subsequently expanded upon by contributions from ???,??? and ????.
Unique Rectangles take advantage of the fact that Sudoku can only have 1 solution in order to make useful inferences. For example, consider the following puzzle:
- Code: Select all
+----------------+----------------+----------------+
| 25 8 24 | 45 6 3 | 9 7 1 | (note: the four squares
| 357 37 1 | 58 2 9 | 6 4 358 | in the unique rectangle
| 6 39 349 | 458 7 1 | 238 28 2358 | are marked with *'s)
+----------------+----------------+----------------+
| 4 *25 *2356 | 7 9 8 | 1 26 23 |
| 27 1 26 | 3 4 5 | 278 268 9 |
| 379 379 8 | 6 1 2 | 37 5 4 |
+----------------+----------------+----------------+
| 8 *25 *25 | 1 3 7 | 4 9 6 |
| 39 4 39 | 2 8 6 | 5 1 7 |
| 1 6 7 | 9 5 4 | 28 3 28 |
+----------------+----------------+----------------+
(
Graphic representation)
Note the squares R4C2, R4C3, R6C2 and R6C3; they form a group of 4 squares that share exactly 2 blocks, 2 rows and 2 columns. The important insight here is that
if they also only share 2 possibilities, then the puzzle has more than one solution!
If you think about it, it is obvious: if in the above puzzle, the four squares had possibilities <25>, then two diagonally-opposite squares must be <2>, and the other two must be <5>. No matter which way you arrange them, the 2 rows, columns and blocks would have one 2 and one 5, and you could exchanges the 2s and 5s and the puzzle would still be valid -- the puzzle would have more than one solution. This configuration of 4 squares with the same 2 possibilities in two rows, two columns and two blocks is called the
deadly pattern. Find it, and you know youve gone wrong. But the knowledge that that particular pattern cannot appear lets you make progress:
Heres how: If you can find a rectangle such as the one shown above, with 4 squares sharing 2 rows, columns and blocks, 3 of which share the same two possibilities, and the 4th having the two possibilities plus one or more extra possibilities, then you can remove the original two possibilities from the 4th square. In this case, R4C3 can be reduced to <36>.
The proof is pretty straightforward once you get your head around the basic idea.
Assume R4C3 is 2. That forces R4C2 to be 5, R7C2 to be 2, and R7C3 to be 5. Thats the deadly pattern; you can swap the 2s and 5s and the puzzle still can be filled in. So if the Sudoku is valid, R4C3 cannot be 2.
The exact same logic applies if you assume R4C3 is 5. So R4C3 cant be a 2, and cant be a 5 -- it must be either 3 or 6.
This pattern is called a
Type-1 Unique Rectangle. But it turns out there are several other interesting unique rectangle patterns, all of which depend on having to avoid the deadly pattern.
Consider this puzzle:
- Code: Select all
+----------------------+----------------------+----------------------+
| 9 3 6 | 14 128 148 |-24 7 5 | (note: the squares that
| 8 7 5 | 49 -29 3 |*246 *246 1 | can be reduced are
| 1 4 2 | 7 5 6 | 3 8 9 | marked by -'s)
+----------------------+----------------------+----------------------+
| 236 26 7 | 134569 1369 149 | 8 1359 24 |
| 5 1 4 | 8 39 2 | 7 39 6 |
| 236 8 9 | 13456 7 14 | 15 135 24 |
+----------------------+----------------------+----------------------+
| 4 25 18 | 16 168 7 | 9 25 3 |
| 236 256 138 | 139 4 189 | 125 125 7 |
| 7 9 13 | 2 13 5 |*46 *46 8 |
+----------------------+----------------------+----------------------+
(
Graphic representation)
Here we have a similar pattern, but this time, R2C7 and R2C8, the squares which share the same block have a single extra possibility - in this case, <2>.
To make subsequent discussion easier to follow, we will refer to the two squares that only have two possibilities as the
floor squares (because they form the foundation of the Unique Rectangle); the other two squares, with extra possibilities shall be called the
roof squares.
In this
Type-2 Unique Rectangle, one of the blocks contains the floor squares, and the other contains the roof squares. In order to avoid the deadly pattern, 2
must appear in either R2C7 or R2C8 (the roof squares). Therefore, it can be removed from all other squares in the groups that contain both of the roof squares (in this case, row 2 and block 3).
Now that youve gotten your head around the basic unique rectangle concept, the proof should be pretty obvious:
If neither R2C7 or R2C8 contains a <2>, then they both become squares with possibilities <46>. This results in the deadly pattern - so one of those squares must be the <2>, and none of the other squares in the intersecting groups can contain the 2. So R1C7 and R2C5 can have <2> removed, immediately solving them.
There is a second variant of Type-2 Unique Rectangles:
- Code: Select all
+----------------+----------------+----------------+
| 2 9 1678 | 3 4678 46 | 156 157 17 |
| 67 146 1467 | 5 2 9 | 136 8 137 |
| 3 5 678 | 68 678 1 | 4 9 2 |
+----------------+----------------+----------------+
| 1 *346 -2346 | 9 *346 5 | 8 247 47 |
| 8 7 456 | 46 1 2 | 59 3 49 |
| 9 *34 25 | 7 *34 8 | 125 125 6 |
+----------------+----------------+----------------+
| 4 2 9 | 1 5 3 | 7 6 8 |
| 5 8 136 | 2 469 7 | 139 14 1349 |
| 67 136 1367 | 468 4689 46 | 1239 124 5 |
+----------------+----------------+----------------+
(
Graphic representation)
In this puzzle, we have the same pattern of 4 squares in 2 blocks, 2 rows and 2 columns. The floor squares are R6C2 and R6C5, and the roof squares are R4C2 and R4C5. However, in this Unique Rectangle, each of the blocks contains one floor and one roof square. This is perfectly fine, but it means that the only group that contains both of the roof squares is row 4, so that is the only group that you can attempt to reduce; in this case, R4C3 cannot contain a 6. This is called at
Type-2B Unique Rectangle.
Unique Rectangles can also be used to find locked sets. Consider the following puzzle:
- Code: Select all
+----------------------+----------------------+----------------------+
| 478 1 9 | 78 3 5 |*26 *26 47 | (note: the squares marked
| 3457 345 6 | 9 24 27 | 1 34 8 | with +'s form part of the
| 3478 2 378 | 1 46 68 | 379 349 5 | locked set)
+----------------------+----------------------+----------------------+
| 3589 35689 4 | 38 56 1 | 3589 7 2 |
| 27 358 1 | 4 9 27 | 358 358 6 |
| 235789 35689 2378 | 378 256 68 | 4 1 39 |
+----------------------+----------------------+----------------------+
| 1 7 -23 | 5 8 4 |*2369 *2369 +39 |
| 2489 489 5 | 6 7 3 | 28 248 1 |
| 6 348 38 | 2 1 9 |-3578 -3458 47 |
+----------------------+----------------------+----------------------+
(
Graphic representation)
In this puzzle, the roof squares contain the same two extra possibilities. Squares R7C7 and R7C8 both have possibilities <2369>; the <26> matching the floor squares, plus extra possibilities <39>.
In order to preclude the deadly pattern, at least one of R7C7 and R7C8 has to be a 3 or a 9. We dont know which square its in, or whether it is a 3 or a 9. Its sort of fuzzy, which reminds me of quantum physics. But what we can do is treat the two squares as a single
quantum square with possibilities <39>, and use this to find locked sets in their shared groups that permit reductions to be made.
For example, in the puzzle above, R7C7+R7C8 are the quantum square, and it plus R7C9 form a locked pair on 39 in both row 7 and block 9. We know there has to be a 3 or a 9 in R7C7 or R7C8 in order to prevent the deadly pattern; if it is a 3, then R7C9 must be a 9; if it is a 9, then R7C9 must be a 3. Either way, <39> can be excluded from other squares in their common groups. So R7C3, R9C7 and R9C8 can have <3> removed.
It is important to realize that these
Type-3 Unique Rectangles are not limited to roof squares that share 2 possibilities. In fact, you can treat the roof squares as a single quantum-square containing
all the possibilities that are not in the floor squares! Consider this puzzle:
- Code: Select all
+----------------+----------------+----------------+
| 2 1 69 | 4 5 7 | 8 69 3 |
| 7 5689 689 |*16 3 289 | 4 269 *156 |
| 5689 4 3 |*16 29 289 | 2579 2679*1567 |
+----------------+----------------+----------------+
| 1 7 689 | 5 4 29 | 23 236 68 |
| 3 2 5 | 8 7 6 | 1 4 9 |
| 689 689 4 | 29 1 3 | 27 5 -678 |
+----------------+----------------+----------------+
| 589 3 2 | 79 89 4 | 6 1 +57 |
| 689 689 1 | 279 289 5 | 379 379 4 |
| 4 59 7 | 3 6 1 | 59 8 2 |
+----------------+----------------+----------------+
(
Graphic representation)
Here, the roof squares (R2C9 and R3C9) contain extra possibilities <5> and <57> respectively. This means they form a quantum-square with possibilities <57>, which forms a locked pair with R7C9.
It is quite possible to find Type-3 Unique Rectangles that form locked triples or even quads. For example, if the quantum square was <57>, and you found two other squares <58> and <78>, you would have found a locked triple on <578>.
Finally, just as Type-2 Unique Rectangles have a -B variant, so do Type-3s! And if you think about it, Type-1s dont have a -B variant because they actually are both at the same time, depending on which squares you consider to be the floor squares.
Also, a Type-2 is really a Type-3, but instead of a locked set, youve got a locked single.
Wrapping up our discussion of Type-3 Unique Rectangles, just as with Type-2's, there is a -B variant.
- Code: Select all
+-------------+-------------+-------------+
| 2 1 *69 | 4 5 7 | 8 *69 3 |
| 7 -568*689 | 16 3 +28 | 4 *269 15 |
| 568 4 3 | 16 9 28 | 25 267 157 |
+-------------+-------------+-------------+
| 1 7 68 | 5 4 9 | 23 23 68 |
| 3 2 5 | 8 7 6 | 1 4 9 |
| 689 689 4 | 2 1 3 | 7 5 68 |
+-------------+-------------+-------------+
| 59 3 2 | 79 8 4 | 6 1 57 |
| 68 68 1 | 79 2 5 | 39 37 4 |
| 4 59 7 | 3 6 1 | 59 8 2 |
+-------------+-------------+-------------+
(
Graphic representation)
As with Type-2Bs, since the roof squares are not in the same block, you can only look for reductions in row 2. In this case, the quantum square plus R2C6 form a locked set on <28>, and you can remove <8> from R2C2.
Cracking the Rectangle with Conjugate PairsAn interesting observation is that it is sometimes possible to remove one of the original pair of possibilities from the roof squares. Consider the following
puzzle:
- Code: Select all
+----------------+----------------+----------------+
| 12 9 17 | 8 3 6 | 57 4 25 |
| 5 8 6 | 7 2 4 | 3 1 9 |
| 27 4 3 |*59 1 *59 | 8 6 27 |
+----------------+----------------+----------------+
| 8 27 5 | 6 9 3 | 4 27 1 |
| 9 3 47 | 2 4578 1 | 57 578 6 |
| 6 127 147 | 45 4578 58 | 9 2578 3 |
+----------------+----------------+----------------+
| 147 17 2 |*459 458 *589 | 6 3 57 |
| 47 6 9 | 3 45 2 | 1 57 8 |
| 3 5 8 | 1 6 7 | 2 9 4 |
+----------------+----------------+----------------+
(
Graphic representation)
Look closely at the roof squares, R7C4 and R7C6, but this time, dont look at their extra possibilities; look at the possibilities they share with the floor squares.
If you look carefully, youll see that in block 8, the roof squares are the only squares that can contain an <9>. This means that, no matter what, one of those squares must be <9> -- and from this you can conclude that neither of the squares can contain a <5>, since this would create the deadly pattern! So you can remove <5> from R7C4 and R7C6.
Nomenclature: When two squares are the only two squares in a group that can have a particular value, they are referred to as a
conjugate pair on that value.
This is an example of a
Type-4 Unique Rectangle. As you have probably realized, since the roof squares are in the same block, you can search for conjugate pairs in both of their common groups (the row and the block, in this case).
And, as you might expect, there is a
Type-4B Unique Rectangle variant, in which the floor squares are not in the same block, and you can only look for the conjugate pairs in their common row or column. For example:
- Code: Select all
+----------------+----------------+----------------+
|*127 9 17 | 8 3 6 | 57 4 *257 |
| 5 8 6 | 7 2 4 | 3 1 9 |
|*27 4 3 | 59 1 59 | 8 6 *27 |
+----------------+----------------+----------------+
| 8 27 5 | 6 9 3 | 4 27 1 |
| 9 3 47 | 2 4578 1 | 57 578 6 |
| 6 127 147 | 45 4578 58 | 9 2578 3 |
+----------------+----------------+----------------+
| 147 17 2 | 459 458 589 | 6 3 57 |
| 47 6 9 | 3 45 2 | 1 57 8 |
| 3 5 8 | 1 6 7 | 2 9 4 |
+----------------+----------------+----------------+
(
Graphic representation)
In this case, since <2> can only appear in row 1 in the roof squares, 7 can be removed from both of them.
If this puzzle looks familiar, its because once you find the Type-4B Unique Rectangle (in the first example), you immediately get the second example!
As Type-4 Unique Rectangle solutions "destroy" the Unique Rectangle, it is usually best to look for them only after you've done any other possible Unique Rectangle reductions.
To be added here: Hidden Set Variants; etc...Shorthand Representation of Unique RectanglesA reasonably standard shorthand for representing Unique Rectangles has evolved, as follows:
- Code: Select all
a|c A unique rectangle; ab = floor squares, cd = roof squares.
b|d The vertical bars represent the block boundary
a|b A -B variant unique rectangle
c|d
12|12A... A Type-1 unique rectangle. 12 are the common possibilities;
12|12 A.. represents 1 or more extra possibilities
12|12A A Type-2 unique rectangle. A is the extra
12|12A common value. Sometimes A is replaced by 3.
12 |12 A Type-2B unique rectangle
12A|12A
12|12A... A Type-3 unique rectangle. A... are the 1 or more extra possibilities
12|12B... in one roof square; B... the extras in the other. The
quantum-square is the union of A... and B...
12 |12 A Type-3B unique rectangle.
12A...|12B...