Manuscript Offprint
arXiv:2610.40486Average pairwise Hamming distance of a subset in a hypercube
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
In this note, we prove that for a subset of of density , its average pairwise Hamming distance is at least , with equality attained only by -dimensional subcubes. This answers a question of Lei Yu, and solves an important open case of a more general question posed by Ahlswede and Katona in 1977.
1 Introduction
Given two -dimensional binary vectors , we denote by the Hamming distance between them, which is the number of coordinates such that . A natural question was raised by Ahlswede and Katona [2] about half a century ago: for a given , among all subsets of fixed size or fixed density , what is the minimum average Hamming distance between two independent random vectors, each uniformly chosen from ?
Denote by this average distance. It is not hard to observe that every -dimensional subcube of has average pairwise distance . Intuitively, to minimize the average pairwise distance of , we would want the vectors to be as close to each other as possible to form a “compact” structure. And a subcube is a natural candidate for such a “compact” construction. In light of this construction, one can ask whether for every , among all subsets with , the average pairwise Hamming distance is always minimized by a -dimensional subcube. This is trivially true for . Althöfer and Sillke [4] showed that the average pairwise distance of every is at least , which for (i.e. ) shows the -dimensional subcube is the minimizer. Let
So the results above give and . Fu, Wei, and Yeung [6] developed a linear-programming approach and proved for , which implies .
However, when and , there exists a construction (see Remark 4, Page 70 of [3]) showing by taking all vectors of Hamming weight at most 4 and some of the weight-5 vectors. Indeed calculations show that when the density is small, for sufficiently large , a subset resembling a Hamming ball has average pairwise Hamming distance smaller than that of the subcube of equal size. There has also been substantial work on exact values, lower bounds, and asymptotic behavior of in various parameter ranges, see [1, 6, 8, 9, 10, 11, 12, 13].
Even though the subcube is not always the minimizer, its optimality when the density is or remains unknown. In particular, one might ask whether is still equal to for . The
*Department of Mathematics, National University of Singapore. Email: fangyijia@u.nus.edu.
Department of Mathematics, National University of Singapore. Email: huanghao@nus.edu.sg. Research supported in part by a start-up grant at NUS and an MOE Academic Research Fund (AcRF) Tier 1 grant A-8003627.
case was explicitly posed by Yu (Problem 2 in [12]) in his recent breakthrough paper which improved the classical level-1 bound (Chang's inequality as in [5]) in both the small- and large-density regimes.
In this short note, we resolve the case and prove the following theorem, which shows that the subcube is still optimal when the density is .
Theorem 1.1. Suppose has density , i.e. , then its average pairwise Hamming distance is at least . Equality holds if and only if is a -dimensional subcube of .
Lemma 2.1. For with , we have
Proof. For every ,
Using , we have
Note that each , so
Therefore using the independence of X and Y, we have
One key estimate we use in our proof is the following inequality involving the cosine functions.
Lemma 2.2. Suppose satisfy , then
Equality holds exactly when three are and the rest are 0.
Proof. If the left hand side is non-positive, then the inequality automatically holds. If equality holds in this case, then , which means that every is either 0 or . Thus exactly three of them are and the rest are 0.
Now suppose the left hand side is strictly positive. Using for , we have
So if , then the strict inequality is also true.
It remains to consider the case . By the negativity of this product, there is an odd number of indices such that . Suppose there is only one such index, then the sum of squares of the other 's is at least . The same inequality gives
which is impossible. Thus there are at least three 's that are strictly greater than . Without loss of generality, we assume . They satisfy . By the AM-GM inequality,
Using and writing , we have
Since we have assumed that , this also gives . So . Thus , and . Plugged into the inequality above, we have
completing the proof of the last case.
Lemma 2.3. For a real number , write . Define
then for every ,
Equality occurs exactly when .
Proof. First note that and are both even functions. So we just need to prove the inequality for and show that equality is attained only at .
Secondly, the periodicity of the cosine function gives that for every u,
For , the inequality just becomes . For , it suffices to show . So if we are able to establish that for all and only attains 0 at in the interval , then by the fact that is even, we immediately complete the proof and the characterization of the equality case.
We do standard calculus for the last step. By calculation . We discuss two cases. First for , direct differentiation gives
which is a quadratic function in . At the endpoints, and . So in , first decreases and then increases. Using , we have on . Therefore for .
For , we substitute , then
For both inequalities, we use .
Lemma 2.4. Let be independent uniform signs from . Suppose , and . Then
Equality holds if and only if three of the 's are , and the rest are 0.
Proof. Without loss of generality we can assume all by replacing by . We let and . Then
By the independence of 's, we have
Similarly
Applying Lemma 2.3 with and taking expectations, we have
Dividing both sides by 8 concludes the proof of the inequality. When equality is attained, we need equality in Lemma 2.2, which gives three and the rest equal 0. Thus exactly three 's have absolute value 1, and all the others vanish.
The celebrated level-1 bound, often called Chang's inequality [5], states that . This specific form can be found in [7]. For our case , this gives . This is not enough for establishing the optimality of the -dimensional subcube. We prove the following stronger bound.
Lemma 2.5. For with , we have
Furthermore when equality holds, is a -dimensional subcube of .
Proof. Let us start by assuming . We will show that equality is the only possibility. Note that
Therefore if we let
we have and . So the assumptions of Lemma 2.4 are satisfied. Therefore if we let for uniformly chosen from , then
Note that we can let , with uniform from ,
For each , clearly we have the pointwise inequality . Taking expectations, and using that is symmetric about zero, we have
This gives
completing the proof of the inequality.
When the equality holds, we have . Using the equality condition from Lemma 2.4, for
exactly three of them are , and the rest are 0. Without loss of generality, we can assume and the others are zero. This immediately gives for . This clearly shows that is a -dimensional subcube of consisting of vectors whose first three coordinates are fixed.
Now it is straightforward to combine the previous lemmas and complete the proof of our main theorem.
Proof of Theorem 1.1. For , satisfies the conditions in Lemma 2.5, thus
Applying Lemma 2.1, we have
This shows the average Hamming distance is at least . The equality characterization also follows from Lemma 2.5.
3 Concluding Remarks
We believe the same technique should also lead to the following result for the density case: for and , the average pairwise Hamming distance of is at least . In particular, we believe the following conjecture, an analogue of Lemma 2.4, is true.
Conjecture 3.1. Let be independent uniform signs from . Suppose , and . Then
Equality holds if and only if exactly four of the 's are , and the rest are 0.
We believe it can be proved similarly by constructing a function using higher degree polynomials in the cosine functions, such that is comparable to the positive part of , as we have done in Lemma 2.3. And it would immediately imply the desired result for density .
Below is another natural question: for given , and a sequence of real numbers, given a subset of fixed size, we may consider the weighted sum
and ask which minimizes if the dimension and the size are fixed. For example, when this corresponds to the average pairwise Hamming distance problem studied in this paper. When and all other , this is exactly the edge isoperimetric inequality for the hypercube. From these examples, we may suggest the following problem:
Question 3.2. Is it true that if a sequence of non-negative real numbers is non-decreasing and concave, then for fixed , the corresponding subcube construction always minimizes , among all with ?
One can also ask the following question, inspired by the edge isoperimetric inequality:
Question 3.3. Which infinite sequences of constants, independent of , have the following property: for every and every , the -dimensional subcube always minimizes , among all with ?
Declaration of AI use. ChatGPT 6 Astra was used to explore trigonometric polynomials that lead to the proof of Lemma 2.3, as well as proofreading and language polishing. All AI-assisted outputs were independently checked, verified, and simplified by the authors, who assume full responsibility for the content of this work.
Acknowledgment. We are deeply grateful to Fan Chang and Lei Yu for bringing this elegant conjecture to our attention. Their insights and suggestions during the early stages of this project played an important role in shaping the direction of this work.
References
[1] R. Ahlswede and I. Althöfer, The asymptotic behaviour of diameters in the average, J. Combin. Theory Ser. B, 61 (1994) 167–177.
[2] R. Ahlswede and G. O. H. Katona, Contributions to the geometry of Hamming spaces, Discrete Mathematics, 17 (1) (1977), 1–22.
[3] G. Ajjanagadde, Fourier analysis on the hypercube, the coefficient problem, and applications, MIT Ph.D. Dissertation, 2020.
[4] I. Althöfer and T. Sillke, An “average distance” inequality for large subsets of the cube, J. Combin. Theory Ser. B, 56 (1992) 296–301.
[5] M.-C. Chang, A polynomial bound in Freiman's theorem, Duke Mathematical Journal, 113 (3) (2002), 399–419.
[6] F.-W. Fu, V. K. Wei, and R. W. Yeung, On the minimum average distance of binary codes: linear programming approach. Discrete Applied Mathematics, 111 (3) (2001), 263–281.
[7] R. Impagliazzo, C. Moore, and A. Russell, An entropic proof of Chang's inequality, SIAM Journal on Discrete Mathematics 28 (1) (2014), 173–176.
[8] F. Jaeger, A. Khelladi, and M. Mollard, On shortest cocycle covers of graphs, J. Combin. Theory Ser. B 39 (1985) 153–163.
[9] A. Kündgen, Minimum average distance subsets in the Hamming cube, Discrete Mathematics 249(1–3) (2002), 149–165.
[10] B. Mounits, Lower bounds on the minimum average distance of binary codes, Discrete Mathematics 308 (24) (2008), 6241–6253.
[11] S.-T. Xia and F.-W. Fu, On the average Hamming distance for binary codes. Discrete Applied Mathematics, 89 (1–3) (1998), 269–276.
[12] L. Yu, On average distance, level-1 Fourier weight, and Chang's Lemma, arXiv:2504.02593 [math.CO].
[13] L. Yu and V. Y. F. Tan, An improved linear programming bound on the average distance of a binary code, arXiv:1910.09416, 2019.