I have already read different things about hamming distance, hamming code, detection and correction of memory errors, but I am still not understanding many things.

I know that the hamming distance between 2 codewords is the number of bits to be reversed to convert one codeword into the other.

I know that the hamming code is the set of all possible codewords. The codewords are composed of data bits and control bits, hence the number of bits in a codeword is n = m + r, where m is the number of data bits and r is the number of check bits. And the number of possible codewords with n bits should be $2^n$.

One thing I am not understanding is what are these valid and invalid codewords and how to 'calculate' them? Why a codeword is valid and invalid? What is the connection with the parity bits? How to find an invalid codeword?

I'm sorry if I am asking many things together, but I am really not understanding exactly the concepts I cited above.


There's no such thing as a "valid" or "invalid" codeword. If a string of bits is a codeword in a particular code such as a Hamming code, it's "valid"; if it's not a codeword, it's "invalid".

  • $\begingroup$ There's no such thing as a "valid codeword". There are strings that are codewords and things that aren't. How many codewords there are in a particular code depends on what code it is. $\endgroup$ – David Richerby Oct 4 '14 at 23:29
  • $\begingroup$ Which Hamming code? There's an infinite family of them. $\endgroup$ – David Richerby Oct 5 '14 at 0:17
  • $\begingroup$ what do you call an invalid received message? i.e. the opposite of a "codeword" is a "____" ? $\endgroup$ – Jason S May 6 '18 at 22:30
  • $\begingroup$ @JasonS Not sure. There’s always “non-codeword” but you should ask new questions as questions, rather than posting them as comments. $\endgroup$ – David Richerby May 7 '18 at 7:39
  • $\begingroup$ except that it's quite relevant to your answer. Oh, and sites tend to close questions as duplicates. $\endgroup$ – Jason S May 8 '18 at 4:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy