. . . hypothetical reasoning implies the subordination of the real to the realm of the
possible . . . — Jean Piaget, 1972

Introduction

Some of the most delightful puzzles in mathematics spring from the simplest of beginnings. No need for complicated formulas or exotic machinery—just a few well-chosen rules, a familiar setting, and suddenly, you are stepping into a world where intuition alone is not enough. A cube of cheese, a hungry mouse, and a humble grid of possible moves may seem like ingredients for a children’s story, but they conspire here to form wonderfully rich and challenging mathematical puzzles.

These puzzles capture the imagination: they invite you to play, explore, and experiment. You might start sketching paths, building 3D mazes, and soon enough, you’re caught up in questions of movement, symmetry, and strategy.

In this article, we’ll explore two delightful puzzles—these lie at the intersection of spatial reasoning, combinatorics, and a touch of graph theory. “A touch of graph theory” here must be taken literally, since the solutions to each puzzle involved more logical reasoning than formal theory. They do, however, hint at some of the types of arguments used in formal settings, such as coloring parity checks. Thus, even though the reader may not be familiar with any advanced math, he would still be able to solve these problems by using their unaided logic and spatial insight alone.

Warm-Up Puzzle

2727 identical cubic chunks of cheese are piled together to form a 3×3×33\times3\times3 large cube, as shown below. A mouse of negligible size starts at the center of the face of any one of the outside cubes and eats its way through the large cube by tunnelling through all of these 1×1×11\times1\times1 cheese chunks. It always travels along the grid of 2727 straight lines that pass through the centers of the chunks, parallel or perpendicular to their sides, and never enters any chunk more than once.


Can the mouse traverse each of the 2626 outside chunks once and only once, then finish its trip by entering the central chunk for the first time? If so, then demonstrate how it can be done; if not, then prove it is impossible.1

follow termite graphic d text
Fig. 1. From Scientific American by Amanda Montañez

Hints

Reveal Hint 1

Color the cubes like a chessboard: Imagine coloring the cube in alternating black and white, so that any two cubes sharing a face have opposite colors. What must be true about the colors of two consecutive chunks visited by the mouse?

Reveal Hint 2

Count the number of cubes of each color! What must be true about the central one?

Solution

Reveal Solution

The mouse cannot traverse all 2626 outer chunks of cheese and end its journey in the central one. This can be demonstrated elegantly using a coloring argument based on parity. Color the small cubes or the 1×1×11\times1\times1 subcubes in a three-dimensional checkerboard pattern: Without loss of generality, number the centers of the 2727 subcubes by coordinates (x,y,z)\left(x,y,z \right) where, x,y,z∈{0,1,2}x,y,z\in \{0,1,2\} so that the central cube has coordinates (1,1,1)\left( 1,1,1\right). Then, color each subcube white if the sum of its coordinates (i,j,k)\left( i,j,k \right) is odd, and black otherwise, thereby having any two cubes that share a face oppositely colored.

Intuitively, since each subcube must be surrounded by subcubes of the opposite color, once the first 3×33\times3 layer of subcubes of the large cube is colored in a checkerboard pattern, each subsequent layer follows as an inverted coloring of the previous one. This alternating pattern continues until the third layer is reached, completing the three-dimensional checkerboard structure within the chosen frame of reference, as illustrated below.

chesscube
Fig. 2. AI-generated image

The large cube, then, will consist of 1313 white and 1414 black subcubes. Since the mouse always moves from one subcube to an adjacent one, its path must alternate between black and white. Thus, any path that includes all the 2727 subcubes must begin and end with a subcube belonging to the color set of larger size (the set of 1414 black cubes). The central cube, however, belongs to the set of white subcubes with a size of 1313; hence, such a path is impossible.

