arXiv:2610.40486math.COOct 2026

Manuscript Offprint

arXiv:2610.40486

Average pairwise Hamming distance of a subset in a hypercube

Yijia Fang, Hao Huang

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 F\mathcal{F} of {0,1}n\{0,1\}^n of density 18\frac{1}{8}, its average pairwise Hamming distance is at least n−32\frac{n-3}{2}, with equality attained only by (n−3)(n-3)-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 nn-dimensional binary vectors x,yx, y, we denote by dH(x,y)d_H(x, y) the Hamming distance between them, which is the number of coordinates i∈[n]i \in [n] such that xi≠yix_i \neq y_i. A natural question was raised by Ahlswede and Katona [2] about half a century ago: for a given nn, among all subsets F⊂{0,1}n\mathcal{F} \subset \{0,1\}^n of fixed size ∣F∣|\mathcal{F}| or fixed density α=∣F∣2n\alpha = \frac{|\mathcal{F}|}{2^n}, what is the minimum average Hamming distance between two independent random vectors, each uniformly chosen from F\mathcal{F}?

Denote by EX,Y∼Unif(F)dH(X,Y)\mathbb{E}_{X,Y \sim \text{Unif}(\mathcal{F})} d_H(X, Y) this average distance. It is not hard to observe that every dd-dimensional subcube of {0,1}n\{0,1\}^n has average pairwise distance d2\frac{d}{2}. Intuitively, to minimize the average pairwise distance of F\mathcal{F}, 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 0≤d≤n0 \leq d \leq n, among all subsets F⊂{0,1}n\mathcal{F} \subset \{0,1\}^n with ∣F∣=2d|\mathcal{F}| = 2^d, the average pairwise Hamming distance is always minimized by a dd-dimensional subcube. This is trivially true for d=nd = n. Althöfer and Sillke [4] showed that the average pairwise distance of every F\mathcal{F} is at least n+12−2n−1∣F∣\frac{n+1}{2} - \frac{2^{n-1}}{|\mathcal{F}|}, which for d=n−1d = n - 1 (i.e. ∣F∣=2n−1|\mathcal{F}| = 2^{n-1}) shows the (n−1)(n-1)-dimensional subcube is the minimizer. Let

β(n,M)=min⁡{EX,Y∼Unif(F)dH(X,Y):F⊂{0,1}n,∣F∣=M}.\beta(n,M)=\min\left\{\mathbb{E}_{X,Y\sim\mathrm{Unif}(\mathcal{F})}d_{H}(X,Y):\mathcal{F}\subset\{0,1\}^{n},|\mathcal{F}|=M\right\}.

So the results above give β(n,2n)=n2\beta(n,2^n) = \frac{n}{2} and β(n,2n−1)=n−12\beta(n,2^{n-1}) = \frac{n-1}{2}. Fu, Wei, and Yeung [6] developed a linear-programming approach and proved β(n,M)≥n2−2n−2M\beta(n,M) \geq \frac{n}{2} - \frac{2^{n-2}}{M} for M≤2n−1M \leq 2^{n-1}, which implies β(n,2n−2)=n−22\beta(n,2^{n-2}) = \frac{n-2}{2}.

However, when d=n−5d = n - 5 and n=19n = 19, there exists a construction (see Remark 4, Page 70 of [3]) showing β(n,2n−5)<n−52\beta(n, 2^{n-5}) < \frac{n-5}{2} 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 nn, 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 β(n,M)\beta(n, M) 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 18\frac{1}{8} or 116\frac{1}{16} remains unknown. In particular, one might ask whether β(n,2n−k)\beta(n, 2^{n-k}) is still equal to n−k2\frac{n-k}{2} for k∈{3,4}k \in \{3, 4\}. The k=3k = 3

*Department of Mathematics, National University of Singapore. Email: fangyijia@u.nus.edu.

†^{\dagger}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 k=3k = 3 case and prove the following theorem, which shows that the subcube is still optimal when the density is 18\frac{1}{8}.

Theorem 1.1. Suppose F⊂{0,1}n\mathcal{F} \subset \{0,1\}^n has density 18\frac{1}{8}, i.e. ∣F∣=2n−3|\mathcal{F}| = 2^{n-3}, then its average pairwise Hamming distance is at least n−32\frac{n-3}{2}. Equality holds if and only if F\mathcal{F} is a (n−3)(n-3)-dimensional subcube of {0,1}n\{0,1\}^n.