Chapter 11 Algebraic Coding Theory Single Error Detection M = (1, 1, …, 1) is the m + 1 parity check matrix for single error detection. If c = (0, 1, 0, …, 1) is an n-bit codeword, then McT = 0 (use XOR for addition). If c′ = c + e contains an error, then the syndrome is: Mc′T = M(c + e)T = McT + MeT = MeT = 1 This detects errors: 0 for none, 1 for an error. Single Error Correction / Double Error Detection M′ = 11111111 00001111 00110011 01010101 for double-error detection (optional) the 3 x 7 parity check matrix for a single-error correcting Hamming code If c is a 7 bit code word, then McT = (0 0 0)T and Mc′T = MeT = the syndrome for the error (e.g. try 0110011 → 0100011 on page 41). In general, we can choose any parity check matrix for M, provided the rows are linearly independent (otherwise the checks themselves are redundant), and McT = 0. But, to correct a double-error, we must have the property that the syndrome M(e1 + e2)T = Me1T + Me2T is unique for every pair of columns (assuming e1 and e2 are single-error vectors). 11.2 Polynomials degree coefficients leading 2[x] = {bnxn + … + b0 : n ≥ 0; bi = 0, 1; bn = 1} unless n = 0 Associate with each n-bit vector the corresponding polynomial, like a generating function. Arithmetic operations (+, ×) apply to 2[x], provided we do arithmetic on the coefficients in 2 (mod 2). A polynomial P(x) is prime (or irreducible) if it cannot be factored (over 2[x]) into lower-order polynomials. For example, all are prime: x x + 1, x2 + x + 1, x3 + x + 1, x3 + x2 + 1 all composite: x2, x2 + 1, x2 + x, x3, x3 + 1, x3 + x2 + x + 1 Primitive roots are those that generate all non-zero elements. 11.5, 11.6, 11.7 Polynomial arithmetic Consider arithmetic in 2[x]/p(x) modulo an irreducible polynomial p(x) of degree n. Since xn ≡ p(x) − xn mod p(x) there are no polynomials of degree ≥ n. In fact, 2[x]/p(x) has 2n elements: bn−1xn−1 + … + b0, which form a field, and hence there exists a polynomial g(x) whose powers generate all the non-zero elements. E.g. The powers of g(x) = x mod p(x) = x3 + x + 1 are: 1, x, x2, x + 1, x2 + x, x2 + x + 1, x2 + 1. Writing these as column vectors of a matrix gives a rearranged Hamming code: n=3 1 1 1 0 1 0 0 x2 2n = 8 = |2[x]/p(x)| M= 0 1 1 1 0 1 0 x1 7 = 8 − 1 (# non-zero) 1 1 0 1 0 0 1 x0 x6 x5 x4 x3 x2 x1 x0 11.8 Polynomial Coding Recall: Sent messages c should have McT = 0. Fact: If c is a valid codeword, then c(x) ≡ 0 mod p(x). Reason: McT = c(x) by definition of matrix multiplication. And since the powers of x that make up the columns of M are modulo p(x), McT = 0 c(x) ≡ 0 mod p(x). The syndrome of a received codeword c′ is Mc'T = MeT, and similarly, the corresponding polynomial s(x) has c'(x) − s(x) ≡ 0 mod p(x) c'(x) ≡ s(x). If the ith column matches, i.e. xi ≡ s(x), then that is the error location, assuming e contains only one error. Encode: Place message in columns 6, 5, 4, 3, and compute b6x6 + b5x5 + b4x4 + b3x3 modulo p(x). Put remainder, r(x) = b2x2 + b1x + b0, in the last columns. message checks b6 b5 b4 b3 b2 b1 b0 Decode: Divide received polynomial by p(x), and use the remainder r(x) ≡ gi(x) to calculate syndrome i. No error i doesn’t exist, i.e. r(x) ≡ 0 mod p(x). Example: 1001 1001110 x6 + x3 + ? /\ /\ x2 + 1 + x + 1 = x2 + x 11.8 Calculating the syndrome McT = (x6x5 … x0)(c6c5 … c0)T = c6x6 + c5x5 +…+ c0x0 Example: If M is the Hamming matrix from before (powers of x mod x3 + x + 1), and c = 0110110, then McT = x2 + x = s(x). Strategy: divide s(x) by x repeatedly until we reach the identity, x7 (Fermat’s little theorem). Is there a less symbolically laborious way? Shift registers x3 x2 x1 x2 x0 =x+ left shift = × x 1 Right shift = ÷ x Decoding Encoding (MSB first) first) 0 0 0 1 0 1 0 1 1 0 0 0 1 0 0 1 0 1 0 0 1 0 1 0 1 1 0 1 0 0 0 0 1 0 ← ← ← ← x0 → ← x3 x1 1 0 0 1 0 0 1 0 1 1 Add result to message: 1001110 Introduce an error: 1000110 = x3 = x + 1 Find syndrome by clocking and counting until reaching 1. → → → → x2 + 1 = (LSB x-1 1 0 1 0 1 1 1 0 1 1 0 1 0 1 1 1 0 1 0 0 1 1 0 1 x-1 Double error-correcting Code Illustration: 15-bit Hamming code with 4 parity checks. Verify that x4 + x + 1 is prime, and that x is primitive. The resulting parity check matrix M1 is single errorcorrecting, but x + x2 = x12 + x14 so double errorcorrection is impossible. Idea: pick another primitive generator x3 with matrix M2. Let s1 = xi + xj = M1c′T be the first syndrome and s2 = (x3)i + (x3)j = M2c′T be the second syndrome. Then s2 = (xi)3 + (xj)3 = (xi + xj)((xi)2 + (xi)(xj) + (xj)2) = s1[xixj + s12] So that xi + xj = s1 and xixj = s12 + s2/s1 11.11