News and Updates on X
Strategies for Popular Number Puzzles

Avoidable Rectangles

Avoidable Rectangles are a most unusual strategy - and, to this author's knowledge, the only one that makes use of solved cells. We are used to the idea that a solution kills all the other numbers of the same value along the row, column and box, meaning that all information about that cell has been used up. Apparently, this is not so.

Avoidable Rectangle
Avoidable Rectangle

To appreciate this strategy, we have to put ourselves in the shoes of the puzzle creator, not the puzzle solver.

Consider the solution in diagram to the right. We have four cells that are shaded. To create a Sudoku puzzle, some removal process has to take place - some method of taking out numbers so that they can be filled in again by a puzzle solver. The crucial constraint is that the puzzle must have a unique solution. If the puzzle maker removed all four shaded cells, then there would be at least two solutions, since the 1 and the 2 are interchangeable in this situation.
Avoidable Rectangle
Avoidable Rectangle
Notice that we are talking about a rectangle that crosses exactly two boxes. This is the same deadly pattern formation we’ve discussed in Unique Rectangles. If our four cells are in four boxes, the puzzle maker can remove all numbers, since they are not interchangeable. To the puzzle maker, the four shaded cells above are an “unavoidable set”: he or she can’t avoid leaving one or more of these numbers as a clue.

There are millions of possible puzzles derivable from a completed Sudoku board. The top third of the puzzle above is just one example. Notice, however, that at least one of the four cells (C5) from our example is a clue - which avoids creating a double solution.

Avoidable rectangle
Avoidable rectangle
The next picture shows the state of play (in the top third of a puzzle) near the end. From the point of view of the puzzle solver aware of “unavoidable sets”, we can spot a very interesting rectangle in B4, C4, B7 and C7. It seems that we’ve found an interchangeable pair of 5s and 8s.
Work on the puzzle so far has fixed 5 in C4 and B7 and 8 in C7, but the final corner has two options ‑ an 8 or a 9. If B4 really were an 8, then we’d have the same situation as in the case of the 1 and 2 where the puzzle maker was forced to leave a clue. Since our newly identified rectangle does not contain a clue in the corners, we can’t have an interchangeable pair here. The 8 is not a valid solution, so we can remove it and place a 9 in B4.

So the rule of Avoidable Rectangles is:

We can remove a candidate that forms a potential interchangeable pair with three other cells spread over two boxes where the three other cells are solved cells (not clues).

Extensions of this strategies are documented in my book The Logic of Sudoku.

Note: This strategy does not exist in the solver because it relies on knowledge of what the original clues were. However, my solver is only given the state of the board as it currently exists and solved cells could be clues or cells solved in a previous round. It does not know. The data entry does allow one to distinguish between them but I can't force the user to abide by it.

Go back to Hidden Unique RectanglesContinue to BUG



... by: Charles Cochems

Monday 1-Jan-2024
This strategy is essentially using a unique rectangle type 1 after it's already been destroyed.

Solving the three cells eliminated one of the two candidates, but that doesn't stop you from eliminating the other one!

And that's the takeaway. You can still use an already destroyed unique rectangle, even if other deductions destroyed it before you spotted it.

This probably works for other unique rectangle types as well, but this is the one that's easiest to spot. :)

... by: Luc Lion

Sunday 20-Aug-2023
I disagree with your statement that "This strategy does not exist in the solver because it relies on knowledge of what the original clues were".

In your example with 5s and 8s in B4, C4, B7 and C7, it does NOT matter which value was a clue (or a given) and which value has been deduced. If you place a 8 in B4, you create a pattern that opens the door to a duplicate solution. The solutions with {B4, C4, B7, C7} = {8, 5, 5, 8} is fully interchangeable with {B4, C4, B7, C7} = {5, 8, 8, 5}

This is because all logical deductions that are made for solving a sudoku puzzle are based on the exclusion rule within a house (no value can appear twice in a house) which leads to strong links and weak links between value candidates (or between candidates and a naked candidate or solved cell, if we look at the grid before completing all direct eliminations). These logical "links" generate a mathematical "equivalence relation" between value candidates; it can be worded as "has a logical link with". This relation is reflexive, symmetric and transitive and thus it creates equivalence classes between all value candidates or maked candidates (solved cells).

