Determinant.md (3904B)
1 # Determinant 2 3 CS331 - Linear Algebra - Khan U2 4 5 **Definition:** The determinant is the scaling factor of some area (or volume in 3d space) from before to after a linear transformation. Note that this is only useful in 3d and 2d as the notion of volume in higher dimensions ([Hypervolume](Hypervolume.md)) is a bit abstract. 6 7 This value can be negative if the space has been flipped. In 3d space, this means the volume after the tranformation is in left hand space if it was before in right hand space. 8 9 Note: If the determinant of the matrix is 0 then the matrix is not invertible. 10 11 ## Calculation 12 13 #### 2x2 14 15 For a 2x2 matrix we have Det(A) = ad-bc where the matrix A is defined as <a,b> <c,d> where each vector is a row. 16 17 Ex: 18 19 A = [1 2] 20 [3 4] 21 22 Det(A) = 4 - 6 = -2 23 24 #### Generalized 25 26 For each element in the first row of the matrix remove all values in the same row and column and then multiply the current element by the determinant of the remaining elements. 27 28 We then add all of the determinant element pairs where every other is negative (first is positive second negative and so on). 29 30 This is called Laplace expansion or cofactor expansion. 31 32 Note: You don't need to use the first row as the row you traverse to find the determinant. The only thing that matters is that the first row starts with a + and switches back and forth thus if you pick the last row to evaluate with you might start with a negative depending on the size of the matrix. It often makes sense to do this because it allows for selection of a row with many zeroes. 33 34 With this, you are not stick layer to layer with a given row either so you can select the last row for the largest matrix and the second for a smaller and so on. 35 36 Also, this can be done with either **any row or column**. 37 38 #### Scalar 39 40 When multiplying a **row** by a scalar the resulting determinant is equal to the original determinant multiplied by the scalar. 41 42 This can be extrapolated to the size of a matrix (matrix times scalar) and thus it becomes dependent upon the number of rows in the matrix. 43 44 #### Row Addition + Subtraction 45 46 If you have two matricies that are identical apart from a singular row then the sum of the individual determinants will be equal to the determinant of the matrix where the differing row components are added together. 47 48 Example: 49 50 A = [1 2] 51 [3 4] 52 53 B = [1 2] 54 [4 5] 55 56 C = [1 2] 57 [3+4 4+5] 58 59 |A| = 4 + -6 60 = -2 61 62 |B| = 5 + -8 63 = -3 64 65 |C| = 9 + -14 66 = -5 67 = |A| + |B| 68 69 In a similar vein, when subtracing a row the resulting determinant is equal to the determinant of the original minus the determinant of the subtracted row's matrix. 70 71 A = [1 2] 72 [3 4] 73 74 B = [1 2] 75 [4 5] 76 77 C = [1 2] 78 [3-4 4-5] 79 80 |A| = 4 + -6 81 = -2 82 83 |B| = 5 + -8 84 = -3 85 86 |C| = -1 + 2 87 = 1 88 = |A| - |B| 89 90 #### Row Swap 91 92 If we are to swap two arbitrary rows in a matrix the det(A) = -det(S) where S is the swapped matrix. 93 94 #### Upper Triangle Determinant 95 96 The determinant of a matrix where the bottom left triangle is all zeroes is equal to the product of the values on the diagonal. 97 98 Ex. 99 100 [2 9 8] 101 A = [0 8 7] 102 [0 0 7] 103 104 det(A) = 2x8x7 = 112 105 106 Written out taking the determinant using the first column: 107 108 det(A) = 2 | 8 7 | + 0 + 0 109 | 0 7 | 110 = 2x56 111 = 112 112 113 Given that: 114 115 | 8 7 | = 8x7 = 56 116 | 0 7 | 117 118 #### Lower Triangle Determinant 119 120 As was shown above, the same is true for a lower triangle matrix where the top right corner is all zeroes. 121 122 [x 0 0 ... 0] 123 [x x 0 ... 0] 124 [...........] 125 [...........] 126 [...........] 127 [x x ... x x] 128 129 #### Simplification 130 131 When simplifying the most important rule is that you can subtract any row from any other row in the matrix multiplied by an arbitrary scalar and still have the same determinant. 132 133 Another rule that is important is the row swapping rule described above. 134 135 More formally with a_x being a row in A: 136 137 A = [a_1] 138 [a_2] 139 [a_3] 140 141 B = [a_1 - ca_x] 142 [a_2 ] 143 [a_3 ] 144 145 |A| = |B| for any scalar c and any row of A defined as a_x.