Update: The obstruction set (i.e. the NxM "barrier" between colorable and uncolorable grid sizes) for all monochromatic-rectangle-free 4-colorings is now known.

Anyone feel up to trying 5-colorings? ;)

The following question arises out of Ramsey Theory.

Consider a $k$-coloring of the $n$-by-$m$ grid graph. A monochromatic rectangle exists whenever four cells with the same color are arranged as the corners of some rectangle. For example, $(0,0), (0,1), (1,1),$ and $(1,0)$ form a monochromatic rectangle if they have the same color. Similarly, $(2,2), (2,6), (3,6),$ and $(3,2)$ form a monochromatic rectangle, if colored with the same color.

Question: Does there exist a $4$-coloring of the $17$-by-$17$ grid graph that does not contain a monochromatic rectangle? If so, provide the explicit coloring.

Some known facts:

  • $16$-by-$17$ is $4$-colorable without a monochromatic rectangle, but the known coloring scheme does not appear to extend to the $17$-by-$17$ case. (I'm omitting the known $16$-by-$17$ coloring because it would very likely be a red herring for deciding $17$-by-$17$.)
  • $18$-by-$19$ is NOT $4$-colorable without a monochromatic rectangle.
  • $17$-by-$18$ and $18$-by-$18$ are also unknown cases; an answer to these would be interesting as well.

Disclaimer: Bill Gasarch has a $289 (USD) bounty on a positive answer to this question; you can reach him through his blog. A note on etiquette: I'll make sure he knows the source of any correct answer (should one arise).

He brought it up again during a rump session at Barriers II, and I find it interesting, so I'm forwarding the question here (without his knowledge; though I highly doubt he would mind).

  • 12
    $\begingroup$ Just want to add some references/pointers: apart from the blog posts[1,2], the updates at the bit-player blog[3,4] are detailed and insightful. There has been substantial discussion on all of these posts. [1]: blog.computationalcomplexity.org/2009/11/… [2]: blog.computationalcomplexity.org/2009/12/… [3]: bit-player.org/2009/the-17x17-challenge [4]: bit-player.org/2009/17-x-17-a-nonprogress-report Note: No markdown formatting in comments? How can I make pretty links? $\endgroup$
    – Neeldhara
    Commented Aug 31, 2010 at 14:01
  • $\begingroup$ Those are some great links. Thanks Neeldhara! :) $\endgroup$ Commented Aug 31, 2010 at 14:47
  • $\begingroup$ Likewise, thanks for posting this here - I followed the developments on this for some time, and this should rekindle interest in the problem! $\endgroup$
    – Neeldhara
    Commented Sep 1, 2010 at 5:37
  • 2
    $\begingroup$ @Moron: Yes, you only need to consider those rectangles whose sides are parallel to the axes. BTW, there is also a complexity-theory angle to this: Bill has speculated that given a partial k-coloring of an m by n grid, determining whether the coloring can be completed in a rectangle-free manner is NP-complete. $\endgroup$
    – Kurt
    Commented Sep 2, 2010 at 21:07
  • 2
    $\begingroup$ The automorphism group of the problem is large: $2\times 4! \times(17!)^2=6.1\times 10^{30}$ solution-preserving symmetries, counting the row-column swap, permutations of the colors, permutations of the rows, and permutations of the columns. Is it known how many distinct rectangle-free subsets there are of size $71,72,73,...$? $\endgroup$
    – mjqxxxx
    Commented Mar 23, 2011 at 3:11

6 Answers 6


Some of you are probably aware of this, but the 17 x 17 coloring problem has been solved by Bernd Steinbach and Christian Posthoff. See Gasarch's blog post here.

  • 8
    $\begingroup$ Also the 18x18 grid is 4-colorable without monochromatic rectangles ... now, the only "missing tile" is the 21x12 grid $\endgroup$ Commented Feb 8, 2012 at 14:55

This is not really an answer to the question, but I've encoded the 17x17 4-coloring problem as a 4-CNF (in the standard DIMACS format for SAT-solvers) and uploaded it here. If anyone has access to a good SAT solver (and a supercomputer!) maybe we can make some progress.

Note: in my encoding, if gridpoint $(i,j)$ is assigned color $c \in \{0,1,2,3\}$, then the variable $(17i+j+289c+1)$ takes the value $1$, and $0$ otherwise.

  • 3
    $\begingroup$ Awesome. (I do indeed have access to a supercomputer.) Next step's running numbers to estimate this thing's runtime on the specific machine. Who knows if this is in the ballpark of reasonable, but it's a different approach I'd been looking at. Now, time to go find that recent question on SAT-solvers so I can read up... :) $\endgroup$ Commented Sep 27, 2010 at 13:52
  • $\begingroup$ Turns out the problem I was thinking of was on #SAT, so I've started a new question on SAT solvers at cstheory.stackexchange.com/questions/1719/… $\endgroup$ Commented Sep 27, 2010 at 14:35
  • $\begingroup$ Great - let me know how it goes! $\endgroup$
    – Lev Reyzin
    Commented Sep 27, 2010 at 21:28
  • 4
    $\begingroup$ @Lev, just a random update: it appears the runtime of the 17x17, even using the best possible supercomputer and a really fast SAT solver, is still astronomical. Plus side: it appears within the realm of reason to attack this with a supercomputer in a targeted way, i.e. find the exact partial 1-colorings that will work (already done by hand by Beth Kupkin at Rutgers), then find the exact partial 2-colorings that will work from that, etc. Down side: there's no "quick solution"; it'll have to be a long-term project with multiple stages of supercomputer execution $\endgroup$ Commented Nov 16, 2010 at 11:44
  • 2
    $\begingroup$ @Joe, however! Here is a "leaderboard" of the current best approximate colorings: Leaderboard -- It appears simulated annealing works quite well for finding approximate colorings. $\endgroup$ Commented Mar 23, 2011 at 19:31