These classes are logically separated and this means that the global solution will be unique if all classes have a unique solution. If, for instance, class A has 2 solutions, class B has 3 solutions and class C has 2 solutions, the global grid will have 12 solutions. And is any class has zero solution, the global grid has no solution either.

The properties of equivalence classes is implcitly used in the strategies; "Bi-value grave" (1 class is the solved cells, and 1 class is the bi-value cells plus the potential bi-value cell), "Avoidable rectangle" (the 4 cells of the rectangle compose a class), and the "Unique rectangles" (the 4 cells form a separate class when the conditions for forming a "deadly
pattern" are fulfilled.
In all these 3 strategies, the logic combines:1. the recognition of the equivalence class, or its potential creation, 2. the recognition that, if the class is created, it generates 2 solutions (within the class), 3. the condition that prevent the creation of the class are thus considered true.
That logic could also be used in the case where the class holds zero internal solution. However, in all practical cases I have studied, the prevention of the zero solution condition was internal to the class and, thus, there was no need to identify the condition for generating the class or preventing its generation.

Let's come back to the example with B4, C4, B7 and C7 associated with values 5s and 8s as drawn above. If B4 is an 8, the 4 cells are an isolated subset (to the point of view of exclusion rules or "link"). That is, all the solved cells or value candidates with which any of the 4 cells has a strong link or a weak link are another one of the 4 cell values. The impact on other candidates in the 2 boxes or in the 2 lines and 2 columns that are concerned is exactly the same for one or another solution.

And this is independant on whether the cells have been valued as a given or from other logical deductions. The key is: if B4 receiving value 8 is a solution, then {B4, C4, B7, C7} = {5, 8, 8, 5} is also a solution. Thus B4 must NOT receive 8.

And, by the way, the strategy behind "Avoidable rectangle" can be extended to other patterns than rectangle provided that all value candidates within these cells for an equivalence class through the relation "has a strong or weak link with". Then is these cells form a deadly pattern like being all but one bi-value cells, then the equivalence class must be broken.

I hope that I have not been too long or too confused.
Best regards,
Luc Lion
Andrew Stuart writes:
Hi Luc. Sorry you couldn't publish your interesting analysis immediately, there was an issue with mailing the confirmation email. However I like what you say and will comment further.
Add to this Thread

... by: Stephen Lucerne

Monday 28-Oct-2019
This is highly underrated. I found this to be one of the quickest and most used strategies on cracking expert puzzles. It's extremely intuitive and easy to spot, and will come in handy in every puzzle you encounter unlike most expert strategies. I would suggest this as a need to know for beginners even.

... by: John

Wednesday 27-Apr-2016
Love your site, I'm just wondering if you've done any statistics on this strategy. I've been looking for it in puzzles (I really want to find one!), but I often notice that in cases where it would've been used other unique rectangle strategies have already eliminated the candidate. I assume it's fairly rare to actually get an elimination this way.
Andrew Stuart writes:
I think you might have missed the last paragraph of the article (which I've just reworded to be clearer)

My offline solver which does keep track of clues (since they are inputs) does include this strategy. A recent run on Ruud's top 50,000 set - my favourite test set - finds 22 instances. Could be more since its dependent on the order, but I include it just after Jelly-Fish and before the other UR strategies
Add to this Thread

... by: Tom

Thursday 14-Nov-2013
I think it's crucial to add that the UR can be used when there are exactly two candidates in the cell in question. It never worked for me when I had 3 candidates there..
Andrew Stuart writes:
Not true. Here is a counter example. Take step to the point where an APE occurs and go [back]. At that point "cells AC26 allow 7 to be taken off A6". Obviously with 3+ candidates we can only remove one candidate, so it is less useful than a bi-value cell elimination.
Add to this Thread

... by: Duncan

Friday 4-May-2012
Good and detailed explanation. I use this "impossible ambiguity" strategy in killer and in kakuro as well where it is equally valid.

One thing to look out for as well is when the ambiguity extends over three vertical pairs of cells in a horizontal line (or vice versa), which I have seen a couple of times.

... by: Eric

Sunday 11-Dec-2011
Nice strategy if you are out of options, but there must be another way to solve the puzzle. There MUST be another way to remove a candidate, otherwise multiple solutions are possible.
Andrew Stuart writes:
Indeed, but that is because I dont possess all logical strategies although I do try and incorporate new ideas as soon as possible. Lack of a logical solution does not imply multiple solutions, however. But a multi-solution puzzle definitely can't be solved logically.
Add to this Thread

... by: Quescaisje

Saturday 19-Mar-2011
This elegant tactic finds good use in AI Escargot, viz. the rectangle formed by E2/3, H2/3.


... by: CS Vidyasagar

Wednesday 3-Mar-2010
Excellent exposition. One does come across such situations and this weapon will enhance our fire power in demolishing Sudoku puzzles. If one reads your excellent explanations of DEADLY RECTANGLES, then this article becomes crystal clear.
I shall try and locate such Avoidable Rectangles and send them to you.
thanks and regards,

... by: Leo Salmonsson

Wednesday 20-Jan-2010
Really good explenation. I liked it a lot.
Easy to follow and easy to understand. Ill be back to this site for more.

Thanks a lot!

... by: paolo

Saturday 12-Dec-2009
can't get your example, but maybe I'm missing something.
In the last example IF YOU PUT 5 in B7-C4 and 8 in C7 this means that you had some reason to put that numbers there. In other words that 5s and 8 cannt be swapped. Otherwise they should not have been placed. So it is arbitrary to deduce from them the impossibility of having an 8 in B4.
I mean that (IMHO of course) you won't ever arrive in that position (last example) because you should have applied the UNIQUE RECTANGLE tecnique before, in case.
Hope my explanation is understandable.....

Yossarian replies:Tuesday 26-Jul-2011
@ Paolo and Malikov:

Your argumentation is right. You should consider the following argument instead:
Imagine at the end you have a solution containing the 8 in that cell. Then you can find a second solution swapping those 4 cells, which is also a solution to the given sudoku.
This is impossible as we know there is only one solution to the given sudoku.
So the 8 cannot go in that cell.

Hope this helps understanding,
Add to this Thread

... by: Pritt Galford

Thursday 17-Sep-2009
Regarding your webpage about Avoidable Rectangles, I have a problem understanding your explanation. I think perhaps the problem arises not with your logic, but with the example instead.

Look at filled-in cells A3 & A9, and C3 & C9. They are an interrelated pair, thus allowing two solutions to the puzzle which is a no, no. There are others of the same problem in the example.

Also see the top 1/3rd of the puzzle of your last example on the same webpage. It has cell A5 with candidates 8 & 9 but nine is already filled in at J5.

Bottom line: I think your Avoidable Rectangle logic is correct and sound, but I'm finding there sure are a lot, in fact it's rather a common occurrence, especially in difficult Sudokus, to find multiple solutions which are violations of the unique solution rule. Your thoughts, please.
Andrew Stuart writes:
A3 & A9, and C3 & C9 are not four cells in two boxes. Avoidable Rectangles only apply if all four cells are in exactly two boxes. You will find that A3 & A9, and C3 & C9 are fixed by other numbers elsewhere and are not swappable.
Add to this Thread

... by: Malikov

Tuesday 7-Jul-2009
I agree with the above comments, this being a great site and all, but don't start charging admission. You'll find that 99% of people do Sudoku for fun, and won't be willing to pay when there are hundreds of free sites they can access.

... by: Ken Stephens

Friday 22-May-2009
I understand the logic based on the information given, that "the three other cells are solved cells (not clues)". However I do not understand how they CAN be solved cells if they would have been interchangeable but for the contents of the fourth cell.

Thanks for a great site which explains things so clearly and on just the right level.

... by: Gary Maness

Sunday 26-Apr-2009
I have a question on this one. I recently used my own variation on this idea that involved 2 pairs that didn't quite form a rectangle. In fact two cells could see the forth but the third could only be seen by one of the others that I had solved. But using the same logic I thought that since there were no clues on any of those cells, if the target number, 8 were possible then there would be two solutions.

Do you have Sudoku Dragon? I can send you the partially solved puzzle. i am interested to know if this forms a rule or did I just get lucky! I mean, in your example, the two end cells, the 5's could see the forht cell and the first cell, the 8. In mine the end cells could the target, but only one could see the first cell.

I hope this makes sense. BTW, I LOVE this site. I have learned so much about the game. You should consider charging admission! I do plan on buying the Index.Dat program and the book when I can though.

Thanks a bunch.
Article created on 13-April-2008. Views: 204228
This page was last modified on 6-May-2010.
All text is copyright and for personal use only but may be reproduced with the permission of the author.
Copyright Andrew Stuart @ Syndicated Puzzles, Privacy, 2007-2024