The solutions are in! This problem of the week was interesting for me: the usual pattern has been that I pose problems that I’ve solved myself at some point in the past, giving me a kind of “inside edge” on understanding the solutions that come in. But, as I said in POW-12, the difference this time is that the solution I knew of came from someone else (Arin Chaudhuri). What was interesting for me — and given the circumstances, it was probably inevitable — is that some of the solutions we received forced me to make contact with some mathematics I’d only heard about but never studied. Let me get to that in a minute.
Another interesting thing for me — speaking now with my category theorist’s hat on — is how utterly simple and conceptual Arin’s proof was! I was pleased to see that regular problem solver Philipp Lampe also spotted it. Wait for it…
Solution I by Philipp Lampe, University of Bonn: The answer is 8.
Among the eight neighbors of an arbitrary vertex, all colors of an admissible coloring must occur. Thus, 8 is an upper bound for the maximum number of colors one can use. We have to show that there is an admissible coloring with eight colors.
The vertices of the 8-dimensional cube may be represented by vectors with in , in other words as vectors in , the 8-dimensional vector space over the field with two elements (i.e., the integers modulo 2). Two such vectors are neighbors iff their coordinate vectors differ in exactly one place, in other words if considered modulo 2, where is one of the eight standard basis elements (with -th coordinate 1, and the other coordinates 0).
Now let our “colors” be the 8 elements of , the 3-dimensional vector space over . Let the vertex “coloring”
be the unique -linear map such that ; that is, define the color of a vertex/vector by
Now, if is any vector, the colors of its neighbors are . The colors of these neighbors are all distinct since the are distinct. Hence all 8 colors are represented among the colors of the neighbors of any given vertex , QED.
What I love about this solution it is how natural it is. I’ll say a little more about this in remarks below.
But I also learned a thing or two by studying the next solution. It relies on the theory of Hamming codes, with which I was not conversant. Up to some small edits, here is exactly what Sune Jakobsen submitted:
Solution II by Sune Jakobsen (first-year student), University of Copenhagen: Since each vertex only has 8 neighbors, the answer cannot be greater that 8.
Now we construct such a coloring with 8 colors. An 8-dimensional cube can be represented by the graph with vertices in , and with an edge between them iff the Hamming distance between them is 1. We color a vertex with color 8 if the seven first bits in the vertex is a “correct” Hamming message (cf. Hamming code (7,4)), and color it in color if the first seven bits give a correct Hamming message upon changing bit . This is a well-defined coloring, since each element in is either a correct Hamming message, or is Hamming distance 1 away to exactly one correct Hamming message.
It remains to show that no vertex is neighbor to two vertices of the same color. The Hamming distance between these two vertices is 2, thus the Hamming distance between the first 7 bits of two neighbors must be 1 or 2. If two neighbors had the same color , then by definition one would get two correct Hamming messages by changing bit in both of them, and the Hamming distance between these messages would be the same as before — either 1 or 2. But the distance between any two correct Hamming messages is at least 3. Contradiction.
1. Let me give a little background to Sune’s solution. Mathematically, the Hamming code called “(7, 4)” is the image of injective linear map
given by the matrix
The Hamming code is what is known as an “error-correcting code”. Imagine that you want to send a 4-bit message (each bit being a 0 or 1) down a transmission line, but that due to noise in the line, there is the possibility of a bit being flipped and the wrong message being received. What can you do to help ensure that the intended message is received?
The answer is to add some “parity check bits” to the message. In the code (7, 4), one adds in three parity checks, so that the transmitted message is 7 bits long. What one does is apply the matrix to the 4-vector, to get a 7-vector (remember we’re working modulo 2), and this 7-vector is sent down the line. Assuming only a moderate amount of noise in the transmission line, perhaps the 7-bit message will remain intact or perhaps a single bit will be flipped, more rarely two bits will be flipped (and we’ll assume the event that more than two are flipped has negligible probability). Now, the Hamming encoding is rigged up so that if the 7-bit vector is received as sent, then the parity checks will report 0 errors. If the parity checks report an error, they report precisely where the error occurred if the received vector was off by one bit. (If two flips occurred, then the receiver can still detect from the parity checks that an error occurred. The parity checks can never detect how many bits were flipped, but if the receiver assumes correctly that just one bit got flipped, he can restore the intended message with accuracy. If three or more got flipped, then the receiver got the wrong message, but he would never know it if the parity checks reported back 0 errors.)
How does this work? By having the receiver apply a parity-check matrix to the received message, given by the matrix
In the first place, , and so if the message received belongs to the image of (is a “correct Hamming message” in the terminology of Solution II), which will indeed be the case if there were no errors in the transmission, then applied to the message will produce the zero vector. In the case where one bit got flipped in the transmission, applied to the received vector will return a nonzero 3-vector, but the beauty of the Hamming code is that the 3-vector will spell out in binary the bit the error occurred (for example, if the output vector is , then error occurred in the bit with binary number 011, that is bit 3). In that case, the receiver flips that bit to restore the original message. In these two cases, the original 4 bits are then read off as the 3rd, 5th, 6th, and 7th coordinates of the (possibly corrected) 7-vector.
By the way, Sune reminded us that Hamming codes also came up in a post by Greg Muller over at The Everything Seminar, who used the existence of a Hamming code in every dimension to solve general hat-guessing puzzles.
2. Within minutes of posting the original problem, we received a message from David Eppstein, who reported that the solution of 8 colors is essentially contained in a paper he coauthored with T. Givaris (page 4); his solution is close in spirit to Sune’s.
Arin Chaudhuri also surmised the connection to Hamming codes, and mentions that the problem (in a slightly different formulation) originally came from a friend of a friend, who blogs about a number of related problems on this page. Presumably the author had things like error-correcting codes in mind.
3. Sune and David noted that their solutions generalize to show that on the -dimensional cube (for any ), it is possible to color the vertices with colors (the maximum number possible) so that all of the colors show up as colors of the neighbors of any given vertex.
This is very easy to see by adapting Philipp’s method. Indeed, for each just take the color set to be the -vector space . The set of vertices of the -dimensional cube may identified with the -vector space generated by the set (as basis), and the desired coloring is then just the -linear map that extends the identity function on . As mathematical constructions go, you can’t get much more canonical than that! No fuss, no muss — it’s a purely categorical construction (categorists call it a counit of an adjunction). So then why didn’t I see that myself?
4. We’re still not sure what the story is in other dimensions. If is the maximum number of admissible colors in dimension , then about all any one of us knows right now is that for , is weakly monotone increasing, and that if is not a power of 2. There’s a conjecture afloat that where is the floor function, but for now that should be treated as a wild guess. If anyone has further information, please let us know!
Solved by Arin Chaudhuri, David Eppstein, Sune Jakobsen, and Philipp Lampe. Thanks to all those who wrote in!