We can extend this problem to other types of cubes as well. A cube of even order (i.e., with an even number of 1×1×11 \times 1 \times 1 subcubes along one edge) contains an equal number of subcubes of each color. While there is no central subcube, complete paths can begin on any subcube and end on any subcube of the opposite color. In contrast, a cube of odd order has one more subcube of one color than the other; therefore, a complete path must begin and end on the color used for the larger set. In odd-order cubes of order n∈{3,7,11,15,19,23,...}n\in \left\{3,7,11,15,19,23, … \right\}, the central cube belongs to the smaller color set, so it cannot serve as the endpoint of any complete path. On the other hand, in odd-order cubes of order n∈{1,5,9,13,17,21,...}n\in \left\{1,5,9,13,17,21, … \right\}, the central cube belongs to the larger color set, making it a valid endpoint for a path that starts on a subcube of the same color. Nevertheless, no closed path, going through every subcube, is possible on any odd-order cube, due to the imbalance in the number of subcubes of each color.2

A Harder Puzzle

Suppose that 27 27 cubic chunks of cheese of identical size are piled together to form a 3×3×33\times3\times3 cubical stack, as shown above. A mouse of negligible size starts at the center of the face of any one of the outside cubes and eats its way through the large cube by tunnelling through all of these 1×1×11\times1\times1 cheese chunks. He always travels along the grid of 2727 straight lines that pass through the centers of the chunks, parallel or perpendicular to their sides, always makes a 90° 90° turn at the center of each chunk, and never enters any chunk more than once. How many cheese chunks at most (out of the 2727) can the mouse munch before exiting the stack?3

Hint

Reveal Hint

How many corners can the mouse ever hope to visit?

Solution

Reveal Solution

To determine the maximum number of chunks of cheese the mouse can munch, we must first prove a little theorem of the classic ‘if-then’ variety. In other words, we need to establish that if such an optimal path exists, then it must necessarily have a certain length, measured, naturally, in cubic units of cheese! Only after this can we proceed to provide proof of existence by demonstrating the direction within the stack that the mouse must follow to maximize his cheesy gains. We may write the statement of this little theorem succinctly as follows:


Theorem


If a valid mouse path in the 3×3×33\times3\times3cubical stack visits exactly 2525 unit cubes, then this is the longest possible path.


Upper Bound Proof:

Visualize the cubical stack of cheese as a Rubik’s Cube, composed of 2727 individual pieces (unit cubes). Much like the familiar way we analyze the world’s famous combination puzzle, but with a slight twist, we can classify these 2727 pieces into four distinct categories, each with its unique place in the structure:

  • Vertices VV: 88 pieces at the eight corners
  • Edges EE: 1212 pieces halfway along each edge
  • Faces FF: 6 pieces at the centers of the faces
  • Core CC: The single piece at the center of the stack

By hypothesis, the mouse always makes a 90°90° turn at the center of each piece, so he never travels straight through any three pieces (i.e., along only one axis). Suppose the mouse goes from one corner piece to another. Since two corners are “diagonally” separated in one, two, or three directions (i.e., two corners differ in at least one coordinate center (x,y,z)(x,y,z), he cannot go straight through; After exiting the first corner, he arrives in an edge piece along one axis, then he must turn at the center and head off along a perpendicular axis. The only way to do that is to pass through a face-center piece. Therefore, every time the mouse travels between two corner pieces, he must chew through at least one face-center piece.

Moreover, if our little fellow ventures through the very core piece CC between two corners, he will approach CC along one axis, then exit along a different one, and in doing so, he must pass through at least two face-center pieces (one on each side of CC) before reaching the second corner (This path looks like this: V1→F1→C→F2→V2V_{1}\to F_{1}\to C\to F_{2}\to V_{2} ), with edge pieces omitted for compactness).


Now, let kk be the total number of distinct corner pieces the mouse visits. Then there are k−1k-1 “gaps” between successive corner visits (these gaps contain all the intermediate pieces the mouse nibbles through between corner visits without revisits). Furthermore, observe that in a given path, the mouse either passes through the core piece CC or does not. Consequently, only the following two cases are possible:


Case 1 (He never passes through the core piece CC):

Each of the k−1k-1 gaps requires at least one face-center piece, and there are only 6 6 such pieces. Hence

(k−1)×1≤6⟹k≤7(k-1)\times1\le 6 \Longrightarrow k\le 7

Case 2 (He does pass through the core piece CC):

One special gap (the one straddling CC) now requires at least two face-center pieces, and the other gaps at least one each. Thus

