Coding Theory Massoud Malek Algebra Congruence Relation The definition of a congruence depends on the type of algebraic structure under consideration Particular definitions of congruence can be made for groups, rings, vector spaces, modules, semigroups, lattices, and so forth The common theme is that a congruence is an equivalence relation on an algebraic object that is compatible with the algebraic structure Every congruence relation has a corresponding quotient structure, whose elements are the equivalence classes (or congruence classes) for the relation Examples Integers For a given positive integer n, two integers a and b are called congruent modulo n, written a b (mod n), if a b is divisible by n (or equivalently if a and b have the same remainder when divided by n) For example, 13 43 (mod 10), since 13 43 = 30 is a multiple of 10 Group In an group G, and is a binary relation on G, then is a congruence whenever: (i) For any a G, then a a G (reflexivity) (ii) For any a, b G, if a b G then b a G (symmetry) (iii) For any a, b, c G, if a b G and b c G, then a c G (transitivity) Homomrphism If : A B is a homomorphism between two algebraic structures (such as homomorphism of groups, or a linear map between vector spaces), then the relation defined by a 1 a 2 if and only if (a 1 ) = (a 2 ) is a congruence relation Modular Arithmetic In mathematics, modular arithmetic is a system of arithmetic for integers, where numbers wrap around upon reaching a certain valuethe modulus The foundations of modular arithmetic were introduced in the third century BCE, by Euclid, in the 7th book of his Elements The modern approach to modular arithmetic was developed by Carl Friedrich Gauss in his book Disquisitiones Arithmeticae, published in 1801 Modular arithmetic can be handled mathematically by introducing a congruence relation on the integers described in the above example Permutation Matrices An n n permutation matrix P is a matrix obtained from the n n identity matrix I n by a permutation of rows Every row and column of a permutation matrix
Massoud Malek Algebra Page 2 contains precisely a single one with zeros everywhere else For example, the matrix 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 P = 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 is obtained by exchanging the columns 2 and 3, and 4 and 5, of I 6 A permutation matrix P is nonsingular, and the determinant is always ±1 In addition, permutation matrices are orthogonal matrices (ie, P P t = I n ); Thus P 1 = P t Since we are using row operations on the identity matrix, we conclude that any permeation matrix is row equivalent to an identity matrix of the same size A cyclic permutation matrix is a specific permutation matrix given by 0 0 0 1 1 0 0 0 P = 0 0 0 0 0 1 0 Circulant Matrices In linear algebra, a circulant matrix is a matrix where, each row vector is rotated one element to the right (or left) relative to the preceding row vector An n n circulant matrix C takes the form c 0 c n 1 c 2 c 1 c 1 c 0 c n 1 c 2 C n = c 1 c 0 c n 2 c n 1 c n 1 c n 2 c 1 c 0 A circulant matrix is fully specified by the vector c, which appears as the first column of the matrix C n We have C n = c 0 I + c 1 P + c 2 P 2 + + c n 1 P n 1, where P is the n n cyclic permutation matrix The set of n n circulant matrices forms an n-dimensional vector space Circulant matrices form a commutative ring, since for any two given circulant matrices A and B, the sum A + B is circulant, the product A B is circulant, and A B = B A
Massoud Malek Algebra Page 3 A special type of circulant matrix is defined as ( 1 n ) ( n ( 1 2) n ) ( n 1 n ) ( n 1 1 n ( n ) 1) n 2 ( n ) n 1 1 ( n C n = 2), ( n ) ( n ( 2 1) n ) ( n ) ( n 1 2 3) 1 where ( n 1) is a binomial coefficient Companion Matrix The companion matrix of a monic polynomial (the leading coefficient equals one) p(x) = a 0 + a 1 x + + a n 1 x n 1 + x n, denoted by C p is an n n matrix defined as follows: 0 1 0 0 0 0 a 0 0 0 1 0 0 1 0 0 a 1 C p = with C t p = 0 0 0 1 0 0 0 an 2 a 0 a 1 a n 2 a n 1 0 0 1 a n 1 It can be shown that p(x) is the characteristic polynomial of both C p and Cp; t that is det(xi n + C p ) = det(xi n + C t p) = p(x) We shall see that the companion matrix of a polynomial will be the shift matrix of the circuit for dividing polynomials while the transpose of a companion matrix will be the shift matrix of a circuit that encodes a cyclic code Finite Field Z n To make error correcting codes easier to use and analyze, it is necessary to impose some algebraic structure on them It is especially useful to have an alphabet in which it is possible to add, subtract, multiply and divide without restriction In other words we wish to construct a finite field Evarist Galois (1811-32), a French mathematician who died in a duel at the age of 20 introduced finite fields and proved that there exists a field of order q if and only if q is a prime power (ie q = p r, where p is prime and r is a positive integer) Furthermore, there is, up to relabeling, only one field of that order Finite fields of order q are also known as Galois field of order q and are denoted by GF (q) Let us now try to give Z m = {0, 1, 2,, m 1} the structure of a field We define addition and multiplication in Z m by a + b c (mod m) and ab d (mod m) For example in Z 12 we have 8+4 0 (mod 12), 5+7 11 (mod 12), 8+9 5 (mod 12), 4 5 8 (mod 12), 3 4 0 (mod 12) Note that 3 4 0 (mod 12), thus Z 12 is not a field The following theorem characterizes Z m
Massoud Malek Algebra Page 4 Theorem 1 Z m is a field if and only if m is a prime number Proof Suppose m is not prime, then m = ab for some integers a and b, both less than m Thus a b 0 (mod m), with a 0 and b 0 So, m must be prime Now suppose that m is prime To prove that Z m is a field we only need to show that every nonzero member of Z m has a multiplicative inverse Let a Z m with a 0, then {1a, 2a,, (m 1)a} must be distinct in Z m If not then for some i, j Z m with i > j and i a = j a (i j) a 0 (mod m) m divides a or (i j) This is a contradiction with the fact that m is greater than both a and i j Thus Z m is a field According to this theorem Z 10 is not a field but Z 11 is a field Although Z 10 is not a field but some of its members have an inverse, for example the inverse of 3 in Z 10 is 7 The Extended Euclidean Algorithm This algorithm finds the inverse of a number x in Z m It also shows if x has no inverse in Z m First we set x 0 = x and x 1 = m The quotient obtained at step k will be denoted by q k As we carry out each step of the Euclidean Algorithm, we will also calculate an auxiliary number, p k For the first two steps, the value of this number is given: p 0 = 0 and p 1 = 1 For the remainder of the steps, we recursively calculate p k p k 2 p k 1 q k 2 (mod n) Continue this calculation for one step beyond the last step of the Euclidean algorithm The algorithm starts by dividing n by x Case 1 The last non-zero remainder occurs at step k, then if this remainder is 1, x has an inverse and it is p k+2 Case 2 The last non-zero remainder is not 1, then x does not have an inverse Example Find the inverse of 15 (mod 26) First we set x 0 = 15 and x 1 = 26 Steps x k+1 = q k (x k ) + r k p k p k 2 p k 1 q k 2 (mod 26) Step 0 26 = 1 15 + 11 p 0 = 0 Step 1 15 = 1 11 + 4 p 1 = 1 Step 2 11 = 2 4 + 3 p 2 0 1 1 (mod 26) = 25 Step 3 4 = 1 3 + 1 p 3 1 25 1 (mod 26) 24 (mod 26) = 2 Step 4 3 = 3 1 + 0 p 4 25 2 2 (mod 26) = 21 Step 5 The inverse is found p 5 2 21 1 (mod 26) 19 (mod 26) = 7
Massoud Malek Algebra Page 5 r 3 = 1, so the inverse of 15 modulo 26 exists Thus 15 1 = p 5 = 7 Exercises Find the inverse (if there exist) of 21 and 26 mod 34 Chinese Remainder Theorem Suppose m 1, m 2,, m r are pairwise relatively prime and let M = m 1 m 2 m r Define M 1 = M/m 1, M 2 = M/m 2,, M r = M/m r For integers a 1, a 2,, a r, the system of congruences, x a k (mod m k ), for k = 1, 2,, r has a unique solution modulo M, given by: x a 1 M 1 b 1 + a 2 M 2 b 2 + + a r M r b r (mod M), where M k = M / m k and b k M 1 k (mod m k ) for k = 1, 2,, r Proof Notice that gcd (M k, m k ) = 1 for k = 1, 2,, r Thus, every b k exists and can be determined easily from the extended Euclidean Algorithm From M k M 1 k = M k b k 1 mod (m k ), we obtain a k M k b k a k (mod m k ) for all k = 1, 2,, r On the other hand, a k M k b k 0 for all k = 1, 2,, r, we have x a k (mod m j ) if j is not k (since m j divides M k in this case) Thus, (mod m k ) for k = 1, 2,, r If there were two solutions, say x 0 and x 1 then we would have x 0 x 1 0 mod (m k ) for k = 1, 2,, r, so x 0 x 1 0 mod (M), ie, they are the same modulo M Example Find the smallest multiple of 10 which has remainder 2 when divided by 3 and remainder 3 when divided by 7 We are looking for a number which satisfies the congruences, x 2 (mod 3), x 3 (mod 7), x 0 (mod 2), and x 0 (mod 5) Since 2, 3, 5, and 7 are all relatively prime in pairs, then according to the Chinese Remainder Theorem, there is a unique solution modulo We calculate the M k s and b k s as follows: M = 2 3 5 7 = 210 We have: M1 = 210/2 = 105; b 1 105 1 (mod 2) = 1 M2 = 210/3 = 70; b 2 70 1 (mod 3) = 1 M3 = 210/5 = 42; b 3 42 1 (mod 5) = 3 M4 = 210/7 = 30; b4 30 1 (mod 7) = 4
Massoud Malek Algebra Page 6 Thus x 0 M 1 b 1 + 2 M 2 b 2 + 0 M 3 b 3 + 3 M 4 b 4 = 0 + 2 70 1 + 0 + 3 30 4 = 0 + 140 + 0 + 360 = 500 (mod 210) 80 Note The Chinese mathematician Sun Tsu was aware of this result in the first century AD