Matrix Definition: A matrix is a rectangular array of numbers enclosed by a pair of bracket and is denoted by a capital letters A, B etc. 2 3 7 A 1 1 5 1 3 1 B 2 1 4 4 7 6 Both A and B are examples of matrix. 1 Matrix In the matrix a11 a A 21 am1 a12 a22 am 2 a1n a2 n amn = [aij] numbers aij (i =1,2,--- m , j=1,2,---n)are called elements. First subscript indicates the row; second subscript indicates the column. The matrix consists of mn elements number of rows(m) by number of columns(n) of a matrix is called order of the matrix and is written as m n (read m by n) 2 Matrix Types of matrices Square matrix: When m = n, i.e., a11 a A 21 an1 a12 a22 an 2 a1n a2 n ann A is called a “square matrix of order n x n elements a11, a22, a33,…, ann called diagonal elements. The line along which they lie is called the principal diagonal. n aii i 1 a11 a22 ... ann is called the trace of A. 3 Matrix Types of matrices Column matrix: A matrix with only one column is called Column Matrix , i,e 1 A 0 8 Matrix A is a column matrix of Order 3x1 4 Matrix Types of matrices Row matrix: A matrix with only one row is called row matrix , i,e A 1 2 3 4 5 Matrix A is a row matrix of Order 1x5 5 Matrix Types of matrices Equal matrices Two matrices A = [aij] and B = [bij] are said to be equal (A = B) iff each element of A is equal to the corresponding element of B, i.e., aij = bij for 1 i m, 1 j n. iff pronouns “if and only if” if A = B, it implies aij = bij for 1 i m, 1 j n; if aij = bij for 1 i m, 1 j n, it implies A = B. 6 Matrix Types of matrices Equal matrices Example: 1 0 A 4 2 and a b B c d Given that A = B, find a, b, c and d. if A = B, then a = 1, b = 0, c = -4 and d = 2. 7 Matrix Types of matrices Zero matrix or Null Matrix: Every element of a matrix is zero, it is called a zero matrix, i.e., 0 0 0 0 A 0 0 0 0 0 8 Matrix Types of matrices A square matrix whose elements aij = 0, for i > j is called upper triangular, i.e., a11 a12 0 0 a22 0 A square matrix whose elements aij = 0, for i < j is called lower triangular, i.e., a11 0 a 21 an1 a22 an 2 a1n a2 n ann 0 0 ann 9 Matrix Types of matrices Diagonal matrix: A square matrix whose elements aij = 0, for i j is called diagonal matrix, i.e., a11 0 D 0 0 a22 0 and is denoted by 0 0 ann D diag[a11 , a22 ,..., ann ] 10 Matrix Types of matrices Scalar matrix: A square diagonal matrix whose diagonal elements are equal but not unity is called scalar matrix, i.e., 11 Matrix Types of matrices Identity matrix: A square matrix whose elements aij = 0, for i j and aij = 1, for i = j is called identity matrix or unit matrx and is denoted by I 1 0 0 Examples of identity matrices: 1 0 and 0 1 0 0 1 0 0 1 Properties: AI = IA = A 12 Matrix Types of matrices Transpose matrix: The matrix obtained by interchanging the rows and columns of a matrix A is called the transpose of A (write AT or A/ ). For a matrix A = [aij], its transpose AT = [bij], where bij = aji. Example: 1 2 3 A 4 5 6 The transpose of A is 1 4 AT 2 5 3 6 13 Matrix Types of matrices Transpose matrix: Properties (AT)T = A and (lA)T = l AT (A + B)T = AT + BT (A - B)T = AT - BT (AB)T = BT AT 14 Matrix Types of matrices Symmetric matrix: A square matrix A whose elements aji = aij for all i and j is called symmetric. Example: 1 2 3 A 2 4 5 3 5 6 is symmetric. Properties: AT = A 15 Matrix Types of matrices Skew-symmetric matrix: A square matrix A whose elements aji = - aij for i j and aij 0 for i j is called skew-symmetric. 2 1 0 Example: A 2 0 2 is skew-symmetric. 1 2 0 Properties: AT = - A 16 Matrix Types of matrices Conjugate of a matrix: 17 Matrix Types of matrices 18 Matrix Types of matrices Conjugate of a matrix: 19 Matrix Types of matrices 20 Matrix Types of matrices Hermitian matrices: 21 Matrix Types of matrices Skew-Hermitian matrices: 22 Matrix Types of matrices Sub-matrices of a matrix (square or rectangular: 23 Matrix Types of matrices Principal submatrices of a matrix: 24 Matrix Types of matrices Leading submatrices of a matrix: 25 Matrix Types of matrices Determinant of a square matrix: 26 Matrix Determinants Determinant of order n Determinant of n n matrix a11 a A 21 an1 a12 a22 an 2 a1n a2 n ann is denoted | A | and is representation by 27 Matrix Determinants whose order is n 28 Matrix Determinants The following properties are true for determinants of any order. 1. If every element of a row (column) is zero, e.g., 1 2 0 0 1 0 2 0 0 , 2. |AT| = |A| then |A| = 0. determinant of a matrix = that of its transpose 3. |AB| = |A||B| 29 Matrix Types of matrices Minor of the matrix: 30 Matrix Algebra of matrices Addition and subtraction of matrices Two matrices of the same order are said to be conformable for addition or subtraction. Two matrices of different orders cannot be added or subtracted, e.g., 2 3 7 1 1 5 1 3 1 2 1 4 4 7 6 are NOT conformable for addition or subtraction. 31 Matrix Algebra of matrices Addition and subtraction of matrices If A = [aij] and B = [bij] are m n matrices, then A ± B is defined as a matrix C = A ± B, where C= [cij], cij = aij ± bij for 1 i m, 1 j n. 1 2 3 2 3 0 Example: if A 0 1 4 and B 1 2 5 Evaluate A + B and A – B. 2 3 3 0 3 5 3 1 2 A B 0 ( 1) 1 2 4 5 1 3 9 2 3 3 0 1 1 3 1 2 A B 0 ( 1) 1 2 4 5 1 1 1 32 Matrix Algebra of matrices Scalar multiplication Let l be any scalar and A = [aij] is an m n matrix. Then lA = [laij] for 1 i m, 1 j n, i.e., each element in A is multiplied by l. Example: 1 2 3 A . 0 1 4 Evaluate 3A. 3 1 3 2 3 3 3 6 9 3A 3 0 3 1 3 4 0 3 12 In particular, l 1, i.e., A = [aij]. It’s called the negative of A. Note: A A = 0 is a zero matrix 33 Matrix Algebra of matrices Properties Matrices A, B and C are conformable, A + B = B + A (commutative law) A + (B +C) = (A + B) +C (associative law) l(A + B) = lA + lB, where l is a scalar (distributive law) Can you prove them? 34 Matrix Algebra of matrices Matrix multiplication Two matrices may be multiplied if the number of columns in left product must equal the number of rows in right product. This condition is called conformable for multiplication If A = [aij] is a m p matrix and B = [bij] is a p n matrix, then AB is defined as a m n matrix C = AB, where C= [cij] with p cij aik bkj ai1b1 j ai 2b2 j ... aip bpj k 1 for 1 i m, 1 j n. 35 Matrix Algebra of matrices Matrix multiplication Example: a11 a12 A a21 a22 a31 a32 a11 a12 Solution : AB a21 a22 a31 a31 a13 a23 a33 a13 b11 b12 b13 a23 , B b21 b22 b23 a33 b31 b32 b33 , find AB. b11 b12 b13 b b b 21 22 23 b31 b31 b33 a11b11 a12b21 a13b31 a11b12 a12b22 a13b32 a21b11 a22b21 a23b31 a21b12 a22b22 a23b32 a11b31 a12b31 a33b31 a31b12 a32b22 a33b32 a11b13 a12b23 a13b33 a21b13 a22b23 a23b33 a31b13 a32b23 a33b33 36 Matrix Algebra of matrices Matrix multiplication Example: 1 2 3 A 0 1 4 , 1 2 B 2 3 , 5 0 Evaluate C = AB. Answer: Since order of A is 2 3 and order of B is 3 2 , i,e conformable for multiplication AB 1 2 1 2 3 2 3 0 1 4 5 0 c21 0 (1) 1 2 4 5 22 cont 37 Matrix Algebra of matrices Matrix multiplication c11 1 (1) 2 2 3 5 18 1 2 1 2 3 c12 1 2 2 3 3 0 8 0 1 4 2 3 c 0 (1) 1 2 4 5 22 21 5 0 c 0 2 1 3 4 0 3 22 1 2 1 2 3 18 8 C AB 2 3 0 1 4 22 3 5 0 38 Matrix Algebra of matrices Matrix multiplication In particular, A is a 1 m matrix and b11 B is a m 1 matrix, i.e., A a11 a12 ... a1m b B 21 bm1 then C = AB is a scalar. m C a1k bk1 a11b11 a12b21 ... a1mbm1 k 1 39 Matrix Algebra of matrices Matrix multiplication BUT BA is a m m matrix! b11 b11a11 b11a12 b b a b21a12 21 21 11 BA a11 a12 ... a1m bm1 bm1a11 bm1a12 b11a1m b21a1m bm1a1m So AB BA in general ! 40 Matrix Algebra of matrices Properties Matrices A, B and C are conformable, A(B + C) = AB + AC (A + B)C = AC + BC A(BC) = (AB) C AB BA in general AB = 0 NOT necessarily imply A = 0 or B = 0 AB = AC NOT necessarily imply B = C 41 Matrix Algebra of matrices However, if two square matrices A and B such that AB = BA, then A and B are said to be commute. If A and B such that AB = -BA, then A and B are said to be anti-commute. 42 Matrix Algebra of matrices 43 Matrix Algebra of matrices 44 Matrix Orthogonal matrix A matrix A is called orthogonal if AAT = ATA = I, i.e., AT = A-1 Example: prove that orthogonal. Since, 1/ 3 T A 1/ 6 1/ 2 1/ 3 1/ 6 A 1/ 3 2 / 6 1/ 3 1/ 6 1/ 3 2 / 6 1/ 6 0 1/ 2 1/ 3 1/ 2 0 1/ 2 is . Hence, AAT = ATA = I. Can you show the details? We’ll see that orthogonal matrix represents a rotation in fact! 45 Matrix Algebra of matrices (AB)-1 = B-1A-1 (AT)T = A and (lA)T = l AT (A + B)T = AT + BT (AB)T = BT AT 46 Matrix Algebra of matrices Problem: If A is a square matrix , then show that A + AT is symmetric and A – AT is skew-symmetric. Proof: Since A and B are symmetric ,i,e. A = AT and B =BT . (A + AT )T = AT +(AT) T = AT +A = A + AT . Hence A+B is symmetric . Again (A - AT )T = AT -(AT) T = AT –A = -(A - AT ). Hence A – AT is skew-symmetric. 47 Matrix Algebra of matrices Problem: If A and B are symmetric (skewsymmetric ) matrices , then A +B and A – B are also symmetric. Proof: Since A and B are symmetric , i,e A = AT and B =BT . (A + B )T = AT +BT = A +B . Hence A+B is symmetric . Again (A - B )T = AT -BT = A -B . Hence A – B is symmetric. 48 Matrix Algebra of matrices Problem: Every square matrix can be expressed in one and only one way as the sum of a symmetric and a skew-symmetric matrix. Solution: For a square matrix A, we have A + AT is symmetric and A – AT is skewsymmetric. Obviously (A + AT ) = P is also symmetric and ( A – AT ) = Q is also skew-symmetric. (Cont) 49 Matrix Algebra of matrices Clearly A = (A + AT ) + ( A – AT ) = P +Q which is the sum of symmetric and skewsymmetric. Now we are show that this representation is unique (Cont) 50 Matrix Algebra of matrices Let A=P+Q and A=R+S be two representation of A with P , R symmetric and Q , S skew-symmetric Now from A=R+S , we have = AT =(R+S) T = RT +S T = R –S So, P = (A + AT ) = (R+S+R-S)=R Q = (A -AT ) = (R+S – R +S)= S Hence the representation is unique 51 Matrix Algebra of matrices Problem: If A and B are symmetric matrices , then show that AB +BA is symmetric and AB – BA is skew-symmetric. Proof: Since A and B are symmetric , i,e A = AT and B =BT . (AB + B A)T = (AB)T +(BA)T = BT AT +AT BT = B A +A B= A B+ B A . Hence AB+BA is symmetric . (Cont) 52 Matrix Algebra of matrices Again (AB - B A)T = (AB)T -(BA)T = BT AT - AT BT = B A -A B= - (A B- B A) . Hence AB - BA is skew-symmetric . 53 Matrix Determinants Cofactor of elements The cofactor of an element aij is obtained by multiplying the minor of element aij by (-1)i+j and is denoted by Aij 1 0 1 Example A 2 1 2 , cofactor of element a12 0 3 1 0 is 1 2 A12 (1) 2 2 3 0 6 54 Matrix Determinants Cofactor of elements Properties 3 j 1 A , when i j aij Aij o , when i j 1 0 1 Proof: Let A 2 1 2 3 1 0 (Cont) 55 Matrix Determinants •Cofactor of elements A11 1 2 1 0 A21 A31 2, A12 0 1 1 0 0 1 1 2 1, A22 1 1 3 0 1, A32 2 2 3 0 6, A13 3, A23 1 1 2 2 0, A33 (Cont) 1 0 3 1 1 0 2 1 2 1 3 1 1 1 1 56 Matrix Determinants •Cofactor of elements(cont) 1 0 1 A 2 1 2 1(0 2) 0(0 6) 1(2 3) 3 3 1 0 A a11 A11 a12 A12 a13 A13 1(2 ) 0( 6 ) (1) 3 A a21 A11 a22 A12 a23 A13 2(2 ) 1( 6 ) 2(1) 0 proof 57 Matrix Determinants •Cofactor of elements Example: Find the cofactor matrix of the matrix Solution: A11 1 2 1 0 1 0 1 A 2 1 2 3 1 0 2, A12 2 2 3 0 (Cont) 6, A13 2 1 3 1 1 58 Matrix Determinants •Cofactor of elements(cont) 0 1 1 1 1 0 A21 1, A22 3, A23 1 1 0 3 0 3 1 A31 0 1 1 2 1, A32 1 1 2 2 0, A33 1 0 2 1 1 59 Matrix Determinants For any 2x2 matrix a11 A a21 a12 a22 Its inverse can be written as Example: Find the inverse of The determinant of A is -2 Hence, the inverse of A is 1 A A 1 a22 a 21 a12 a11 1 0 A 1 2 0 1 A 1/ 2 1/ 2 1 How to find an inverse for a 3x3 matrix? 60 Determinants of order 3 Consider an example: 1 2 3 A 4 5 6 7 8 9 Its determinant can be obtained by: 1 2 3 4 5 1 2 1 2 A 4 5 6 3 6 9 7 8 7 8 4 5 7 8 9 3 3 6 6 9 3 0 You are encouraged to find the determinant by using other rows or columns 61 Matrix Adjoint of a square matrix The adjoint of a square matrix A is the transpose of the matrix formed by the cofactors of the elements of the determinant of the matrix A and is denoted by adjA 62 Matrix Adjoint of a square matrix Properties * A(adjA) (adjA) A A I * adjAB (adjB) (adjA) * (adjA) adj ( A ) T T 63 Matrix Inverse matrix If two non singular (i,e A 0 ) square matrices A and B such that AB = BA = I, then B is called the inverse of and is denoted by the symbol A-1 and is defined by adjA A A 1 Properties 1 T T 1 * (A ) (A ) 1 1 1 * ( AB) B A (Cont) 64 Matrix Inverse matrix Properties Pr oof : ( AB) ( AB) 1 I B 1 A1 ( AB) ( AB) 1 B 1 A1 I 1 1 1 1 1 B (( A A) B ) ( AB) B ( A I ) 1 1 1 B ( IB ) ( AB) B A 1 ( B 1 B ) ( AB) 1 B 1 A1 1 1 1 1 1 I ( AB) B A ( AB) B A 65 1 Matrix Adjoint of a square matrix(cont) Example: Find the adjoint matrix of the matrix 1 2 3 A 2 3 1 4 3 3 Solution: 3 1 2 1 2 3 A11 6, A12 2, A13 6 3 3 4 3 4 3 (Cont) 66 Matrix Adjoint of a square matrix(cont) A21 A31 0 1 1 0 0 1 1 2 1, A22 1 1 3 0 1, A32 3, A23 1 1 2 2 0, A33 1 0 3 1 1 0 2 1 1 1 1 1 6 adjA 2 3 0 Ans. 6 1 1 67 Matrix Inverse matrix Find Cofactor matrix 1 2 3 of A 0 4 5 1 0 6 and find A-1 Answer: Here cofactor are A11 A21 A31 4 5 0 6 2 3 0 6 2 3 4 5 24 12 2 A12 A22 0 5 1 6 1 3 1 6 A32 5 3 1 3 0 5 5 (Cont) A13 0 4 1 0 A23 A33 4 1 2 1 0 1 2 0 4 2 4 68 Matrix Inverse matrix Hence Cofactor matrix of given by: 1 2 3 A 0 4 5 1 0 6 is then 24 5 4 12 3 2 2 5 4 (Cont) 69 Matrix Inverse matrix Inverse matrix of 1 2 3 A 0 4 5 1 0 6 is given by: 24 5 4 24 12 2 1 1 1 A 12 3 2 5 3 5 A 22 2 5 4 4 2 4 T 12 11 6 11 1 11 5 22 3 22 5 22 2 11 1 11 2 11 70