Number of bitstrings in a subset having Hamming distance $k$

68 Views Asked by At

Given a bitstring x and a subset $P \subset \{0,1\}^n $. There are $n \choose k $ bitstrings in $\{0,1\}^n $ with Hamming distance $k$. How many bistrings with Hamming distance $k$ are in the subset $P$, in terms of $|P|$? Also tight bounds would be interesting.

Edit:

partiulary I would like to bound for $x,x' \in P$, $\sum\limits_{x \neq x' } H(x,x')$

2

There are 2 best solutions below

2
On

You can't say anything interesting with respect to $|P|$ unless $P$ has some property. You can both build a subset $P$ where each element has Hamming distance $k$ or, viceversa, where no element has Hamming distance $k$.

5
On

Assuming you mean Hamming distance between strings:

Let $p = |P|$. For $p$ bits $b_i$, the maximum Hamming distance $\sum_{b_i \ne b_j} |b_i - b_j|$ is when half are zero and half are one. Suppose there are $k$ zeros and $p-k$ ones. Then the Hamming distance of all pairs $(b_i, b_j)$ is $2k(p-k)$ which is maximized at $k = \lfloor p/2 \rfloor$ to get $\lfloor p^2/2 \rfloor$. For $p$ bitrstrings of length $n$, an upper bound is $n \lfloor p^2/2 \rfloor$.