# The gap between the two best scores for marking a cube grows quadratically with dimension

How should you mark the corners of a high-dimensional cube to make the same pattern appear on as many of its ordinary three-dimensional faces as possible? The pattern is one marked corner and its three neighbors, with the other corners unmarked. Give each face with this pattern one point. The highest possible score is known: half the faces score, in every dimension from four on. But that count does not tell us which markings tie for first or how close a different marking can come. Even changing one corner of a winning marking can leave its score untouched.

We identify every winner. In dimension $n\ge7$, second place is exactly $\binom{n-1}{2}$ faces behind first, the number of ways to choose two directions from $n-1$. From dimension eight on, one edge explains the gap: every runner-up comes from a standard winning marking by changing a corner where exactly one neighbor has the same mark, with optional changes at corners where every neighbor has the opposite mark.

## The winning and second-place markings

Label each corner, or vertex, by a string of $n$ bits. An edge joins two vertices that differ in one bit. Fix all but three bits and the remaining vertices form a three-dimensional face, or *three-face*. A scoring face has marks at exactly the vertices within one edge of a chosen corner, including the corner itself. This set is called a ball of radius one within the face. Goldwasser and Hansen [1] called the pattern $W_{12}$ and gave a marking for which half the faces score: mark a string if its number of ones has remainder 0 or 1 on division by 4. Bodnár and Pikhurko [2, Theorem 2] proved that for $n\ge4$ this gives the maximum score,
$$
 M_n=2^{n-4}\binom n3.
$$

To describe the ties, write 1 for marked and 0 for unmarked. Start with any of the following marking rules, which we call *templates*:
$$
 Q(x)=\sum_{i<j}x_i x_j+\sum_i a_i x_i+c.
$$
Here $x_i$ is bit $i$ of the vertex, the coefficients $a_i$ and $c$ are binary, and all arithmetic is modulo two. The first sum counts pairs of ones modulo two. Reversing the marks given by that sum alone gives the Goldwasser–Hansen marking.

Call an edge *unchanged* if the template gives its two endpoints the same value. A vertex is *neutral* if it has no unchanged edges. To flip a vertex is to reverse its mark. For $n\ge5$, every winning marking comes from a unique template by flipping any subset of its neutral vertices. Each even-dimensional template has one neutral vertex. An odd-dimensional template has either none or two opposite vertices (strings that differ in every bit). For $n\ge8$, the rule for every runner-up is the same except for one additional flip, at a vertex with exactly one unchanged template edge. Every choice allowed by either rule attains the corresponding score.

In dimension three the eight balls themselves win the only point. Dimension four has additional winners, counted below. The smallest positive loss from the maximum is 1, 4 and 8 faces in dimensions four, five and six, respectively, and $\binom{n-1}{2}$ faces for every $n\ge7$. Dimension seven follows the same score formula as larger cubes but admits another way to finish second: flipping a vertex with five unchanged edges also costs 15 faces.

## Counting the faces lost in one flip

Only faces containing the flipped vertex can change score. Take that vertex as the origin and choose three bit directions for a face through it. Writing $y_1,y_2,y_3$ for the bits measured from that origin, the template on the face becomes
$$
 y_1y_2+y_1y_3+y_2y_3+b_1y_1+b_2y_2+b_3y_3+d.
$$
The constant $d$ gives the mark at the origin; $b_i$ is 0 on an unchanged edge there and 1 otherwise. The quadratic sum by itself marks the ball centered at $111$. Reflecting a coordinate (interchanging its bit values) preserves the ball shape and toggles the other two linear coefficients. Reflections give all four triples of coefficients with an even number of ones. Complementing the marks gives both choices of constant for each triple, since the complement of a ball is the ball at the opposite corner. These eight functions account for all eight balls.

Thus a face scores precisely when its three directions include one or three unchanged edges at the origin. For each choice of three directions in a cube of dimension at least four, switch one of the fixed bits. This pairs parallel faces on which all three linear coefficients are toggled: one face scores and the other does not. Every template therefore reaches $M_n$.

A single flip can destroy a ball but cannot create one from a template. Before the flip, every three-face has an even number of marks because each term of the template takes value 1 an even number of times on the face. After the flip, each affected face has an odd number of marks. If the vertex has $k$ unchanged edges, count the triples containing exactly one or exactly three of those edges to obtain the loss:
$$
 L_n(k)=k\binom{n-k}{2}+\binom{k}{3}.
$$
A neutral flip costs nothing. With one unchanged edge, each destroyed ball uses that edge and two of the remaining $n-1$ directions. Any $k$ can occur: the linear coefficients determine the edge values at the origin. This gives markings with the claimed loss; proving the gap requires ruling out smaller positive losses among *all* markings.

