Math 21b — Determinants OH: Tuesday, 4–5 Last Friday: Least squares and data fitting (read it!) Topics: 2 × 2 determinants, the cross product, Sarrus’ rule, patterns. We intruduce the determinant of a square matrix, which in a sense is a numerical measure of invertibility. We start off by recalling examples you may already recognize. 2 × 2 determinants Perhaps we should start with the even simpler example of a 1 × 1 determinant; a 1 × 1 matrix is just a number a, and a matrix equation with it as the coefficient matrix is just ax = b, where x and b are also numbers. The solution is b/a, if that ratio is defined, and so the number a determines whether every matrix equation with a has a (unique) solution. 2 × 2 determinants work similarly. To solve a matrix equation A~x = ~b, we again try to form the inverse: −1 a b e a b x e x = = c d y f y c d f d −b 1 and using our known method for finding the inverse, we see that it is ad−bc −c a . So A is invertible if ad − bc 6= 0, and once again, a single number determines whether matrix equations with A have unique solutions. Definition 1. The determinant of A = [ ac db ] is det(A) = ad − bc, also written a b c d = ad − bc. The cross product In R2 , there is a trick to produce a vector orthogonal to a given one: swap the coordinates and add a sign. For example: Given (2, 3), one orthogonal vector is (3, −2), and another is its negative, (−3, 2), and of course any multiple would work but these at least have the same length. In three dimensions a more complicated rule also works for this: 1 Definition 2. (Cross product) The cross product of ~v = (a, b, c) and vector ~v × w ~ = (r, s, t), where: b c a c a r = s = − t = y z x z x r = bz − cy s = cx − az w ~ = (x, y, z) is the b , or y t = ay − bx. It will remain a mystery for another day why this actually works, but you can see by direct computation that this definition cleverly arranges minus signs so that when you take the dot product with either ~v or w, ~ the result is zero: (a, b, c) • (r, s, t) = abz − acy + bcx − abz + acy − bcx = 0. So if ~u is any linear combination of ~v and w, ~ we have ~u • (~v × w) ~ = 0. Given a collection of vectors ~u, ~v , w, ~ this quantity, the scalar triple product, measures their linear independence: zero if they are dependent, nonzero otherwise. If these vectors are the columns of a matrix A, then the triple product measures whether A is invertible. Definition 3. The determinant of a 3 × 3 matrix A = [ ~u ~v w~ ] is the scalar triple product det(A) = ~u • (~v × w). ~ Sarrus’ rule Remembering the computation we did to show that ~v × w ~ is perpendicular to both ~v and w, ~ we find by doing some algebra that if A = [aij ], then det(A) is a sum of products of various entries of A with different signs. Actually, it’s much neater: in each product, one entry from each row appears once, but the signs are harder to detect. The rule for the above computation is as follows: duplicate the first two columns to the right of A, for example: 1 2 3 1 2 3 1 2 4 5 6 =⇒ 4 5 6 4 5 7 8 9 7 8 9 7 8 There are six diagonal lines: three down to the right, and three up to the right. Sarrus’ rule is the following: 1. Draw all six lines; 2. For each line down to the right, multiply the three matrix entries on it; 3. For each line up to the right, multiply the entries on it and negate the result; 4. Add the six products; this is det(A). 2 Patterns and upswings Any direct attempt to generalize Sarrus’ rule to matrices with more than 3 entries per side is doomed to failure, as the book demonstrates nicely (p. 253). Therefore, we will just give the definition straight up: Definition 4. Let A be an n × n matrix. • A pattern in A is a choice of n entries, one from each row and one from each column. • If P is a pattern, visualize it by circling the entries in the matrix.. An upswing occurs between a pair of circled entries connected by a line with positive slope (up to the right). • The sign of P is 1 if the number of upswings is even, −1 if it is odd, and is denoted sgn(P ). The product of P is the product of all the circled entries, denoted prod(P ). The determinant of A is given by the following formula: a11 a12 . . . a1n a21 a22 . . . a2n X = det(A) = sgn(P ) prod(P ). .. .. .. ... . . . P a pattern an1 an2 . . . ann If this seems obtuse, don’t worry, since determinants are famously complicated. Let’s see how it works with some simple examples: Example 5. Say A is a 2 × 2 matrix, as above. Then there are two patterns: a b a b Q: . P: c d c d The only line segment in P is down to the right (negative slope), so sgn(P ) = 1 and prod(P ) = ad. In Q, the line segment has positive slope, so sgn(Q) = −1 and prod(Q) = bc. Applying the definition, det(A) = sgn(P ) prod(P ) + sgn(Q) prod(Q) = 1 · ad + (−1) · bc = ad − bc and this is how we defined the determinant of a 2 × 2 matrix. Example 6. Now we move on to a 3 × 3 matrix A with columns ~u, ~v , and w. ~ Using the previous notation ~v = (a, b, c), w ~ = (x, y, z), we take the first column to be (for example) ~u = (1, 2, 3). Then we draw the six patterns: 1 a x 1 a x 1 a x 2 b y 2 b y 2 b y 3 c z 3 c z 3 c z 1 a x 1 a x 1 a x 2 b y 2 b y 2 b y 3 c z 3 c z 3 c z 3 All the patterns on the top row have sign 1: the first has no upswings, and the other two have two each. All the patterns on the bottom row have sign −1: the first two have one upswing each, and the third has three. Reading off their products, the determinant is: det(A) = bz + 2cx + 3ay − cy − 2az − 3bx = 1 · (bz − cy) + 2 · (cx − az) + 3 · (ay − bx) = (1, 2, 3) • (a, b, c) × (x, y, z) = ~u • (~v × w) ~ which was our previous definition. As you can see, Sarrus’ rule is just a simple case of patterns and signs. The determinant has many useful formal properties which we will discuss next time, along with some standard (and much more efficient) ways of computing it. One is already available: using block matrices. You can justify the following rule straight from the definition (see the book’s proof on p. 258): Proposition 7. The determinant of a “block triangular” matrix in which A and C are square can be computed by: A B = (det A)(det D) = A 0 . 0 D C D In particular, if A is actually triangular, then det(A) is the product of the entries on its diagonal. 4