# Behaviour of the [5,2] extended ternary Hamming code

A received word using this code will have $3^{5-2}=27$ cosets:

if no error has occurred, the coset leader is 00000;

if only one error has occurred, then the coset leader is one of the ten possible weight-1 error words, right?

So this leaves us with $16$ cosets remaining, corresponding to $2$$5\choose2$$=20$ possible weight-$2$ error words. In this case, how are the error words distributed among the different cosets? Some cosets will clearly contain just one error word, implying that this code can correct some two-bit errors. Which contradicts the theorem saying that a code of minimum distance 4 (this one) can correct up to one error!! So where have I gone wrong?

-
A linear code of minimum distance 4 can correct all one-bit errors. That doesn't preclude being able to correct some two-bit errors, it just can't correct all of them. There doesn't seem to be a contradiction. –  rschwieb May 3 '13 at 13:06

There are a total of 40 vectors of weight two. Ten ways to select the two non-zero positions, and two non-zero values for both of the non-zero components. $$40={5\choose 2} (3-1)^2.$$