![Two three-faces before and after flipping the ringed vertex.](results/one-flip.png)

Figure 1. Filled circles are marks. On a face through a neutral vertex (top), the flip changes six marks to seven; neither pattern scores. When exactly one of the three edges at the vertex is unchanged (bottom), the flip destroys a ball. Reversing all marks gives the same score comparisons.

To find all neutral vertices of a template, compare its values at $x$ and at the neighbor $x+e_i$, where adding $e_i$ flips bit $i$. Their sum modulo two, $D_i Q(x)=Q(x)+Q(x+e_i)$, is 0 if the values match and 1 if they differ. Collecting these differences into a vector gives
$$
 DQ(x)=a+T(x),\qquad T(x)=x+\Big(\sum_i x_i\Big)\mathbf1,
$$
where $a$ collects the linear coefficients and $\mathbf1$ is the all-ones vector. A vertex is neutral exactly when $DQ(x)=\mathbf1$. In even dimension $T$ is its own inverse, so there is one solution. In odd dimension the vectors that $T$ sends to zero are $\{0,\mathbf1\}$, so solutions, when present, come in opposite pairs. Opposite vertices share no three-face for $n\ge4$, so flipping either has no effect on the cost of flipping the other. Two distinct templates disagree on at least half the cube: subtracting them leaves a nonzero affine function (a linear function plus a constant), which takes the values 0 and 1 equally often or is identically 1. For $n\ge5$, a marking within two flips of one template is therefore too far from any other to arise from it by neutral flips.

## Counting the small cubes

A *facet* is a half of the cube obtained by fixing one bit. Call a facet *tight* if its marking attains the maximum score in dimension $n-1$. Write $\delta=M_n-\mathrm{score}$ for the loss on the whole cube and $\delta_F$ for the loss within facet $F$. Each three-face lies in $n-3$ facets, one for each bit fixed on that face. For $n\ge5$ the maximum in both dimensions is half the respective face count, so counting losses over facets gives
$$
 \sum_F\delta_F=(n-3)\delta.
$$
A winner has zero loss and hence every facet is tight. Splitting the cube along one bit must then give two winning halves. Testing all ordered pairs of winning halves suffices to find every winner.

In dimension four we tested all $2^{16}$ markings against the eight possible balls on each face. Exactly 112 markings score four and 256 score three. Only 32 of the winners are templates; allowing neutral flips gives 64 winners. The remaining 48 all come from the marking $\{0,1,2,3,5,6,9,10\}$, where the integers label vertices by their four-bit binary strings. We permuted coordinates, reflected bits and complemented marks, and checked that the resulting set of markings was exactly the missing set.

A scan covering all $2^{32}$ five-dimensional markings gave highest scores of 20 and 16. It grouped markings of the first half by cube symmetries and tested every marking of the second half. A search joining winning halves through dimension ten suggested a quadratic gap. But two winning halves can miss second place: in dimension six the best losing pair falls short by ten faces, whereas a single flip with four unchanged edges loses only eight.

To score a pair of halves, count the faces within each half and then the faces crossing between them. Each crossing face joins two parallel squares, one in each half. It scores exactly when one square has three marks and the other has one mark diagonally opposite the missing corner, using the same coordinates on both squares. Counting these matches scored every ordered pair. In each dimension in the table, the resulting set of winners agreed exactly with the markings generated by templates and neutral flips, with coordinate labels kept throughout. The table also reports a second test: prescribe tight facets in different directions and try every way to complete the marking. In both tests, “first loss” means the smallest positive loss found.

| Dimension | Winners | Winning half-pairs tested | First loss among pairs | Tight facets prescribed for completion | Completed markings tested | First loss among completions |
|---:|---:|---:|---:|---:|---:|---:|
| 5 | 160 | 12,544 | 4 | 4 | 1,648 | 4 |
| 6 | 256 | 25,600 | 10 | 6 | 1,012 | 8 |
| 7 | 640 | 65,536 | 15 | 7 | 1,780 | 15 |

To see why the two tests suffice, let $g_n$ be the proposed smallest positive loss. Each nontight facet contributes at least $g_{n-1}$ to the facet loss sum once the gap is known in the preceding dimension. Starting with $g_4=1$, a loss strictly below $g_n$ therefore permits at most $\lfloor(n-3)(g_n-1)/g_{n-1}\rfloor$ nontight facets. That bound is six, five and seven in dimensions five, six and seven, respectively.

Unless two opposite facets are tight, every tight facet fixes a different bit. In dimension five this leaves at least four distinct directions with a tight facet, and in dimension seven at least seven. In dimension six the bound already forces a tight opposite pair for every loss below eight.