This is not a real answer, either. Certainly the problem here is the presence of an astronomical number of symmetries, which fool even the best SAT solvers on the best supercomputers. Such symmetries map solutions to solutions and non-solutions to non-solutions: in this case probably there is an immense number of almost-solutions (i.e. assignments satisfying all but a small amount of clauses), each of which can be obtained by any other applying a proper symmetry. Hence the solver wastes an enormous amount of time trying each of these almost-solutions, while in a certain sense they are all the same.

Exploiting symmetries (see this paper) should be an avenue to explore in order to attack this hard 17x17 instance and make some progress on it. I wonder if anyone already tried to do so.

  • $\begingroup$ Hey, that's pretty sweet! :) Hadn't seen it before. $\endgroup$ Commented Mar 23, 2011 at 19:42
  • $\begingroup$ @Daniel: You're welcome! ;-) Hope it helps. $\endgroup$ Commented Mar 23, 2011 at 21:19
  • $\begingroup$ I used Aloul's "Shatter" program on multiple encodings of the 17x17 problem and put some CPU weeks into a few different SAT solvers and had no luck. The paper Walter referenced is actually the first of maybe a dozen or something he's written on the subject, so there might be something in there that'll do the job, but it's no low hanging fruit. $\endgroup$ Commented Apr 8, 2011 at 6:44

Again, not a real answer, but anyway, here are some thoughts on adopting graph colouring algorithms for this problem.

Let us say that a set $I$ of grid positions is an independent set if set $I$ does not contain all four corners of some rectangle. Define a maximal independent set in the obvious way. Now the following are equivalent claims:

  1. $n$-by-$m$ grid can be coloured with $k$ colours.
  2. $n$-by-$m$ grid can be covered with $k$ independent sets.
  3. $n$-by-$m$ grid can be covered with $k$ maximal independent sets.

Now, the interesting thing is that covering with independent sets can be done in time $\log k\ \text{poly}(nm)2^{nm}$ using fast covering product algorithm (Björklund et al. 2007). This is certainly is an improvement over trivial $k^{mn}$ algorithm, though $2^{289}$ seems still unsurmountable.

If the family of all (maximal) independent set has sufficiently nice structure, it might also be possible to fine-tune the covering product algorithm.

  • $\begingroup$ How is claim 3 equivalent to claim 2? The maximal independent set for 17x17 is of size 74, by the way, as shown in Elizabeth Kupin's paper (pdf). There is only one such set, not counting permutations of the rows and columns as distinct. $\endgroup$
    – Null Set
    Commented May 22, 2011 at 20:47
  • $\begingroup$ I mean maximal in the sense that no proper superset is independent, as it is customary in computer science. Maximum is the word usually used when meaning "of largest possible size". $\endgroup$ Commented May 22, 2011 at 21:15
  • $\begingroup$ In that case, the set of maximal independent sets contains all the row/column permutations of the unique size 74 set, and no size 73 independent sets, because they are all subsets of the size 74 set. I'm not sure what it has from sizes 67 to 72. $\endgroup$
    – Null Set
    Commented May 22, 2011 at 21:31

The 21x12 grid is 4-colorable without monochromatic rectangles, as well !!!

See last Bernd Steinbach's post on Gasarch's blog!


This is Bill Bouris. Hi, Dan. I'm working on a program that searches for a suitable 17x17 matrix which exhibits no-4-coloring according to Ramsey's Theory. I use a positional matrix depicting all connections between points and fix the main diagonal and allow the top row of the matrix to run through all of the possible 16choose8 combinations; I capture only the matrices that pass regarding the following criteria... no-XRRR, no-RXRR, no-RRXR, no-RRRX, no-XBBB, no-BXBB, etc., then I sweep through the matrix using the next weakest criteria... no-XBRR, noBXRR, no-BBXR, no-BBRX, no-XRBB, no-RXBB, etc. for a total of 32 sweeps until the computer fills in the coloring automatically. I've noticed that there's a possible candidate per every 400 matrices out of a total 12780, and it takes .95 hours to find the candidate or 1 per every 8.644 seconds. It's coming along, but I don't have much time to program it... as I work full-time. We should work together... I could use the $289.00!

  • $\begingroup$ Bill Gasarch should only be paying out $128. $\endgroup$ Commented May 23, 2011 at 0:49
  • $\begingroup$ sorry about that... 272/2 or $136 $\endgroup$ Commented May 23, 2011 at 1:10
  • 4
    $\begingroup$ This is not an answer to the question. best as a comment. $\endgroup$ Commented May 23, 2011 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.