Physics 116A Determinants Peter Young (Dated: February 5, 2014) I. DEFINITION The determinant is an important property of a square n n matrix. Such a matrix, A say, has n 2 elements, a ij, and is written as the square array a 11 a 12 a 1n a A = 21 a 22 a 2n...... (1). a n1 a n2 a nn The determinant is a single number which is a function of the a ij. It is written as det(a) and to indicate the elements in it one replaces the curved brackets around the matrix array in Eq. (1) by straight vertical lines, i.e. a 11 a 12 a 1n a det(a) = 21 a 22 a 2n...... (2). a n1 a n2 a nn The determinant is defined by det(a) = ǫ i1 i 2 i n a 1i1 a 2i2 a nin, (3) i 1,i 2,,i n where the i 1,i 2,,i n are a permutation of the numbers from 1 to n, the sum is over all n! permutations, and 0, if any two of the i l are equal, ǫ i1 i 2 i n = 1, if i 1,i 2,,i n is an even permutation of 1,2,,n, 1, if i 1,i 2,,i n is an odd permutation of 1,2,,n. (4) For example, for n = 2 we have ǫ 11 = ǫ 22 = 0, ǫ 12 = 1, ǫ 21 = 1, (5)
2 so det(a) = a 11 a 22 a 12 a 21. (6) For n = 3 we have ǫ 123 = ǫ 231 = ǫ 312 = 1, ǫ 132 = ǫ 213 = ǫ 321 = 1, all other ǫ ijk = 0, (7) so det(a) = a 11 a 22 a 33 +a 12 a 23 a 31 +a 13 a 21 a 32 a 11 a 23 a 32 a 12 a 21 a 33 a 13 a 22 a 31. (8) II. COFACTOR EXPANSION Equation (3) is not the most convenient way to evaluate the determinant in practice. To discuss another way to evaluate a determinant and to describe its properties, it is useful to define the minor and cofactor as follows. The ij -th element of the matrix of minors, which we will call M ij, is the determinant of the (n 1) (n 1) matrix formed by eliminating the i-th row and j-the column of A. The corresponding cofactor C ij is given in terms of the minor by C ij = ( 1) i+j M ij. (9) The alternating signs in the last expression can be represented as a matrix of the following form (for n = 3) + + +, (10) + + i.e. the sign of the 11 element is positive and the sign alternates as one goes along a row or column. The determinant can be obtained by expanding along a row. This means we choose a row, i say, and sum the product a ij C ij over all columns j in that row, i.e. n det(a) = a ij C ij (i fixed). (11) j=1
3 Alternatively, one can expand along a column, k say, using n det(a) = a jk C jk (k fixed). (12) j=1 From the basic definition in Eq. (3) one can show that the same result is obtained from Eq. (11) for any row i, and from Eq. (12) for any column k, and that these definitions agree with Eq. (3). As an example consider the following 3 3 matrix: 1 2 2 A = 0 1 0. (13) 2 1 6 It is best to expand along the second row since it has two zeros. This gives 1 2 det(a) = (+)( 1) 2 6, (14) where the determinant is that of the matrix obtained from A in Eq. (13) by omitting the second row and second column. We then easily get det(a) = ( 1)[(1)(6) (2)(2)] = 2, (15) where we used the explicit expression for the determinant of a 2 2 matrix in Eq, (6). However, this method of evaluating a determinant is very inefficient except for small n. To see why, let us compute how many multiplications are required. For an n n matrix there are n multiplications involved in Eq. (11) or (12). However, each cofactor is itself a determinant of a square matrix of size n 1 which involves n 1 multiplications to express it, using Eq. (11) or (12), in terms of determinants of size n 2. Continuing in this way, the number of multiplications is n (n 1) (n 2) 4 3 n 2 where n 2 is the number of multiplications to evaluate a 2 2 determinant. From the explicit expression in Eq. (6) we have n 2 = 2. Hence the number of multiplications needed to evaluate a determinant by a cofactor expansion is Nmult cof (n) = n!. (16) As we shall verify, the factorial grows enormously fast so this approach to evaluating determinants is useless for numerical work except for n extremely small.
4 III. PROPERTIES OF DETERMINANTS AND ROW AND COLUMN REDUCTION Fortunately, determinants have several remarkable properties which we can exploit to find a much more efficient algorithm to evaluate them. These properties, which can be derived from the basic definition in Eq. (3), are: The determinant is unchanged if the rows and columns are exchanged (i.e. if we form the transpose of the matrix). The determinant is zero if any two rows, or any two columns, are equal. The determinant changes sign if any two rows, or any two columns, are interchanged. If every element in a single row or column is multiplied by a constant k, the determinant is multiplied by k. (Important.) The determinant is unchanged if a multiple of a row is added to another row, or a multiple of a column is added to another column. The last property can be used to put a lot of zeros into the elements of a determinant to greatly simplify its evaluation. The method is best explained by doing an example. Let us determine 4 3 0 1 9 7 2 3 D =. (17) 4 0 2 1 3 1 4 0 The first stage is to form linear combinations of rows or columns to make all entries but one equal to zero along a particular row or column. Since the third row already has one zero, we will choose this one. We focus on one of the non-zero entries in this row (the technical term for this element is the pivot ). For the sake of argument we choose the fourth column for which the pivot element (row 3 column 4) has value 1. We then add or subtract a multiple of column 4 to the other columns to make their entry in the third row equal to zero. Denoting column k by C (k) and row i by R (i) we have C (1) C (1) 4C (4), C (2) C (2), (18) C (3) C (3) 2C (4).
5 These changes can be summarized by the replacement ( ) a3j a ij a ij a i4, (i = 1,2,3,4, j = 1,2,3), (19) a 34 which ensures that the new values of a 3j (j = 1,2,3) are all zero. Note that the pivot element, a 34, is in the denominator of Eq. (19) so the pivot must be chosen to be one of the non-zero elements in the third row. Equation (19) obviously generalizes to determinants of arbitrary size n, to any row k which is being reduced, and to any (non-zero) pivot element kl, with the result a ij a ij ( akj a kl ) a il, (i = 1,,n, j = 1,,l 1,l+1,,n). (20) Equation (20) does row reduction, i.e. it puts zeros in all elements of a row except one (the pivot). One can similarly do column reduction, which is described by a formula like Eq. (20) but with rows and columns interchanged. I emphasize that these transformations do not change the value of the determinant. Hence we have 0 3 2 1 0 3 2 3 7 4 3 D = = ( )(1) 3 7 4, (21) 0 0 0 1 3 1 4 3 1 4 0 where expanding along the third row immediately reduces the size of the determinant by one, as shown in the last expression. Next we reduce the size of the determinant again. The transformation R (3) R (3) +R (2) (22) puts a zero in the 31 element and, by nice coincidence, also in the 33 element, so we have 0 3 2 0 2 D = ( 1) 3 7 4 = ( 1)( 6) = (6)[(0)( 4) ( 2)( 3)] = 36. (23) 3 4 0 6 0 This process of evaluating a determinant by successively reducing its size by forming linear combinations of rows and columns to put zeros in all positions but one in a row or column is called row and column reduction. Let us determine how many multiplications are involved in it. To reduce the determinant from n n to (n 1) (n 1) we have to apply Eq. (19) n(n 1) times since it is carried out for every row
6 i, and for every column j except one. The procedure is then repeated to reduce the determinant of size (n 1) (n 1) to size (n 2) (n 2), which requires (n 1)(n 2) applications of Eq. (19). This process continues until we have a 2 2 determinant which requires two multiplications to evaluate. Hence n 1 mult (n) = n(n 1)+(n 1)(n 2)+ +3 2+2 1 = (k +1)k N rcred = 1 ( n 3 n ), (24) 3 k=1 where we have used the standard results that m k = 1m(m+1), 2 k=1 m k=1 k 2 = 1 6m(m+1)(2m+1). (25) The crucial point is that, according to Eq. (24), the number of operations for row and column reduction only increases like the cube of n. Except for very small n, this is vastly better than the factorial n increase of the cofactor expansion shown in Eq. (16), as the following numerical example will show. IV. NUMERICS Let s consider the very modest size, n = 25. According to Eq. (24), row and column reduction requires 5,200 operations. Assuming that our computer will do 10 8 operations per second the time needed is about 50µsec. By contrast, according to Eq. (16), the cofactor expansion requires 50! 1.55 10 25 operations, which will take about 1.55 10 17 sec. This is roughly the age of the universe since the universe is about 1.37 10 10 years old and there are about 3 10 7 seconds in a year. We conclude that cofactor expansion is useless for numerical evaluation of determinants (except for n really small).