6

Two $n$ bit binary strings $S_1$ and $S_2$ are chosen randomly with uniform probability.

The probability that the Hamming distance in between these strings (the number of bit positions where the two strings differ) is equal to $d$ is:

  1. $\binom{n}{d} \over {2^n}$
  2. $\binom{n}{d} \over {2^n}$
  3. $d\over2^n$
  4. $1\over2^d$

...choose the right answer.

I tried to solve the problem, but I didn't find any suitable way to tackle this problem.

2 Answers2

6

If I understood the problem correctly, and correct me if I'm wrong:

First it is required that the number of $1$s in $S=S_1 \oplus S_2$ will be $d$.
The number of distinct ordered pairs of binary strings that satisfy the above for a given $S$ is $2^{n}$.
Second, the number of binary strings with exactly $d$ $1$s is $\binom{n}{d}$, and the total number of distinct pairs of strings is $2^{2n}$.

Given the above, the probability of the Hamming distnace being $d$, for two random strings is: $$P(d)=\frac{2^n \binom{n}{d}}{2^{2n}}=\frac{ \binom{n}{d}}{2^{n}}$$

user76568
  • 4,542
3

Start with a simple case, take $d=0$ (both strings are exactly the same). The probability of that a specific sequence coincides is $\frac{1}{2^n} \cdot \frac{1}{2^n}=\frac{1}{2^{2n}}$ and you have $2^n$ such possibilities, hence for $d=0$ this probability is $\frac{2^n}{2^{2n}}=\frac{1}{2^n}$. Can you extend this idea?

Alex
  • 19,262
  • isn't when d=0 both strings will be same? – Rishi Prakash Jan 26 '14 at 19:32
  • 1
    you are right! Damn, I've done too much math today) But the idea stays the same: there are $2^n$ ways to have $d_{H}(x,y)=0$ – Alex Jan 26 '14 at 19:34
  • I am trying to grasp and solve it further.will get back to you if don't find success. Thanks. – Rishi Prakash Jan 26 '14 at 19:36
  • OK, I think Dror's solution is correct. – Alex Jan 26 '14 at 19:37
  • yes,that's correct.I will accept it after solving problem completely.(myself) – Rishi Prakash Jan 26 '14 at 19:39
  • 2
    If you consider $d=0$, you immediately exclude b) and c) and clearly d) is false, so a) is the only correct solution – Alex Jan 26 '14 at 19:41
  • oh yes ,now I see that. :) – Rishi Prakash Jan 26 '14 at 19:43
  • I tried to figure out how this problem was solved.I will explain what I learnt,correct me if I go wrong. For n bit ,if we want to find d 1s than it's obviously nCd ,and as we are comparing 2 n bit strings hence from the n bits in S i.e S=S1 exor S2,we can have 2^n strings.So total favorable event = 2^n * nCd. Now all possible String Combinations 2^2n. Is it OK? – Rishi Prakash Jan 27 '14 at 07:32