In coding theory, a parity-check matrix of a linear block code C is a matrix which describes the linear relations that the components of a codeword must satisfy. It can be used to decide whether a particular vector is a codeword and is also used in decoding algorithms.
Formally, a parity check matrix H of a linear code C is a generator matrix of the dual code, C⊥. This means that a codeword c is in C if and only if the matrix-vector product (some authors[1] would write this in an equivalent form, cH⊤ = 0.)
The rows of a parity check matrix are the coefficients of the parity check equations. That is, they show how linear combinations of certain digits (components) of each codeword equal zero. For example, the parity check matrix
H= \left[ \begin{array}{cccc} 0&0&1&1\\ 1&1&0&0 \end{array} \right]
compactly represents the parity check equations,
\begin{align}c3+c4&=0\ c1+c2&=0\end{align}
(c1,c2,c3,c4)
From the definition of the parity-check matrix it directly follows the minimum distance of the code is the minimum number d such that every d - 1 columns of a parity-check matrix H are linearly independent while there exist d columns of H that are linearly dependent.
The parity check matrix for a given code can be derived from its generator matrix (and vice versa). If the generator matrix for an [''n'',''k'']-code is in standard form
G=\begin{bmatrix}Ik|P\end{bmatrix}
H=\begin{bmatrix}-P\top|In-k\end{bmatrix}
GH\top=P-P=0
For example, if a binary code has the generator matrix
G=\left[ \begin{array}{cc|ccc} 1&0&1&0&1\\ 0&1&1&1&0\\ \end{array} \right]
then its parity check matrix is
H= \left[ \begin{array}{cc|ccc} 1&1&1&0&0\\ 0&1&0&1&0\\ 1&0&0&0&1\\ \end{array} \right]
It can be verified that G is a
k x n
(n-k) x n
For any (row) vector x of the ambient vector space, s = Hx⊤ is called the syndrome of x. The vector x is a codeword if and only if s = 0. The calculation of syndromes is the basis for the syndrome decoding algorithm.