Foundations of Cryptography Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Department of Mathematics and Statistics University of Turku 2017 Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 1 of 26
Matrices Definition Matrix A is an entity A = A 11 A 12... A 1n A 21 A 22... A 2n...... A m1 A m2... A mn. Type m n: m rows, n columns. A ij : elements of matrix A ij R: real matrix A ij C: complex matrix Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 2 of 26
Matrices Definition 1 n-matrix A = (A 11 A 12... A 1n ) is called horizontal vector or row vector. A 11 A 21 m 1-matrix A = is called vertical vector or. column vector. A m1 Remark Both horizontal and vertical vectors can be interpreted as elements in space R n (or C n ). Usually indexes used in such cases are simple. Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 3 of 26
Matrices Definition Zero matrix O is matrix with all elements as zero. Square matrix is a matrix having the same number of rows and columns. Diagonal matrix is a square matrix D such that i j D ij = 0. Identity matrix I n is a diagonal matrix where all diagonal elements as ones. Definition Transpose (A T ) ij = A ji. A square matrix A is symmetric if A T = A. Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 4 of 26
Matrices Scalar product If A is a m n-matrix and c is complex or real number, then ca is m n-matrix where (ca) ij = ca ij (elementwise product). Sum of matrices If A is a m n-matrix and B a r s-matrix, sum A+B is defined only if m = r and n = s. Then (A+B) ij = A ij +B ij Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 5 of 26
Matrices Product of matrices If A is a m n-matrix and B a r s-matrix, sum A+B is defined only if n = r. Then product is a m s-matrix AB having (AB) ij = s A ik B kj. k=1 Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 6 of 26
Matrices Example = = ( 2 1 1 1 2 3 ( ) 1 0 0 2 1 1 1 2 2 2 1+1 2+1 1 2 0+1 1+1 2 2 0+1 1+1 2 1 1+2 2+3 1 1 0+2 1+3 2 1 0+2 1+3 2 ( 5 3 3 6 8 8 ) ) Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 7 of 26
Matrices Example (noncommutative) ( )( ) ( 2 1 1 3 4 8 = 1 1 2 2 3 5 ( )( ) ( 1 3 2 1 5 4 = 2 2 1 1 6 4 Remark Product of matrices is not commutative, i.e. AB BA, in general. ), ). Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 8 of 26
Matrices Example ( 1 1 1 1 )( 1 1 1 1 ) = ( 0 0 0 0 ). Remark For the product of matrices the rule AB = O = A = O or B = O does not hold in general. Thus, a product of two nonzero matrix can be zero matrix, i.e. AB = O is possible even if A O and B O. Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 9 of 26
Matrices Theorem A(BC) = (AB)C A(B +C) = AB +AC (A+B)C = AC +BC a(ab) = (aa)b = A(aB) AO = OA = O AI = IA = A (AB) T = B T A T Assuming that right sides are defined. Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 10 of 26
Matrices Remark Product of matrices can be computed with blocks: ( )( ) ( A1 A 2 B1 B 2 A1 B = 1 +A 2 B 3 A 1 B 2 +A 2 B 4 A 3 A 4 B 3 B 4 A 3 B 1 +A 4 B 3 A 3 B 2 +A 4 B 4 ) Definition For a square matrix A and n Z +, we define { A 0 = I A n = A A... A (n times). Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 11 of 26
Inverse matrix Definition Let A be a n n-matrix. If there exists such a n n-matrix B such that AB = I n = BA, we call B as inverse matrix of A and denote it by B = A 1. If a matrix A has an inverse matrix, we call matrix A regular. Otherwise matrix A is singular. Remark It can be shown that inverse matrix for a matrix A is unique if it exists. Also, it can be proved that for square matrices it holds AB = I BA = I, i.e, in the definition of the inverse matrix the condition AB = I is enough. Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 12 of 26
Inverse matrix Example Let Then 1 2 1 A = 2 0 3. 1 3 2 1 2 1 9 7 6 1 0 0 2 0 3 1 1 1 = 0 1 0 1 3 2 6 5 4 0 0 1 and 9 7 6 1 2 1 1 0 0 1 1 1 2 0 3 = 0 1 0 6 5 4 1 3 2 0 0 1 Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 13 of 26
Inverse matrix Example (continued) Thus, the matrix 1 2 1 A = 2 0 3. 1 3 2 has the inverse matrix 9 7 6 A 1 = 1 1 1. 6 5 4 Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 14 of 26
Determinants Definition Let A = (a 11 ) be a 1 1-matrix. Then determinant of matrix A is det(a) = A = a 11. Definition Let A = (a ij ) be a n n-matrix. For i,j {1,...,n}, we denote by A ij a submatrix of A which is obtained from A by removing the ith row and jth column. Then, with any r,s {1,...,n} we can compute the determinant of matrix A with a recursive equation A = n k=1 [ ] ( 1) r+k a rk A rk = n k=1 [ ] ( 1) k+s a ks A ks. Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 15 of 26
Determinants examples Remark The previous definition formulate determinants of n n-matrices as linear combinations of determinants of (n 1) (n 1)-matrices. Therefore, that deffinition has to be applied recursively in order to compute value for a determinant. Determinant of 2 2-matrix Let Then A = ( ) a b. c d det(a) = a b c d = ad bc Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 16 of 26
Determinants (examples) Determinant of 3 3-matrix Let a b c A = d e f. g h i Then det(a) = a b c d e f g h i = a e f h i b d f g i +c d e g h. Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 17 of 26
Determinants (examples) Determinant of 4 4-matrix Let a b c d A = e f g h i j k l. m n o p Then det(a) = +c a b c d e f g h i j k l m n o p e f h i j l m n p = a d f g h j k l n o p e f g i j k m n o b e g h i k l m o p Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 18 of 26
Determinants Example Matrix A = ( a b c d has an inverse matrix if and only if ad bc 0. In that case, ( ) A 1 1 d b =. ad bc c a ) Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 19 of 26
Determinants Properties Let n Z +, c C and A be a n n-matrix. Then det(a) 0 if and only if A 1 exists (i.e., A is regular matrix); det(a) = 0 if and only if A is singular matrix; If det(a) 0, then det(a 1 ) = (det(a)) 1 ; det(a T ) = det(a); det(ab) = det(a) det(b); det(ca) = c n det(a). Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 20 of 26
Sets M n (R) and M n (C) Definition Let M n (R) and M n (C) denote the set of all n n-matrices with real and complex number entries, respectively. Theorem The sets M n (R) and M n (C) are abelian groups under matrix addition with the zero matrix O (O ij = 0) as the neutral element and A = ( 1)A, where ( A) ij = 1 A ij, as the opposite element in the group. Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 21 of 26
Sets M n (R) and M n (C) Checking group criterias Let A,B,C M n (R). Then R0 (A+B) ij = A ij +B ij R; R1 ((A+B)+C) ij = (A ij +B ij )+C ij = A ij +(B ij +C ij ) = (A+(B +C)) ij ; R2 (A+O) ij = A ij +O ij = A ij +0 = A ij = 0+A ij = O ij +A ij = (O +A) ij ; R3 (A+( 1)A) ij = A ij +( 1)A ij = 0 = O ij = ( 1)A ij +A ij = (( 1)A+A) ij ; R4 (A+B) ij = A ij +B ij = B ij +A ij = (B +A) ij. For the complex matrices the considerations are very similar. Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 22 of 26
Set GL(n,R) Definition The set GL(n,R) = {A M n (R) det(a) 0} is called the general linear group (of degree n over field R). Theorem The set GL(n,R) = {A M n (R) det(a) 0} is a group under matrix multiplication where the neutral element is the identity matrix I and the inverse element is the inverse matrix A 1 of matrix A. The inverse matrix of A exists when det(a) 0. The group is not abelian as the matrix multiplication is not commutative. Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 23 of 26
Set GL(n,R) Checking group criterias Let A,B,C GL(n,R). Then R0 (AB) ij = n k=1 A ikb kj R and AB = A B 0, i.e., AB GL(n,R); R1 ((AB)C) ij = n m=1 [( n k=1 A ikb km )C mj ] = n k=1 [A ik ( n m=1 B kmc mj )] = (A(BC)) ij ; R2 (AI) ij = n k=1 A iki kj = A ij I jj = A ij = I ii A ij = n k=1 I ika kj = (IA) ij (I ii = 1 and I ij = 0 for i j); R3 A 1 exist (det(a) 0) and AA 1 = I = A 1 A (by definition); R4 This criteria does ( not hold )( in general ) in ( GL(n,R), ) i.e., group 2 1 1 3 4 8 is not abelian. = 1 1 2 2 3 5 ( ) ( )( ) 5 4 1 3 2 1 =. 6 4 2 2 1 1 Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 24 of 26
Set SL(n,R) Definition The set SL(n,R) = {A GL(n,R) det(a) = 1} is called the special linear group (of degree n over field R). Theorem The set SL(n,R) = {A GL(n,R) det(a) = 1} is a subgroup of GL(n, R) under matrix multiplication. Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 25 of 26
Set SL(n,R) Checking subgroup criteria Let A,B SL(n,R). Clearly, I SL(n,R), i.e., SL(n,R). Also, we have det(a) = 1 and det(b) = 1 yielding det(a 1 B) = det(a) 1 det(b) = det(b) det(a) = 1 SL(n,R). Therefore, by subgroup criteria, SL(n, R) is a subgroup of GL(n,R), i.e., SL(n,R) GL(n,R). Ville Junnila, Arto Lepistö viljun@utu.fi, alepisto@utu.fi Matrices 26 of 26