Matrix Calculations: Determinants and asis Transformation A. Kissinger Institute for Computing and Information ciences Version: autumn 27 A. Kissinger Version: autumn 27 Matrix Calculations / 32
Outline Determinants Determinants A. Kissinger Version: autumn 27 Matrix Calculations 2 / 32
Last time Determinants Any linear map can be represented as a matrix: f (v) A v g(v) v Last time, we saw that composing linear maps could be done by multiplying their matrices: f (g(v)) A v Matrix multiplication is pretty easy: ( ) ( ) ( ) 2 + 2 ( ) + 2 4 3 4 4 3 + 4 3 ( ) + 4 4 ( ) 7 3 3...so if we can solve other stuff by matrix multiplication, we are pretty happy. A. Kissinger Version: autumn 27 Matrix Calculations 3 / 32
Last time Determinants For example, we can solve systems of linear equations: A x b...by finding the inverse of a matrix: x A b There is an easy shortcut formula for 2 2 matrices: ( ) ( ) a b A A d b c d ad bc c a...as long as ad bc. We ll see today that ad bc is an example of a special number we can compute for any square matrix (not just 2 2) called the determinant. A. Kissinger Version: autumn 27 Matrix Calculations 4 / 32
Determinants What a determinant does For an n n matrix A, the determinant det(a) is a number (in R) It satisfies: det(a) A is not invertible A does not exist A has < n pivots in its echolon form Determinants have useful properties, but calculating determinants involves some work. A. Kissinger Version: autumn 27 Matrix Calculations 6 / 32
Determinant of a 2 2 matrix Assume A ( ) a b c d Recall that the inverse A exists if and only if ad bc, and in that case is: ( ) A d b ad bc c a In this 2 2-case we define: ( ) a b det c d a b c d ad bc Thus, indeed: det(a) A does not exist. A. Kissinger Version: autumn 27 Matrix Calculations 7 / 32
Determinant of a 2 2 matrix: example Example: Then: P ( ).8..2.9 ( ) 8 2 9 det(p) 8 9 2 72 2 7 7 We have already seen that P exists, so the determinant must be non-zero. A. Kissinger Version: autumn 27 Matrix Calculations 8 / 32
Determinant of a 3 3 matrix a a 2 a 3 Assume A a 2 a 22 a 23 a 3 a 32 a 33 Then one defines: a a 2 a 3 det A a 2 a 22 a 23 a 3 a 32 a 33 +a a 22 a 23 a 32 a 33 a 2 a 2 a 3 a 32 a 33 + a 3 a 2 a 3 a 22 a 23 Methodology: take entries a i from first column, with alternating signs (+, -) take determinant from square submatrix obtained by deleting the first column and the i-th row A. Kissinger Version: autumn 27 Matrix Calculations 9 / 32
Determinant of a 3 3 matrix, example 2 5 3 4 2 3 4 5 2 + 2 2 3 4 ( ) ( ) ( ) 3 5 2 2 8 + 3 3 22 29 A. Kissinger Version: autumn 27 Matrix Calculations / 32
The general, n n case a a n.. a n... a nn a 22 a 2n a 2 a n a 32 a 3n +a.. a 2 a n2... a nn.. a n2... a nn a 2 a n + a 3 ± a.. n.. a (n )2... a (n )n (where the last sign ± is + if n is odd and - if n is even) Then, each of the smaller determinants is computed recursively. A. Kissinger Version: autumn 27 Matrix Calculations / 32
Applications Determinants Determinants detect when a matrix is invertible Though we showed an inefficient way to compute determinants, there is an efficient algorithm using, you guessed it...gaussian elimination! olutions to non-homogeneous systems can be expressed directly in terms of determinants using Cramer s rule (wiki it!) Most importantly: determinants will be used to calculate eigenvalues in the next lecture A. Kissinger Version: autumn 27 Matrix Calculations 2 / 32
Vectors in a basis Determinants Recall: a basis for a vector space V is a set of vectors {v,..., v n } in V such that: They uniquely span V, i.e. for all v V, there exist unique a i such that: v a v +... + a n v n ecause of this, we use a special notation for this linear combination: a. a n : a v +... + a n v n A. Kissinger Version: autumn 27 Matrix Calculations 4 / 32
ame vector, different outfits The same vector can look different, depending on the choice of basis. Consider the standard basis: {(, ), (, )} vs. another basis: {( ), ( )} Is this a basis? Yes... ( ) It s independent because: has 2 pivots. It s spanning because... we can make every vector in using linear combinations of vectors in : ( ) ( ) ( ) ( ) ( )...so we can also make any vector in R 2. A. Kissinger Version: autumn 27 Matrix Calculations 5 / 32
ame vector, different outfits {( ) ( )}, {( ) ( )}, Examples: ( ) ( ) ( ) ( ) ( ) 3 ( ) ( ) 2 ( ) A. Kissinger Version: autumn 27 Matrix Calculations 6 / 32
Why??? Determinants Many find the idea of multiple bases confusing the first time around. {(, ), (, )} is a perfectly good basis for R 2. Why bother with others? ome vector spaces don t have one obvious choice of basis. Example: subspaces R n. 2 ometimes it is way more efficient to write a vector with respect to a different basis, e.g.: 9378234 43823 224 54232498.. 3 The choice of basis for vectors affects how we write matrices as well. Often this can be done cleverly. Example: JPEGs, MP3s, search engine rankings,... A. Kissinger Version: autumn 27 Matrix Calculations 7 / 32
Transforming bases, part I Problem: given a vector written in {(, ), (, )}, how can we write it in the standard basis? Just use the definition: ( x y ) x ( ) + y ( ) ( ) x + y y Or, as matrix multiplication: ( ) ( ) ( ) x x + y y y }{{}}{{}}{{} T in basis in basis Let T be the matrix whose columns are the basis vectors. Then T transforms a vector written in into a vector written in. A. Kissinger Version: autumn 27 Matrix Calculations 9 / 32
Transforming bases, part II How do we transform back? Need T which undoes the matrix T. olution: use the inverse! T : (T ) Example: (T ) ( ) ( )...which indeed gives: ( ) ( ) a b ( a b ) b A. Kissinger Version: autumn 27 Matrix Calculations 2 / 32
Transforming bases, part IV How about two non-standard bases? ( ) ( ) ( {, } C { 2 Problem: translate a vector from olution: do this in two steps: T C T v }{{}...then translate from to C ( ) a to b T v }{{} first translate from to... ), ( ) a b ( ) } 2 (T C ) T v C A. Kissinger Version: autumn 27 Matrix Calculations 2 / 32
Transforming bases, example For bases: ( { ), ( ) } C {...we need to find a and b such that ( ) ( ) a a b b C ( 2 ), Translating both sides to the standard basis gives: ( ) ( ) ( ) ( ) a a 2 2 b b This we can solve using the matrix-inverse: ( ) ( ) a ( b 2 2 ) ( ) } 2 ( ) a b A. Kissinger Version: autumn 27 Matrix Calculations 22 / 32
Transforming bases, example For: ( ) a we compute b }{{} in basis C ( 2 2 ( ) ( ) 2 2 ) } {{ } T C ( 2 2 ( ) }{{} T 4 4 ) ( ) a b }{{} in basis ( ) 4 ( ) 2 99 2 2 which gives: ( ) a b }{{} in basis C 4 ( ) ( ) 2 99 a 2 2 b }{{}}{{} T C in basis A. Kissinger Version: autumn 27 Matrix Calculations 23 / 32
asis transformation theorem Theorem Let be the standard basis for R n and let {v,..., v n } and C {w,..., w n } be other bases. Then there is an invertible n n basis transformation matrix T C such that: a a. T C. with.. a n a n a n a C n 2 T is the matrix which has the vectors in as columns, and T C : (T C ) T 3 T C (T C ) a a A. Kissinger Version: autumn 27 Matrix Calculations 24 / 32
Matrices in other bases ince vectors can be written with respect to different bases, so too can matrices. For example, let g be the linear map defined by: ( ) ( ) ( ) ( ) g( ) g( ) Then, naturally, we would represent g using the matrix: ecause indeed: ( ) ( ) ( ) ( and ) ( ) ( ) ( ) (the columns say where each of the vectors in go, written in the basis ) A. Kissinger Version: autumn 27 Matrix Calculations 25 / 32
On the other hand... Lets look at what g does to another basis: ( ) ( ) {, } First (, ) : ( ) g( ) g( Then, by linearity: ( )... g( ) + g( ( ) ) g( ( ) ) ( ) + ( ) + ( ) ( ) )... ( ) ( ) A. Kissinger Version: autumn 27 Matrix Calculations 26 / 32
On the other hand... imilarly (, ) : g( ( ) ( ) {, } ( ) ( ) ) g( ) g( Then, by linearity: ( )... g( ) g( ( ) ) ( ) ( ) ( ) ( ) )... ( ) ( ) A. Kissinger Version: autumn 27 Matrix Calculations 27 / 32
A new matrix Determinants From this: ( ) g( ) ( ) g( ( ) ( ) ) It follows that we should instead use this matrix to represent g: ( ) ecause indeed: ( ) ( ) ( ) ( ) ( ) ( ) and (the columns say where each of the vectors in go, written in the basis ) A. Kissinger Version: autumn 27 Matrix Calculations 28 / 32
A new matrix Determinants o on different bases, g acts in a totally different way! ( ) ( ) ( ) ( ) g( ) g( ) g( ( ) ) ( ) g( ( ) ( ) )...and hence gets a totally different matrix: ( ) ( ) vs. A. Kissinger Version: autumn 27 Matrix Calculations 29 / 32
Transforming bases, part II Theorem Assume again we have two bases, C for R n. If a linear map f : R n R n has matrix A w.r.t. to basis, then, w.r.t. to basis C, f has matrix A : A T C A T C Thus, via T C and T C one tranforms -matrices into C-matrices. In particular, a matrix can be translated from the standard basis to basis via: A T A T A. Kissinger Version: autumn 27 Matrix Calculations 3 / 32
Example basis transformation, part I Consider the standard basis {(, ), (, )} for R 2, and as alternative basis {(, ), (, 2)} Let the linear map f : R 2 R 2, w.r.t. the standard basis, be given by the matrix: ( ) A 2 3 What is the representation A of f w.r.t. basis? ( ) ince is the standard basis, T contains the 2 -vectors as its columns A. Kissinger Version: autumn 27 Matrix Calculations 3 / 32
Example basis transformation, part II The basis transformation matrix T in the other direction is obtained as matrix inverse: T ( ( ) ) ( ) ( ) T 2 2 2 2 2 Hence: A T ( A ) T ( ) 2 2 ( ) ( 2 3 ) 2 2 2 ( 3 2 ) 2 4 4 2 ( ) 4 2 2 2 2 ( ) 2 A. Kissinger Version: autumn 27 Matrix Calculations 32 / 32