In
coding theory
Coding theory is the study of the properties of codes and their respective fitness for specific applications. Codes are used for data compression, cryptography, error detection and correction, data transmission and computer data storage, data sto ...
, a cyclic code is a
block code
In coding theory, block codes are a large and important family of Channel coding, error-correcting codes that encode data in blocks.
There is a vast number of examples for block codes, many of which have a wide range of practical applications. Th ...
, where the
circular shift
In combinatorial mathematics, a circular shift is the operation of rearranging the entries in a tuple, either by moving the final entry to the first position, while shifting all other entries to the next position, or by performing the inverse ope ...
s of each codeword gives another word that belongs to the code. They are
error-correcting codes
In computing, telecommunication, information theory, and coding theory, forward error correction (FEC) or channel coding is a technique used for controlling errors in data transmission over unreliable or noisy communication channels.
The centra ...
that have algebraic properties that are convenient for efficient
error detection and correction
In information theory and coding theory with applications in computer science and telecommunications, error detection and correction (EDAC) or error control are techniques that enable reliable delivery of digital data over unreliable communi ...
.
Definition
Let
be a
linear code
In coding theory, a linear code is an error-correcting code for which any linear combination of Code word (communication), codewords is also a codeword. Linear codes are traditionally partitioned into block codes and convolutional codes, although t ...
over a
finite field
In mathematics, a finite field or Galois field (so-named in honor of Évariste Galois) is a field (mathematics), field that contains a finite number of Element (mathematics), elements. As with any field, a finite field is a Set (mathematics), s ...
(also called '' Galois field'')
of
block length .
is called a cyclic code if, for every
codeword from
, the word
in
obtained by a
cyclic right shift of components is again a codeword. Because one cyclic right shift is equal to
cyclic left shifts, a cyclic code may also be defined via cyclic left shifts. Therefore, the linear code
is cyclic precisely when it is invariant under all cyclic shifts.
Cyclic codes have some additional structural constraint on the codes. They are based on
Galois fields and because of their structural properties they are very useful for error controls. Their structure is strongly related to Galois fields because of which the encoding and decoding algorithms for cyclic codes are computationally efficient.
Algebraic structure
Cyclic codes can be linked to ideals in certain rings. Let
be a quotient of a
polynomial ring
In mathematics, especially in the field of algebra, a polynomial ring or polynomial algebra is a ring formed from the set of polynomials in one or more indeterminates (traditionally also called variables) with coefficients in another ring, ...
over the finite field
. Identify the elements of the cyclic code
with polynomials in
such that
maps to the polynomial
: thus multiplication by
corresponds to a cyclic shift. Then
is an
ideal in
, and hence
principal, since
is a
principal ideal ring
In mathematics, a principal right (left) ideal ring is a ring ''R'' in which every right (left) ideal is of the form ''xR'' (''Rx'') for some element ''x'' of ''R''. (The right and left ideals of this form, generated by one element, are called p ...
. The ideal is generated by the unique monic element in
of minimum degree, the ''generator polynomial''
.
This must be a divisor of
. It follows that every cyclic code is a
polynomial code In coding theory, a polynomial code is a type of linear code whose set of valid code words consists of those polynomials (usually of some fixed length) that are divisible by a given fixed polynomial (of shorter length, called the ''generator polyno ...
.
If the generator polynomial
has degree
then the rank of the code
is
.
If
is a cyclic code, the
dual code
In coding theory, the dual code of a linear code
:C\subset\mathbb_q^n
is the linear code defined by
:C^\perp = \
where
:\langle x, c \rangle = \sum_^n x_i c_i
is a scalar product. In linear algebra terms, the dual code is the annihilator ...
is also a cyclic code. The generator polynomial
for
is also called the parity-check polynomial or simply check polynomial for
. It can also be shown that
, where
denotes the
reciprocal polynomial of
.
The idempotent of
is a codeword
such that
(that is,
is an
idempotent element of
) and
is an identity for the code, that is
for every codeword
. If
and
are
coprime
In number theory, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equiv ...
such a word always exists and is unique; it is a generator of the code.
An irreducible code is a cyclic code in which the code, as an ideal is irreducible, i.e. is minimal in
, so that its check polynomial is an
irreducible polynomial
In mathematics, an irreducible polynomial is, roughly speaking, a polynomial that cannot be factored into the product of two non-constant polynomials. The property of irreducibility depends on the nature of the coefficients that are accepted f ...
.
Examples
For example, if
and
, the set of codewords contained in the cyclic code generated by
is precisely
This code corresponds to the ideal in
generated by
.
The polynomial
is irreducible in the polynomial ring, and hence the code is an irreducible code.
The idempotent of this code is the polynomial
, corresponding to the codeword
.
Trivial examples
Trivial examples of cyclic codes are
itself and the code containing only the zero codeword. These correspond to generators
and
respectively: these two polynomials must always be factors of
.
Over
the
parity bit
A parity bit, or check bit, is a bit added to a string of binary code. Parity bits are a simple form of error detecting code. Parity bits are generally applied to the smallest units of a communication protocol, typically 8-bit octets (bytes) ...
code, consisting of all words of even weight, corresponds to generator
. Again over
this must always be a factor of
.
Other examples
Many types of commonly used error-correcting codes can be represented as cyclic codes, including
BCH codes,
Reed-Solomon codes, and some classes of
low-density parity-check codes defined from finite geometries.
For correcting errors
Cyclic codes can be used to
correct errors, like
Hamming code
In computer science and telecommunications, Hamming codes are a family of linear error-correcting codes. Hamming codes can detect one-bit and two-bit errors, or correct one-bit errors without detection of uncorrected errors. By contrast, the ...
s as cyclic codes can be used for correcting single error. Likewise, they are also used to correct double errors and burst errors. All types of error corrections are covered briefly in the further subsections.
The (7,4) Hamming code has a
generator polynomial In coding theory, a polynomial code is a type of linear code whose set of valid code words consists of those polynomials (usually of some fixed length) that are divisible by a given fixed polynomial (of shorter length, called the ''generator polyno ...
. This polynomial has a zero in
Galois extension field at the primitive element
, and all codewords satisfy
. Cyclic codes can also be used to correct double errors over the field
. Blocklength will be
equal to
and primitive elements
and
as zeros in the
because we are considering the case of two errors here, so each will represent one error.
The received word is a polynomial of degree
given as
where
can have at most two nonzero coefficients corresponding to 2 errors.
We define the syndrome polynomial,
as the remainder of polynomial
when divided by the generator polynomial
i.e.
as
.
For correcting two errors
Let the field elements
and
be the two error location numbers. If only one error occurs then
is equal to zero and if none occurs both are zero.
Let
and
.
These field elements are called "syndromes". Now because
is zero at primitive elements
and
, so we can write
and
. If say two errors occur, then
and
.
And these two can be considered as two pair of equations in
with two unknowns and hence we can write
and
.
Hence if the two pair of nonlinear equations can be solved cyclic codes can used to correct two errors.
Hamming code
The
Hamming(7,4)
In coding theory, Hamming(7,4) is a linear code, linear error-correcting code that encodes four bits of data into seven bits by adding three parity bits. It is a member of a larger family of Hamming codes, but the term ''Hamming code'' often re ...
code may be written as a cyclic code over GF(2) with generator
. In fact, any binary Hamming code of the form Ham(r, 2) is equivalent to a cyclic code, and any Hamming code of the form Ham(r,q) with r and q-1 relatively prime is also equivalent to a cyclic code. Given a Hamming code of the form Ham(r,2) with
, the set of even codewords forms a cyclic