2+(k−2)×1≤6⟹k≤62+(k-2)\times1\le 6 \Longrightarrow k\le 6

It follows that no matter which case actually occurs, the mouse can visit at most 77corners (If he skips the core) or 66 corners (if he munches the core). In the first case, he’s left at least the core piece and one corner untouched; that knocks his maximum haul down from 2727 to 27−2=2527-2=25. In the second, he simply omits two corners at least, again giving 27−2=2527-2=25. Thus, our nice little fellow—despite his twits and turns—can never chew through more than 2525 cubic cheese chunks before, alas, finding the exit. And indeed, one can draw out a full 2525 zigzagging route (as we’ll shortly see), so this is our unbeatable maximum.


Existence Proof:

Without loss of generality, let us assign coordinates (x,y,z)\left(x,y,z \right)to the geometric centers of the 2727 cheese chunks, where x,y,z∈{0,1,2}x,y,z\in \{0,1,2\}. We orient the cubic grid that connects all the centers of the chunks in the stack so that the xx-axis points to the right, the yy-axis points away from the observer, and the zz-axis points upward. The center of the chunk (0,0,0)\left( 0,0,0\right) lies at the lower-left-front corner (closest to the observer and lowest in height), while(2,2,2)\left( 2,2,2\right) lies at the upper-right-back (farthest from the observer and highest). In this setup, the front side of the cubic grid lies in the plane y=0y=0, the back side in y=2y=2, the bottom side in z=0z=0, the top side in z=2 z=2, the left side in x=0x=0, and the right side in x=2x=2. Following this convention, we can give directions as a succession of center coordinates; the little brother of our original mouse must follow in order to achieve his cheesy great larceny under the right-angle turn and the never-revisit rules, respectively. As follows:

(0,0,0)→(1,0,0)→(1,1,0)→(0,1,0)→(0,2,0)→(1,2,0)→(1,2,1)→(0,2,1)→(0,2,2)→(0,1,2)→(0,1,1)→(0,0,1)→(0,0,2)→(1,0,2)→(1,0,1)→(2,0,1)→(2,0,0)→(2,1,0)→(2,1,1)→(2,2,1)→(2,2,2)→(1,2,2)→(1,1,2)→(2,1,2)→(2,0,2)(0,0,0)\to (1,0,0)\to (1,1,0)\to(0,1,0)\to (0,2,0)\to(1,2,0)\to(1,2,1)\to (0,2,1)\to(0,2,2)\to (0,1,2)\to(0,1,1)\to (0,0,1)\to (0,0,2)\to (1,0,2)\to (1,0,1)\to(2,0,1)\to(2,0,0)\to (2,1,0)\to (2,1,1)\to (2,2,1)\to(2,2,2)\to (1,2,2)\to (1,1,2)\to (2,1,2)\to(2,0,2)

The arrows shown above trace the mouse’s trip from one cubic cheese chunk to the next. In this particular path, the mouse begins in the lower-left-front corner and finishes in the upper-right corner chunk on the front face. Interestingly, if you reverse the direction of all the arrows, you obtain another valid path—each step still obeys the movement rules.*

It’s essential to note that this does not prove uniqueness. There may be other clever mouse tours that satisfy the same conditions. The key point is that we’ve managed to construct at least one such path, which is enough to settle the question (this is what mathematicians call a constructive proof). But if you’re feeling adventurous, you might enjoy trying to discover other routes through the cube. The mouse would surely appreciate the extra options!

*Thanks to avid readers, I could spot a mistake in the path’s original construction.  Now, there’s a new path whose construction is hopefully correct.

References & Further Reading

  1. Adapted from Gardner, M. (1994). Problem 47 in My Best Mathematical and Logic Puzzles. Dover Publications. p. 27 ↩︎
  2. Analysis of the general case adapted from Gardner, M. (1994). My Best Mathematical and Logic Puzzles. Dover Publications. ↩︎
  3.  Adapted from Hoeflin, R. K. (1985, April). Problem 32 in The Mega Test. Omni, 7(4), p. 129.  ↩︎

Leave a Comment

Your email address will not be published. Required fields are marked *