For the completion count we permuted and reflected coordinates so that the prescribed tight facets fixed $x_1=0,\ldots,x_r=0$, where $r$ is the number prescribed. We assigned each facet a marking from the preceding dimension's winner list, trying every choice that agreed with the assignments on their overlaps. We filled the remaining $2^{n-r}$ vertices in every possible way and counted balls directly. In dimension six the six-facet completion gives the loss of eight, and the opposite-pair count excludes every smaller positive loss. In dimensions five and seven the two counts together attain the stated gaps and exclude every smaller positive loss.

## Why the gap persists in larger cubes

For $n\ge8$, even a runner-up has enough tight facets to determine a template on the whole cube. To prove this, assume the winner description and gap hold in dimension $n-1$, starting with the count in dimension seven. Consider any marking whose loss is at most $\binom{n-1}{2}$. Dividing its facet loss sum by the minimum loss on a nontight facet bounds the number of nontight facets by
$$
 \frac{(n-3)\binom{n-1}{2}}{\binom{n-2}{2}}=n-1.
$$
At least $n+1$ of the $2n$ facets are tight. Since there are only $n$ directions to fix, two opposite facets must be tight.

To recover the template, subtract the quadratic sum $\sum_{i<j}x_i x_j$ from the marking across the cube. Fixing a bit in that sum leaves the same quadratic in the free bits, plus affine terms. On each tight facet the winner description now says that the remaining marking agrees with an affine function at all but at most two vertices. Where two nonparallel tight facets intersect, their affine functions therefore disagree on at most four vertices. Distinct affine functions on the intersection would disagree on at least half its vertices, or $2^{n-3}>4$. The functions must agree everywhere on the intersection.

Let the opposite tight facets fix bit $i$. To compare their linear coefficients for a free bit $j\ne i$, choose a tight facet fixing a third bit. Such a facet exists because only four facets fix either $i$ or $j$. Bit $j$ is free on both intersections, so its coefficient on this third facet matches the coefficient on each opposite facet. The two opposite facets thus have the same linear coefficients in all free directions. Subtracting their constants gives the coefficient of bit $i$ needed to fit both with one affine function on the cube. That function fits each other tight facet too, since it agrees on both slices $x_i=0,1$. Adding back the quadratic gives one template $Q$ that fits the facet templates throughout.

Where can the marking differ from $Q$? On any tight facet containing a changed vertex $v$, its flip must be neutral within that facet. Suppose $v$ has an unchanged template edge in direction $j$. The $n-1$ facets through $v$ that leave bit $j$ free must all be nontight because each contains that edge. This uses the entire allowance. Two unchanged directions at $v$ would require all $n$ facets through it to be nontight.

A second nonneutral flip would have to require exactly the same $n-1$ nontight facets. The direction missing from the list identifies $j$, and the bits fixed by those facets identify every bit of $v$ except $j$. The only other candidate is its neighbor $v+e_j$. Crossing that edge leaves its own edge difference at zero but toggles all the others from one to zero. The neighbor thus has too many unchanged edges to be flipped.

All flips are therefore neutral except for at most one, which has a single unchanged edge. Neutral flips cannot affect the cost of that one flip. To see this, let $z$ be the bitwise difference between a neutral vertex and a vertex with just one unchanged edge, in direction $j$. Their edge-difference vectors differ only at $j$, so $T(z)=e_j$. In odd dimension every output of $T$ has an even number of ones, ruling out such a pair. In even dimension the solution is $\mathbf1+e_j$: the vertices differ in $n-1$ bits and cannot share a three-face. The total loss is therefore either zero or $L_n(1)=\binom{n-1}{2}$, and both scores occur. This proves the classification and gives the gap needed to repeat the argument in the next dimension.

As an independent check, we counted balls by looking at the four marked vertices on a face: three must each have one marked neighbor there, and the fourth must have three. This count recovered the single-flip loss for every $k$ in dimensions four through twelve. In dimension eight it also gave exactly the predicted markings at both top scores among all 409,600 ordered pairs of tight halves in a fixed direction. The facet argument explains why the gap holds for arbitrary markings: at the first positive loss in dimensions eight and above, a single unchanged edge at the flipped vertex determines every nontight facet.

## References

1. John Goldwasser and Ryan Hansen. [Inducibility in the hypercube](https://arxiv.org/abs/2209.04740) (2022).
2. Levente Bodnár and Oleg Pikhurko. [Some exact values of the inducibility and statistics constants for hypercubes](https://arxiv.org/abs/2503.03408v3) (2025), Theorem 2.
