Work out hamming distance instantly with clear inputs, formula shown and shareable results.
The Hamming distance counts positions where two equal-length strings differ. A code whose minimum distance is d can detect d − 1 errors and correct ⌊(d − 1)/2⌋ of them.
Hamming distance
d(a, b) = number of positions where the symbols differ
Error capability
detect d − 1, correct ⌊(d − 1)/2⌋
Two positions differ, so the distance is 2.
Codewords must be far enough apart that a corrupted word is still nearest to the original, which needs a gap of 2t + 1 to correct t errors.