Suppose \(C\) is a linear code, and a code word \(w\) is sent, and \(r\) is received.
Theorem. A binary \((n,M,d)\) code with \(d \geq 2t+1\) satisfies \[ M \leq \frac{2^n}{\sum_{j=0}^t \binom{n}{j}}. \]
Definition. A binary code with \(d = 2t+1\) that achieves the above bound is called perfect.
That is, a perfect code is an \((n,M,d)\) code that corrects \(t\) errors such that \[M = \frac{2^n}{\sum_{j=0}^t \binom{n}{j}}.\]
Lemma. Let \(C\) be a systematic linear binary code, and let \(H\) be its parity check matrix.
Corollary: The minimum distance of a Hamming code is 3, and they’re perfect.
Corollary: The minimum distance of a Hamming code is 3, and they’re perfect.
Proof: Hamming codes are constructed by forming \(H\) first, where \(H\) has \(2^m-1\) different nonzero columns, so the minimum distance is greater than 2, by the Lemma. The code has length \(n = 2^m-1\), and \(M = 2^k\) code words, where \(k = 2^m-1-m\). Observe:
\[ \frac{2^n}{\binom{n}{0} + \binom{n}{1}} = \frac{2^n}{1+n} = \frac{2^{2^m-1}}{2^m} = 2^k = M \]
Therefore \(d > 3\) is impossible, because \(M\) would then exceed the Hamming bound. So \(d = 3\), and the code is perfect.
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] 1 1 0 1 1 0 0
[2,] 1 0 1 1 0 1 0
[3,] 0 1 1 1 0 0 1
Correct the error in \((1,0,1,0,1,1,1)\)
[,1] [,2] [,3]
[1,] 0 1 0
The error is in position 6: \(w = (1,0,1,0,1,0,1)\)
Definition. A code is cyclic if it is closed under cyclic shift: \[ (c_1, c_2, \ldots, c_{n-1}, c_n) \in C \Rightarrow (c_n, c_1, c_2, \ldots, c_{n-1}) \in C \]
Examples: 8th bit parity check, \(k\)-fold repetition code
Group Exercise: For each given code word, find the smallest cyclic linear code containing the code word.
\(\begin{bmatrix} 1 & 0 & 0 & 1 \end{bmatrix}\)
\(\begin{bmatrix} 1 & 1 & 0 & 0 & 1 & 0 & 1 \end{bmatrix}\)
Let’s start indexing at zero.
Definition. A cyclic linear code (i.e., a cyclic code) of length \(n\) is a subset of \(\mathbb{Z}_2[x]/(x^n+1)\) that is closed under addition and closed under multiplication by \(x\).
Fact: Every ideal \(C\) of \(\mathbb{Z}_2[x]/(x^n+1)\) has the form \[ C = \{p(x)g(x) \mid p(x) \in \mathbb{Z}_2[x]/(x^n+1) \} \] for some generating polynomial \(g(x)\) (which is the polynomial of least degree in \(C\)).
i1 : R = ZZ/2[x]
o1 = R
o1 : PolynomialRing
i2 : factor(x^7+1)
3 3 2
o2 = (x + 1)(x + x + 1)(x + x + 1)
o2 : Expression of class Product
Online version: https://www.unimelb-macaulay2.cloud.edu.au/
Let \(C = \langle g(x) \rangle\) be a cyclic code. If \(m(x)\) is a polynomial satisfying \(m(x)g(x) = x^n+1\), then \(m(x)\) is called a parity check polynomial.
Over \(\mathbb{Z}_2\), \(x^7+1 = (x+1)(x^3+x+1)(x^3+x^2+1)\).
\(g(x)\) | \([n,k]\) | Code |
---|---|---|
\(x+1\) | \([7,6]\) | parity check |
\(x^3 + x + 1\) or \(x^3 + x^2 + 1\) | \([7,4]\) | Hamming |
\((x+1)(x^3 + x + 1)\) or \((x+1)(x^3 + x^2 + 1)\) | \([7,3]\) | Hamming dual |
\((x^3 + x + 1)(x^3 + x^2 + 1) = x^6+x^5+x^4+x^3+x^2+x+1\) | \([7,1]\) | repetition |
\(\mbox{GF}(2^n)\) is a field containing \(\mathbb{Z}_2\) and an element \(\alpha\), such that \(p(\alpha) = 0\). We say that \(\mbox{GF}(2^n)\) is an extension field of \(\mathbb{Z}_2\).
Example: \(\mbox{GF(4)} = \mathbb{Z}_2[x]/(x^2+x+1)\)
Over \(\mathbb{Z}_2\), let \(\alpha\) be a root of \(x^3 + x + 1\). Compute all the powers of \(\alpha\), simplifying when possible. How many are there?
Over \(\mathbb{Z}_2\), let \(\alpha\) be a root of \(x^3 + x^2 + x + 1\). Compute all the powers of \(\alpha\), simplifying when possible. How many are there?
Facts: \(\mbox{GF}(2^n)\) contains an element \(\alpha\) such that:
Examples: \(\mbox{GF(4)}\), \(\mbox{GF(8)}\)
i1 : R = ZZ/2[x]
o1 = R
o1 : PolynomialRing
i2 : factor(x^7+1)
3 3 2
o2 = (x + 1)(x + x + 1)(x + x + 1)
o2 : Expression of class Product
i1 : R = GF(8)[x]
o1 = R
o1 : PolynomialRing
i2 : factor(x^7+1)
2 2 2 2
o2 = (x + 1)(x + a)(x + a )(x + a + 1)(x + a + a)(x + a + a + 1)(x + a + 1)
o2 : Expression of class Product
i1 : F = GF(8)
o1 = F
o1 : GaloisField
i2 : ambient F
ZZ
--[a]
2
o2 = ----------
3
a + a + 1
o2 : QuotientRing
i3 : apply(1..7, i -> a^i)
2 2 2 2
o3 = (a, a , a + 1, a + a, a + a + 1, a + 1, 1)
o3 : Sequence
Fact: Let \(\alpha\) be a primitive \(n\)th root of unity in some extension field of \(\mathbb{Z}_2\). Then
\[x^n + 1 = (x+1)(x+\alpha)(x+\alpha^2)\cdots(x+\alpha^{n-1})\]
So a divisor \(g(x)\) of \(x^n+1\) (and therefore a cyclic code \(\langle g(x) \rangle\)) determines a set of powers of \(\alpha\) that are zeroes of \(g(x)\).
Let \(C=\langle g(x)\rangle\) be a cyclic code in \(\mathbb{Z}_2[x]/(x^{13}+1)\), and let \(\alpha\) be a primitive \(13\)th root of unity. Suppose that \(g(\alpha^4) = g(\alpha^5) = 0\).
Let \(p(x)\) be the parity check polynomial such that \(g(x)p(x) = x^{13} + 1\). Use the fact that \(x^{13}+1\) splits over \(\mathbb{Z}_2(\alpha)\) to explain why \(p(\alpha^4) \neq 0 \neq p(\alpha^5)\).
Suppose that, for some \(k\), the polynomial \(m(x) = x^k\) is a code word of weight 1. Show that this leads to a contradiction.
Suppose that, for some \(j,k\), the polynomial \(m(x) = x^j+ x^k\) is a code word of weight 2. Show that this leads to a contradiction.
Explain why the minimum distance of \(C\) is at least 3.