0
$\begingroup$

If i have a series of $n$ bits $0$s and $1$s how many different strings differ by 1? For instance $00001$ and $00000$ as well as $1001$ and $1011$ differ by one.I can understand that each string is "close" with $n$ other strings since we can "flip" once all of its digits and produce new strings that have distance $1$ with our original.

If we now consider all possible strings of size n how many strings differ by "1"

By differ i mean their Hamming distance.

  • 0
    What do you mean by "differ by $1$" Do you consider $11011$ to differ by one to the string $10011$ (*since they differ in only one position*) while $11011$ and $11100$ differ by three (*since they differ in three positions*) or do you consider only $11011$ to differ by one with $11100$ and $11010$ (*since in binary arithmetic $|11011-11100|=1$ and $|11011-11010|=1$*). I.e. are we talking about "distance of $1$" in terms of [Hamming distance](https://en.wikipedia.org/wiki/Hamming_distance) or in terms of absolute value of difference between binary numbers?2017-02-28
  • 0
    I mean the first that the differ in one position2017-02-28
  • 0
    So... take your specific initial length $n$ string. Pick one of the $n$ bits and "flip" it, changing it from either a zero to a one or vice versa. Do you see why that produces a new different string which is hamming distance one away from the initial string? Do you see why there are no others? How many choices were available to you at any step of this process?2017-02-28

1 Answers 1

2

If your notion of difference is Hamming distance, then a binary string of length $n$ has exactly $n$ neighbors of Hamming distance $1$ (a single bit flip). This can be generalized further by noting that a Hamming distance of $k$ means choosing $k$ bits to be flipped, so that in general, any binary string of length $n$ has $\binom{n}{k}$ other strings at Hamming distance $k$.