Is it possible to calculate Hamming distance with only parity check matrix?

2.2k Views Asked by At

let's say I have this parity matirx, is there a way to calculate minimal distance between two valid words without writing all possible code words? $$ H= \begin{bmatrix} 0 & 1 & 0 & 0 & 1 & 0 & 1\\ 1 & 0 & 0 & 1 & 0 & 1 & 0\\ 0 & 0 & 1 & 1 & 1 & 1 & 1 \end{bmatrix} $$

1

There are 1 best solutions below

1
On BEST ANSWER

As hinted in the comments, a codeword $(c_1,\ldots,c_n)$ satisfies $$ c_1 h_1+c_2 h_2+\cdots +c_1 h_n=0, $$ where the right hand side is the zero vector and $h_i$ is the ith column of $H.$ So find a nontrivial linear combination (coefficients must be $0$ or $1$ since we are in the binary field $GF(2)$ and the only nonzero scalar is $1$) with the fewest number of columns that add up to the zero vector (mod 2) to obtain the minimum weight.

Now the matrix is binary so the only way two columns have a nontrivial linear combination adding up to zero is if they are equal. Since this is not the case here, you can establish the minimum distance is $3$ if $3$ columns add up to zero. For this $H$, columns $1,3,4$ add up to zero so the minimum weight (hence the minimum distance) is $3.$ So we have $$ h_1+h_3+h_4= \begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix}+ \begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix}+ \begin{bmatrix} 0 \\ 1 \\ 1 \end{bmatrix}= \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix}. $$