In mathematics and information theory, a linear code is an important type of block codes used in error correction and detection schemes. The linearity of the code means that the sum of any two codewords is a codeword. Linear codes allow for more efficient encoding and decoding algorithms (cf. syndrome decoding).
Formal definition
A linear code of length and rank is a linear subspace with dimension of the vector space where is the finite field with elements. The most important cases are when is 2 or 3, in which case the code is said to be binary or ternary, respectively.
Properties
By virtue of the fact that the code is a subspace of , the sum of two codewords in is also a codeword (ie an element of the subspace ). Thus the entire code (which may be very large) to be represented as the span of a minimal set of codewords (known as a basis in linear algebra terms). These basis codewords are often collated in the rows of a matrix known as a generating matrix for the code .
The subspace definition also gives rise to the important property that the minimum Hamming distance between codewords is simply the minimum Hamming weight of all codewords since:
implying:
Popular notation
Codes in general are often denoted by the letter . A linear code of length , rank (ie having codewords in its basis and rows in its generating matrix) and minimum Hamming weight is referred to as an code.
Remark. This is not to be confused with the notation to denote a non-linear code of length , size (ie having codewords) and minimum Hamming distance .