Codeword 2026-10-14
A codeword is a member of the specified set of words used to encode messages. For a linear code specified by a parity-check matrix , the codewords are precisely the vectors satisfying . The minimum distance between distinct codewords controls error correction.
Dual code Created 2026-09-24 Updated 2026-09-24
The dual code consists of the words orthogonal to every word of under the standard dot product. A parity-check matrix for is a generator matrix for .
Error-correcting code Created 2026-10-03 Updated 2026-10-14
An error-correcting code is a set of codewords chosen with enough separation to recover a transmitted message after specified errors. For equal-length words and bit-flip errors, separation is measured by Hamming distance. If the minimum distance is , any nonzero pattern of at most flips changes a valid word into an invalid word and can therefore be detected. Every pattern of at most flips can be corrected by choosing the unique nearby codeword.
The distinction matters. A distance-two code detects a single flip but need not locate it; a distance-three code corrects a single flip. The triangle inequality explains the correction threshold: a received word within distance of two distinct codewords would put those codewords within distance , a contradiction. Actual decoders also need an efficient way to find the nearby word; a parity-check matrix and syndrome decoding exploit the structure of a linear code to do this.
Hamming code as a cyclic code 2026-10-14
Let generate , , and set . The binary cyclic code defined by has a parity-check matrix consisting of every nonzero vector of once, after choosing a basis and ordering its columns. It is therefore a Hamming code. Its generator polynomial is the minimal polynomial of an algebraic element , of degree .
Hamming code of length seven 2026-10-14
The binary linear code known as the Hamming code of length seven is the kernel of a parity-check matrix whose columns are all the nonzero vectors of . Its dimension is four. No one-column or two-column sum vanishes, but some three-column sum does, so its minimum Hamming distance is three. The syndrome of a one-bit error is its column, uniquely identifying the erroneous position.
In the usual column convention, a codeword of a linear code obeys , so its nonzero coordinates give a linear dependence among columns of its parity-check matrix. Conversely a dependence gives a nonzero codeword supported on those coordinates. Minimizing the support gives the minimum Hamming distance of a linear code. In the transposed convention , the corresponding objects are the rows of . The size of a dependent set means the number of its coordinate positions, even when some check vectors coincide.
Parity-check matrix of a bar product 2026-10-03
If is a parity-check matrix of , then a parity-check matrix of isIts equations say that the first half lies in and that the sum of the two halves lies in .
Past exam of the mathematics course of the University of Cambridge 2002 iii Paper 30 2 Solution Created 2026-10-03 Updated 2026-10-14
For a binary linear code , define the linear functional . This is the parity of the Hamming weight, so the even-weight subcode of a binary linear code isIf , then . Otherwise its image is all of , and rank-nullity theorem gives . The kernel of a linear map is a linear subspace, proving the required dichotomy including closure under addition.
Let be a full-rank generator matrix. Messages correspond bijectively to codewords . If the th column is nonzero, the coordinate is a nonzero linear functional. Choose with . Translation pairs the messages with coordinate zero and those with coordinate one, so exactly codewords contribute one at position . Summing over the columns proves the total weight of a full-support binary linear code formulaA zero column would contribute zero instead, explaining the hypothesis.
For the Hamming code, use a parity-check matrix whose columns are all nonzero vectors of , once each. Then and . The sum of all columns is zero: each coordinate occurs as one exactly times, which is even for . ConsequentlyUnder this column labelling, the support of a vector of a codeword is identified with a set of distinct nonzero columns whose sum is zero. No one-column or two-column support of a vector has this property, confirming .
We can count the low-weight coefficients of a binary Hamming code directly. For weight three, choose ordered distinct nonzero columns in ways. The third must be , which is nonzero and different from both. Every unordered support of a vector has orderings, so .
For weight four, the first two columns are again distinct and nonzero. The third must avoid , giving possibilities. The fourth is ; it is nonzero because , and cannot equal any of the first three because those are distinct. Conversely every ordered zero-sum four-tuple arises in this way. Dividing by gives .
For weight five, the first three columns must be linearly independent. If , the sum condition would force the fourth and fifth to coincide. Thus there are choices for the first three. Put . The fourth column must avoid all seven nonzero vectors of their linear span: would repeat a column; would force the fifth column to be zero; and would force the fifth column to be , respectively. Conversely, if avoids these seven vectors, is nonzero and distinct from . This gives choices for and determines . Dividing by yieldsAt , the last count is zero, as the argument also shows.
The dual code is the row space of , so its codewords are for . For nonzero , the linear functional takes value one on exactly half the vectors of , by the same translation-pairing argument used above. Removing the zero vector removes only a zero value, so the Hamming weight is still . Since has matrix rank , distinct give distinct codewords. This proves the constant weight of a binary simplex code and its full distribution:In particular, the ordinary weight enumerator of the binary simplex code is .
Apply the MacWilliams identity to this dual code, whose size is . For , the result isThe coefficient of in the second product is a value of the binary Kravchuk polynomialsThese bounds merely enforce and . Since , they agree with the bounds in the PDF. Therefore the requested formula isFor a further check on the low-weight counts, givesThus , , and . Substituting these into the boxed formula and using reproduces the three direct combinatorial counts above.
Finally, at the only possible term in the defining sum has , so , because is even. ConsequentlyThe unique length- binary word of weight is the all-ones word, exactly as proved by the parity-check matrix calculation.
Past exam of the mathematics course of the University of Cambridge 2003 iii Paper 36 4 Solution Created 2026-10-03 Updated 2026-10-14
A cyclic code of length over is a linear code invariant under . Associate the word with . The shift is multiplication by modulo , so shift-invariant linear subspaces are exactly the ideals of . The inverse image of such an ideal in is principal and contains ; hence it is generated by a unique monic divisor of . The code has basis , and dimension .
The defining zeros of a cyclic code are the roots of its generator in a splitting field. Since , each is a root of unity over a finite field. Every codeword vanishes at each such root. If the characteristic divides , root multiplicities must additionally be retained; in the Hamming construction below the modulus has no repeated roots.
The unrestricted ternary cyclic-equivalence assertion is false. At it would give a cyclic code. Butover , with the quadratic irreducible. A dimension-two cyclic code needs a degree-two generator, so its only possibilities are and . Each is a weight-two codeword. Therefore neither has minimum distance three, and no code equivalent to the ternary Hamming code can be cyclic. A valid general version of the asserted construction assumes odd . The usual distance-three Hamming parameters also require ; when the code is the length-one zero code.
Here is the construction with its precise qualification. A ternary Hamming code has a parity-check matrix whose columns represent each one-dimensional subspace of once. There are such subspaces. Its rank is , because the coordinate lines are included. Its minimum distance is at least three, because no column is zero and no two are proportional. For , two independent vectors and their sum determine three distinct columns, and, after adjusting their nonzero representative scalars, give a weight-three linear relation. Thus its parameters are . Permuting columns and changing their nonzero representatives produces a monomial equivalence of linear codes.
Take odd and choose of order . Since is odd, is not in the cyclic subgroup generated by . Hence lie in distinct one-dimensional -subspaces: a proportional pair would have ratio or , neither possible for two distinct powers in this list. By their number they represent all projective points. Consequentlyis monomially equivalent to the ternary Hamming code. Since , evaluation at descends to and its kernel is an ideal, so is cyclic.
The degree of over is . If it were , its generated field would have elements and its element order would givea contradiction. Its minimal polynomial of an algebraic element therefore has degree . Applying Frobenius to a polynomial relation shows that are its roots; they are distinct by the same field-degree argument. Their product polynomial is the monic minimal polynomial of an algebraic element, and it divides . ThusThis identifies all the defining zeros. For , , the defining exponents are modulo .
There is also a uniform construction for all , explaining the missing qualification. Let generate , which has order . The powers represent all projective points, since proportional powers differ by exponent or modulo . But , so the kernel of is an ideal modulo , a negacyclic code. Multiplication by gives , preserving its kernel. This code is always equivalent to the ternary Hamming code. If is odd, is odd too, and the substitution , or coordinate scaling , changes this negacyclic construction into the cyclic one. In fact then has order . These explicit constructions prove the qualified assertion rather than relying on a theorem name.
For decoding, use the printed matrix with received words as row vectors; the conventional parity-check matrix is . The received word's syndrome isA single-symbol error of value at position has syndrome , where is row of the printed matrix. HereTherefore subtract at the sixth coordinate, changing its received value to modulo three. The decoded codeword isIts syndrome is zero. The thirteen projective rows and the two nonzero scalars give all nonzero syndromes exactly once, so this is the unique codeword at distance one. It is the transmitted word under the usual assumption of at most one symbol error. If positions are designated check positions, their independent unit rows make the other ten symbols systematic data, namely .
Past exam of the mathematics course of the University of Cambridge 2004 iii Paper 32 1 Solution Created 2026-10-03 Updated 2026-10-14
Over a finite field , a linear code of length and dimension is a -dimensional subspace . A full-row-rank generator matrix gives , using row-vector messages. A full-row-rank parity-check matrix gives . The dual code is , of dimension . Thus the rows of span , andConversely the rank conditions and imply that the row space of equals the kernel of , by inclusion and equality of dimensions.
For a CSS code, specialize to binary linear codes , of dimensions . Define orthonormal encoded statesDifferent cosets have disjoint computational-basis support. Their span has dimension , so it encodes logical qubits. For binary vectors write and . The stabilizer generators are for a basis of , and for a basis of . They fix each encoded state: the former permute its coset terms and the latter contribute phases . Their commutation relation is , so the classical dual inclusion makes them commute. There are independent checks, giving precisely this encoded space.
For a Pauli error , the Z checks give bit-error syndrome , where checks , and the X checks give phase-error syndrome , where generates and hence checks . Classical decoders therefore correct up to bit flips and phase flips if and . A Y error has both components; it is not omitted from this correction scheme.
For the precise quantum code distance, harmless stabilizer errors must be excluded. A pure-X error preserves the code exactly when , and is a stabilizer when ; a pure-Z error preserves it when , and is a stabilizer when . Consequently, for ,A mixed Pauli error has weight equal to the size of the union of its X and Z supports. If it is a nontrivial logical operator, at least one component is nontrivial, so its weight is at least ; pure-X or pure-Z operators attain that minimum. Thus arbitrary-qubit errors are correctable: products of two such Pauli errors have weight below and act scalarly on the code, or take it to an orthogonal syndrome sector. This is the Knill--Laflamme condition. Expanding arbitrary errors in the Pauli basis extends correction to their coherent linear span.
An explicit example is the Steane code. Take to be the binary Hamming code withThe distinct nonzero columns show that has no weight-one or weight-two word, while three dependent columns give a weight-three word. Hence its classical distance is three. Direct multiplication gives , proving . Every nonzero word of has weight four, so the logical X and Z distances are both three. Its six stabilizer checks are the X and Z strings given by the three rows of . A logical basis is the uniform superposition over and over , since . The resulting CSS code corrects every single-qubit error.
Past exam of the mathematics course of the University of Cambridge 2005 iii Paper 33 3 Solution Created 2026-10-03 Updated 2026-10-14
A binary block code of length is a nonempty subset . Its size is , the number of distinct codewords. The Hamming distance counts coordinates at which two words differ. The code's minimum Hamming distance is when there are at least two words. No pairwise minimum exists for a singleton code; it can be assigned as a convention when needed.
A binary linear code is a vector subspace of . If its dimension is , a generator matrix has a basis of as its rows, givingTo match the coordinate-row convention, take a parity-check matrix of size , with independent columns, and defineThe transpose is the usual parity-check matrix with one column per coordinate. By rank-nullity theorem, the displayed kernel has dimension . The two constructions agree when : the generator's row space lies in the parity-check kernel and has the same dimension, hence equals it. Conversely, for a given , choose the columns of as a basis of its dual code ; orthogonality and the dimension formula give exactly as the kernel.
For a nonzero linear code, is a nonzero codeword whenever are distinct codewords, and . Conversely compare any nonzero codeword with zero. Thus the minimum Hamming distance of a linear code is the least nonzero Hamming weight.
Write for the row associated with coordinate . A nonzero binary vector is a codeword exactly whenIts nonzero coordinate positions therefore index a linearly dependent set of rows. Conversely, a dependence among a set of rows has coefficients in , not all zero; putting these coefficients in the corresponding coordinates gives a nonzero codeword of weight no greater than the number of rows in that set. Taking minima in both directions proves the parity-check dependencies determine minimum distance criterion:Rows here are indexed by positions: equal row vectors at different positions are two distinct members of the indexed family. In the usual matrix convention, the same result refers to columns of . For the zero code, neither a nonzero codeword nor a dependent coordinate set exists, so both minima can consistently be interpreted as .
For the Hamming code, let , set , and let the rows of be all nonzero vectors of , each once. These rows include the standard basis, so has rank and the code has dimension and size . There is no dependence involving one row, because no row is zero, or two rows, because no rows are equal. For , any two distinct nonzero vectors have a distinct nonzero sum , which is another row. These three rows sum to zero. Thus for .
The perfectness of a Hamming code also has a direct decoding proof. Given any received word , its syndrome is . A zero syndrome means . Otherwise it equals exactly one row . The vector then has syndrome zero and is the unique codeword obtainable by changing one coordinate. There is no other codeword at distance at most one: its necessary correction would have to have the same syndrome, and among zero and all single-coordinate errors the syndromes are precisely the distinct vectors of . Therefore the radius-one Hamming balls about codewords partition .
Equivalently, each ball contains words; disjointness and show that none are uncovered. Hence every nondegenerate binary Hamming code is a perfect single-error-correcting code. For , the construction is the singleton code , whose one radius-one ball is also the whole ambient space. This deals with the degenerate boundary without falsely claiming its minimum distance is three.
Past exam of the mathematics course of the University of Cambridge 2005 iii Paper 33 4 b Solution Created 2026-10-03 Updated 2026-10-14
Use the homogeneous weight enumerator conventionThus records ones, records zeros, and the ordinary weight enumerator is . For a binary linear code of dimension and its dual code , the MacWilliams identity isor, equivalently, . The second form applies the first to the dual and uses .
One can verify the variable order directly from the character identity . If is not orthogonal to , translation by a codeword having odd inner product pairs positive and negative terms, giving zero; otherwise all terms are one. After multiplying by and summing over , coordinate contributes when , and when . Their product is exactly the stated substitution.
For a Hamming code with , its dual is the binary simplex code, generated by the rows of the usual parity-check matrix . There are dual words. A nonzero message produces the evaluations as runs over all nonzero vectors of . Exactly of them are one: the nonzero linear functional takes each value equally often on the whole vector space, and removing zero removes a zero value only. This proves the constant weight of a binary simplex code.
Put , so . The dual enumerator is therefore . Applying the MacWilliams identity gives the Hamming code weight enumeratorIn one variable this isFor example, gives ; gives . For , the expression is , agreeing with the singleton code. Setting in the homogeneous formula gives , the correct number of codewords.
Past exam of the mathematics course of the University of Cambridge 2005 iii Paper 37 5 b Solution Created 2026-10-03 Updated 2026-10-14
Let , and write for any odd-weight word . The parity functional on the four-dimensional binary linear code is nonzero, so its kernel has dimension three and its other fibre is the coset . For example belongs to the standard length-seven Hamming code and has odd Hamming weight. Denote the two logical basis states by and , corresponding to these two cosets. The eight computational orthonormal basis vectors in each sum are distinct, so both logical states have norm one; their disjoint supports make them orthogonal.
For a binary vector , define the product of Pauli Z gateswhere the dot product is computed modulo two. The key diagonal overlap, with and , isIf , every summand is one. If , choose with . Translation permutes and negates every summand. The sum must then be zero. ThusOff-diagonal logical overlaps vanish for every :because a diagonal Pauli operator cannot move a computational basis word from one coset to the disjoint other coset.
The possible errors are and for . Set . Each phase flip is its own adjoint and inverse, soIf , the vector is nonzero and has Hamming weight one or two. By the given dual code identity and the minimum Hamming distance three of the Hamming code, it cannot belong to . Hence all its diagonal logical overlaps vanish. If , the product is the identity and its logical overlaps are . Combining both cases givesThis proves the Knill--Laflamme condition with an identity error-overlap matrix, not merely a possibly degenerate scalar matrix. In particular the eight two-dimensional error subspaces are mutually orthogonal. This is precisely nondegenerate phase-flip correction in the Steane code.
To exhibit recovery rather than only the criterion, let be the orthogonal projector onto the code and . The projective measurement consisting of these eight mutually orthogonal projectors, completed by , determines which error occurred. For an arbitrary encoded pure state affected by , outcome occurs with certainty and leaves unchanged. Applying again recovers . The outcome gives the error syndrome and does not reveal or , so recovery preserves logical quantum superpositions.
An equivalent explicit error syndrome uses three commuting X-type stabilizer generators. Choose a parity-check matrix for with the seven different nonzero binary columns:Its rows span . For a row , the operator permutes each of and , and therefore has eigenvalue on both logical states. A phase flip at position changes its eigenvalue to , since . Measuring the three commuting stabilizer generators gives the th column of as a binary syndrome; no error gives the zero column. All eight outcomes are different, and applying the identified restores the code state. Measuring these stabilizer generators never distinguishes the two logical states.
Finally, if a noise Kraus operator is a coherent linear combination , the same syndrome measurement separates its mutually orthogonal components . Conditional recovery returns in every nonzero branch. Linearity then also corrects any quantum channel whose Kraus operators lie in this span. The argument therefore corrects arbitrary unknown single-site phase flips nondegenerately, including coherent phase-error amplitudes, rather than only a known error on a basis codeword.
Past exam of the mathematics course of the University of Cambridge 2005 iii Paper 87 1 Solution Created 2026-10-03 Updated 2026-10-14
Work over the finite field , and write for row of the PDF's matrix. The first row has Hamming weight eleven; all other rows have Hamming weight seven. To check their intersections economically, index the last eleven columns modulo eleven. The last eleven rows, after deleting the first column, are the successive cyclic shifts of the set . Direct calculation givesThe intersection sizes for equal those for . Thus two different rows among meet in four positions, including their shared first coordinate, whereas meets each of these rows in six positions. All these intersection sizes are even numbers, while each row weight is an odd number. Consequently . The first row and column agree, and the entry of the last eleven-by-eleven block depends only on the sum of its row and column indices modulo eleven, because successive rows are left shifts. Thus is a symmetric matrix, so .
The generator matrix has rank twelve, andHence its linear code lies in its dual code . Both have dimension twelve, so : it is a self-dual code. Moreover , and is an invertible matrix, so this is another generator matrix for the same code. In the column parity-check matrix convention of the question,The matrix has rank twelve, so its nullspace condition characterizes exactly.
To prove the minimum Hamming distance, first observe that the rows of have Hamming weights twelve and eight. For binary vectors,Every partial sum of generator rows is orthogonal to every further generator row, by . Its intersection with that row therefore contains an even number of positions. Induction using this identity proves that every codeword has weight divisible by four: is a doubly even code.
The systematic-matrix proof of extended Golay distance now excludes weight four. Write a codeword as and put . If its total weight were four, . For , the right half is a row of and has weight seven or eleven. For , the right half is the sum of two distinct rows; the intersection counts above give weight or . For , the right half would be a unit vector, but then would be a row of , of weight seven or eleven. For , the right half would vanish, contradicting invertibility of . Thus no nonzero word has weight four. Every nonzero weight is consequently at least eight, and any generator row other than the first attains eight. Since the minimum Hamming distance of a linear code is its least nonzero weight,
Define the length- binary Golay code as the punctured code obtained by deleting the first coordinate of this extended binary Golay code. This puncturing is injective on , because a nonzero word in its kernel would have weight one. Thus , and deleting one coordinate gives . The sum of the first two generator rows has weight eight and first coordinate one, so its puncture has weight seven. Therefore . In fact any coordinate can be punctured: every left coordinate except the first occurs in a weight-eight generator row, the first occurs in the sum just used, and every right coordinate occurs in at least one of the weight-eight generator rows.
The radius-three Hamming balls around the words of are disjoint, since two centers in intersecting balls would have Hamming distance at most six. Each ball containswords. Their combined size is , the size of the entire binary Hamming space. Hence
For decoding in , write the received word as , where is the unknown error in its two halves. Its syndrome isLet denote the length-twelve unit vector. For bounded-distance decoding, the three-error syndrome decoding of extended Golay code is the following finite search, returning the first successful candidate error:
Every returned candidate has total Hamming weight at most three and the required syndrome. Conversely, an error of total weight at most three has a half of weight zero or one. The tests exhaust respectively , , , and , so they find every such error. Two distinct successful candidates would differ by a nonzero codeword of weight at most six, contradicting . Thus the result is unique, and the decoded word is . The condition still allows the first test when the weight is exactly three; for larger syndrome weight begin with the second test. A large syndrome weight alone does not imply more than three errors.
The decoder corrects every error of weight at most three; failure means that the received word is outside all radius-three decoding balls. Unlike its puncture, is not a perfect code: its radius-three balls cover only words. Without the three-error assumption, a successful test identifies a nearby codeword but need not identify the transmitted word.
For an arbitrary received word, a complete minimum-distance decoding fallback is to enumerate and minimize . Every error with the observed syndrome has exactly the form , so a minimizer gives a nearest codeword . Report all minimizers if there is a tie. This also decodes outside the guaranteed radius in the nearest-word sense, while making no unsupported claim that the transmitted word is determined. Thus a syndrome of weight at least three alone is insufficient for guaranteed recovery; either the three-error hypothesis or a choice among nearest words is needed.
Past exam of the mathematics course of the University of Cambridge 2005 iii Paper 87 2 Solution Created 2026-10-03 Updated 2026-10-14
Represent a word in the Hamming space by the polynomial . A cyclic code is a linear code invariant under the cyclic coordinate shift . Under this identification the shift is multiplication by modulo . A shift-invariant vector subspace is closed under multiplication by every polynomial, since such multiplication is a linear combination of shifts. It is therefore an ideal ofConversely every ideal of is a vector subspace closed under multiplication by , hence a cyclic code. Invariance means equality under the shift, since applying it times is the identity.
Let be the inverse image of the code ideal under the quotient map . It contains and is nonzero. Choose a nonzero element of of smallest degree and scale it to a monic polynomial . For any , polynomial division gives with . Since , minimality forces . Thus and in particularThis is the required generator polynomial of a cyclic code; the divisibility direction in the printed formula is reversed. The quotient-ring modulus is , with denoting the multiplicative identity of the finite field. If , every codeword has a unique representative with . Indeed reduction of modulo gives this form, and two such products cannot differ by a nonzero multiple of because their difference has degree less than . ThereforeFor the zero code the convention is and this basis is empty; for the full word space .
The zeros of a cyclic code are the polynomial roots of in a splitting field of . Suppose first that the characteristic of does not divide . The formal derivative of is , which has no common root with ; all roots of are therefore simple. If they are , then is equivalent to for all . A root-evaluation parity-check matrix of a cyclic code, written with checks as rows, is consequentlyIts entries may lie in , rather than in the original finite field. To obtain a parity-check matrix over , choose a basis of over and replace each equation by the equations for all of its field coordinates. The resulting matrix has the same kernel , hence rank ; retain any independent rows. More economically, choose one root from each Frobenius conjugate orbit. For , , so checking one representative checks its whole orbit. Expanding that representative's equation in a basis of gives precisely the number of checks equal to its orbit length.
No coprimality hypothesis is stated in the question, so the repeated-root cyclic code case must also be distinguished. Distinct roots alone cannot determine these codes: in , the generators and have the same zero, but generate codes of dimensions one and zero. In general write in . The correct checks areusing Hasse derivatives. Indeed , so vanishing of the first coefficients is equivalent to divisibility by . A repeated-root parity-check matrix over thus has rows indexed by and entriesAs before, expand to equations over and retain independent rows. The ordinary root-evaluation matrix is exactly the special case .
For the binary Hamming code, let , , and let generate the multiplicative group of a finite field . This is possible because that group is a cyclic group. Choose a basis of over . The coordinate columns of then run through every nonzero vector of exactly once. They are a parity-check matrix for a Hamming code, possibly after permuting the columns of a given Hamming matrix. Thusis equivalent to the Hamming code. Multiplication by modulo multiplies its evaluation at by , so is a cyclic code.
The parity-check matrix has rank because its columns contain a basis. It has no zero column or repeated column, so no nonzero word of weight one or two is in its kernel. Two distinct nonzero columns have a nonzero sum, which is a third distinct column; these three columns give a word of weight three. Hence has parameters .
A polynomial over vanishes at exactly when it is divisible by its minimal polynomial of an algebraic element . The finite-field Frobenius automorphism gives all conjugates of as . Their orbit length is : if with , then the order of would divide , which is a smaller positive integer. Therefore the Hamming code as a cyclic code hasThe last exponent here is . The printed exponent would give , which is not a root of the degree- irreducible minimal polynomial of an algebraic element for .
Past exam of the mathematics course of the University of Cambridge 2006 ii Paper 2 12G Solution Created 2026-09-24 Updated 2026-10-14
A cyclic binary code is a linear subspace of invariant under cyclic shifts. Identify a word with its coefficient polynomial in . Multiplication by is the shift, so the code is precisely an ideal of that quotient ring. Its inverse image in the polynomial ring is a principal ideal containing ; its unique monic generator divides . Conversely each monic divisor generates such an ideal. Thus the bijection is with monic divisors; gives the full code and the zero code.
For odd , some has , so the cyclic multiplicative group of contains a primitive th root . If a nonzero word with the specified roots had weight , write its nonzero positions as . The root equations giveTheir matrix has determinant , by the Vandermonde formula and distinctness of the positions. Thus all coefficients would vanish, a contradiction. Hence minimum distance is at least .
For , choose with minimal polynomial . The roots force also the conjugate , giving this cubic as generator. Its degree gives dimension four and its weight gives distance exactly three. Expressing in a basis of gives a parity-check matrix with the seven distinct nonzero vectors of as columns. This is the binary Hamming code. Its sixteen disjoint radius-one balls have words, so one-error correction is perfect. The other primitive cubic produces an equivalent coordinate-permuted code.
Past exam of the mathematics course of the University of Cambridge 2007 iii Paper 31 3 Solution Created 2026-10-03 Updated 2026-10-14
We give the bounds for an alphabet of size , including the binary case . Let be a length- code with codewords and minimum Hamming distance at least , where . Write for the maximum code size at a given distance andfor the number of words in a Hamming ball of radius . The th term chooses the changed coordinates and the alternative symbols in each.
For the Hamming bound, put . Balls of radius around distinct codewords are disjoint: a common point would, by the triangle inequality, make their distance at most . Counting those balls inside the ambient words provesNo linearity is needed. For a linear code of dimension over , replace by .
For the Gilbert–Varshamov bound, construct a code greedily, adding any word at distance at least from all previously selected words, until none remains. The process terminates because the space is finite. Its maximality implies that the radius- balls around its codewords cover the whole space: an uncovered word could have been added. These balls may overlap, but the size of their union is at most the sum of their sizes. Hence the constructed code has , proving the existence boundOne may take the ceiling on the right because code size is integral.
For completeness, the sharper linear version is the Varshamov bound for linear codes. When is a prime power and , an linear code exists providedSet and choose columns of an parity-check matrix in order. When choosing column , exclude all combinations of at most earlier columns, including the zero combination. There are at most forbidden vectors, smaller than by the assumed inequality. A column can therefore be chosen. Inductively every set of at most chosen columns is independent: a relation involving the newest one would express it as a combination of at most earlier columns. The kernel has dimension at least and minimum Hamming distance at least , since a low-weight kernel vector would be such a column relation. If its dimension is larger than , take a -dimensional subspace. This proves the stated linear existence claim; it does not assume the greedy nonlinear code was linear.
To derive the asymptotic bounds, define the q-ary entropywith the continuous endpoint conventions. Its derivative is , so it is increasing on and has maximum one at . Stirling's formula gives, uniformly for integer ,The sum defining is between its largest summand and times that summand. For radius fractions tending to , monotonicity of makes the largest exponent tend to . Consequently the Hamming ball volume exponent isFor , the exponent is one: use a radius fraction just below for a lower bound and for an upper bound.
Set and define the asymptotic rate-distance function byThe code rate is and the relative minimum distance is . A limsup suffices; no unproved existence of a limit for optimal code sizes is required. The packing radii have fraction tending to , so the finite Hamming bound and the volume exponent give the asymptotic Hamming boundThe covering radii have fraction tending to , giving the asymptotic Gilbert–Varshamov boundFor larger , this covering argument gives only the trivial lower bound zero, not the expression obtained by extending the decreasing information entropy function beyond its maximum.
The asymptotic lower bound is also achievable by linear codes over a finite field. For and sufficiently large , take redundancy , so . The linear existence condition produces dimension at least ; its rate has liminf at least . At , use the whole space, of rate one. In particular, for binary codes the bounds reduce towhere is the binary entropy function.
Past exam of the mathematics course of the University of Cambridge 2007 iii Paper 31 4 Solution Created 2026-10-03 Updated 2026-10-14
Use binary codes, so the polynomial modulus is in . A cyclic code is a linear subspace of invariant under the cyclic shift . Identify a word with . Addition is coefficientwise, and multiplication is polynomial multiplication reduced modulo . In the quotient ringmultiplication by is exactly that cyclic shift. Closure under this map and linear combinations gives closure under multiplication by every polynomial, so a cyclic code is an ideal of . Conversely, an ideal is a linear subspace closed under multiplication by , proving the correspondence.
Take the inverse image of in . This is an ideal containing . The polynomial division algorithm shows directly that it has a unique monic generator : choose a nonzero polynomial of least polynomial degree and divide any other member by it; the remainder is in the ideal and has smaller polynomial degree, so must vanish. If two monic generators existed, mutual divisibility would make them equal. Because belongs to the ideal, . Conversely every monic divisor of defines an ideal of . Thus the generator polynomial of a cyclic code satisfiesFor a nonzero code, is its nonzero polynomial representative of least polynomial degree. For the zero code, use , whose residue in is zero; this standard convention covers that endpoint despite its having no nonzero codeword.
Let and , and put . Every codeword has a unique representation with : dividing an arbitrary multiplier by does not change its product with modulo . The words have distinct leading degrees below and are independent. ConsequentlyThe statement remains valid for the zero code, with an empty basis, and the full code, with .
For length 16, characteristic two gives . Its only monic divisors are for . Hence all binary cyclic codes of length a power of two in this case areThere are exactly 17 codes, forming the chain . This is a repeated-root cyclic code situation, so it would be incorrect to count just square-free factors. Their canonical check polynomials of a cyclic code are . An explicit expansion of each generator is .
The canonical check polynomial of a cyclic code isIndeed means . Since , cancellation in the polynomial ring gives , exactly code membership. No coprimality of and is needed, including for length 16.
There is a normalization qualification in the printed definition. The kernel condition alone does not force the supplied polynomial to equal this canonical . If , write and with . Then holds exactly when , so its kernel is the ideal generated by . ThereforeEquivalently with . Requiring the monic divisor of selects the canonical check polynomial of a cyclic code. For example gives the same kernel as , since is a unit modulo , but is generally a different polynomial. Given any permitted , taking recovers the canonical .
To construct a parity-check matrix, write the canonical and its reciprocal polynomial . Take coefficient vectors, padded to length , ofas the rows of . Here because , so these rows have successive leading degrees and are independent. For a word , row has dot product , the coefficient of in the ordinary product . If , then with . This product has no terms in degrees , so . The kernel of has dimension , the same as , proving . This proves the reciprocal-polynomial parity-check matrix construction and identifies its rows as a basis for the dual of a cyclic code.
Alternatively, a supplied check polynomial of a cyclic code reduced modulo , , gives the polynomial multiplication parity-check matrixThis circulant matrix represents multiplication by modulo , so its kernel is and its matrix rank is . Selecting independent rows yields a rank- parity-check matrix even without initially normalizing the supplied polynomial.
The syndrome labels the coset . Indeed if and only if , equivalently . There are cosets, each with words, and the syndrome classification of code cosets gives a bijection between them and . If is a transmitted codeword plus an error, then : the syndrome determines the error coset. Choosing a minimum-weight coset leader and subtracting it performs minimum-distance decoding. The error itself need not be uniquely identified, but it is unique when its weight is at most , since the corresponding error-correction balls are disjoint.
For the repetition code, the nonzero codeword is the all-ones word, soTheir product is , and the generator polynomial degree gives dimension one. For the single parity-check code, membership is , equivalent to divisibility by . ThusIts dimension is ; it is the even-weight code.
Finally, factor the binary length-seven modulus:A standard cyclic realization of the Hamming code of length seven usesIts dimension is four. The reciprocal-check construction givesIts columns are exactly the seven distinct nonzero vectors of , so no word of weight one or two is in its kernel. The generator itself has weight three, so the minimum Hamming distance is exactly three; this is the Hamming code. Reversing the cyclic coordinate order gives the equally valid reciprocal choiceThe polynomial answer therefore depends on the cyclic coordinate convention, while the resulting codes are equivalent.
Past exam of the mathematics course of the University of Cambridge 2008 ii Paper 3 4G Solution Created 2026-09-24 Updated 2026-10-14
One choice of the Hamming code of length seven is the linear mapover . Its image is the kernel of the parity-check matrixIndeed , the encoder is injective because positions recover its inputs, and has rank three. Its columns are nonzero and pairwise distinct. Hence no nonzero codeword has Hamming weight one or two. The word has weight three, proving that the minimum Hamming distance is three.
If is received with one erroneous bit, its syndrome is column of . These seven columns are distinct, so the syndrome identifies the bit to flip. A zero syndrome indicates no error under the assumption of at most one error.
For the extended Hamming code, append . Every extended codeword has even weight. Since every original nonzero word has weight at least three, its extended weight is at least four; the weight-three example attains four. ThusThe minimum-distance error-detection and correction guarantee gives detection of up to three errors and correction of one error. Detection here means rejecting a word outside the code, rather than simultaneously identifying and correcting every detected pattern; the usual combined decoder corrects single errors and flags double errors.
Past exam of the mathematics course of the University of Cambridge 2009 ii Paper 3 4H Solution Created 2026-09-24 Updated 2026-10-14
Use the binary Hamming code , where the th column of the parity-check matrix is the four-digit binary expansion of , for . Thus the columns are precisely the nonzero vectors of . They include the four coordinate vectors, so and . Its code rate is therefore .
For a received word , compute its syndrome . If , report no error. Otherwise identify the unique column and flip bit . Indeed, if with , then , so this procedure recovers exactly. No column is zero and no two columns coincide; hence no nonzero codeword has Hamming weight one or two. Some three columns sum to zero, for example those indexed by , so the minimum distance is exactly three. Thus every single-bit error is corrected. The assertion requires at most one error; arbitrary multiple errors need not be detected by this procedure.