Math 54 – Slides from January 29, 2009
• Finish linear transformations as matrices • Matrix operations • Matrix inversion Finishing up Linear Transformations as Matrices Recall In and e1 , . . . , en . Example. Let A = Then 9 2 7 , and let T be the linear transformation T (x) = Ax . 3 1 9 9 4 7 0 = T (e1 ) = Ae1 = 2 2 0 3 0 0 4 9 4 7 1 = T (e2 ) = Ae2 = 0 2 0 3 0 0 7 9 4 7 0 = T (e3 ) = Ae3 = 3 2 0 3 1 4 0
So we get back the columns of A ! More generally, if A is an m × n matrix and T : Rn → Rm is the corresponding linear transformation T (x) = Ax , then T (ei ) is the ith column of A . Therefore: (*) A = [ T (e1 ) T (e2 ) . . . T (en ) ] .
Now let T : Rn → Rm be any linear transformation. For any vector x = (x1 , . . . , xn ) in Rn , we have x = x1 e1 + x2 e2 + · · · + xn en and therefore the superposition principle gives T (x) = T (x1 e1 + x2 e2 + · · · + xn en ) = x1 T (e1 ) + · · · + xn T (en ) , so T (x) can be determined once we know T (e1 ), . . . , T (en ) . Continuing with this linear transformation T , let A be the matrix A = [ T (e1 ) T (e2 ) . . . 1 T (en ) ] .
2
Then Ax = x1 T (e1 ) + · · · + xn T (en ) = T (x) . So T is given by our matrix A ! In other words, all linear transformations from Rn to Rm are given by matrices. There is only one matrix A that satisfies the condition T (x) = Ax (because it has to be of the form (*)). The matrix A (as above) is called the standard matrix for the linear transformation T. Example. What is the standard matrix of the linear transformation √ from R2 to R2 that rotates vectors counterclockwise about 0 by 45◦ and dilates by 2 ? We have T (e1 ) = (1, 1) and T (e2 ) = (−1, 1) , so A= [draw on board] Existence and Uniqueness Definition. A linear transformation T : Rn → Rm is onto Rm if each b ∈ Rm is the image of at least one x ∈ Rn (in other words, if the range equals Rm ). We have T is onto ⇐⇒ Ax = b has a solution for all b ∈ Rm ⇐⇒ A has a pivot in each row (Thm. 4 p. 43) ⇐⇒ the columns of A span Rm (Thm. 4 again) Example. If T is given by the matrix 1 1 −1 1 .
9 2 7
4 0 4
7 3 4
then it is not onto, because 9 4 7 9 2 0 3 0 7 4 4 0
4 −8/9 8/9
7 13/9 −13/9
9 0 0
4 −8/9 0
7 13/9 . 0
Definition. A linear transformation T : Rn → Rm is one-to-one if each b ∈ Rm is the image of at most one x ∈ Rn . Alternatively, T is one-to-one if (and only if) T (x1 ) = T (x2 ) whenever x1 = x2 .
3
Theorem. Let T : Rn → Rm be a linear transformation. Then T is one-to-one if and only if the homogeneous equation T (x) = 0 has only the trivial solution. Proof. Assume first that T is one-to-one. Let x be a solution to the homogeneous equation T (x) = 0 . Since 0 is also a solution, we must have x = 0 , so T (x) = 0 has only the trivial solution. On the other hand, assume now that T is not one-to-one. Then there are vectors x1 = x2 with T (x1 ) = T (x2 ) . But then x1 − x2 is a solution of the homogeneous equation T (x) = 0 since T (x1 − x2 ) = T (x1 ) − T (x2 ) = 0 . This is a nontrivial solution since x1 = x2 . Therefore (from page 66) T is one-to-one if and only if the columns are linearly independent. Example. Let T : R3 → R2 be given by the matrix (a). Is T one-to-one? (b). Is T onto? It’s not one-to-one because it has too many columns (you can’t squeeze R3 in to R2 ) (Thm. 8 p. 69). It is onto. 9 2 4 0 7 . 3
Matrix Operations Addition and scalar multiplication for matrices are as for vectors (which are matrices, after all): For addition, you can only add matrices of the same sizes, and you add the corresponding positions; for example: 1 4 2 5 3 7 + 6 0 8 1 9 8 = 2 4 10 6 12 8
Scalar multiplication is similar: 3 9 2 4 0 7 27 = 3 6 12 0 21 9 .
At times it will be useful to use matrix notation: a b a12 . . . a1n 11 11 a21 a22 . . . a2n b21 B= . A= . . . , .. . . . . . . . . . am1 am2 . . . amn bm1
b12 b22 . . . bm2
... ... .. . ...
b1n b2n . . . bmn
.
4
These are m × n matrices. Then, if A + B = C , we have cij = aij + bij ( 1 ≤ i ≤ m , 1 ≤ j ≤ n ). Properties of addition and scalar multiplication are: (a). (b). (c). (d). (e). (f). A+B =B+A A + (B + C) = (A + B) + C A+0=A r(A + B) = rA + rB (r + s)A = rA + sA r(sA) = (rs)A
for all m × n matrices A , B , and C , and for all scalars r and s . These follow from the corresponding rules for ordinary numbers. For example, the (i, j) entry of r(A + B) is r(aij + bij ) , and the (i, j) entry of rA + rB is raij + rbij . These are equal. Matrix Multiplication Definition. Let A be an m × n matrix with entries aij , and let B be an n × p matrix with entries bjk . Then the matrix product AB is the m × p matrix C with entries given by cik = ai1 b1k + ai2 b2k + · · · + ain bnk . The number of columns of A must match the number of rows of B . m × n times n × p gives m × p Why the crazy formula? Let A , B , and C be as above. Let T (x) = Ax ; it is a linear transformation from Rn to Rm . Also let U (y) = By ; it is a linear transformation from Rp to Rn . Since By ∈ Rn , we can let x = By and compute T (x) = T (U (y)) = T (By) = A(By) . This gives a function T ◦ U from Rp to Rm : Rp − Rn − Rm → → It is a linear transformation because (T ◦ U )(u + v) = T (U (u + v)) = T (U (u) + U (v)) = T (U (u)) + T (U (v)) = (T ◦ U )(u) + (T ◦ U )(v) and T (U (cv)) = T (cU (v)) = cT (U (v))
U T
5
for all u, v ∈ Rp and all scalars c . What is the standard matrix of this linear transformation T ◦ U ? We have T (U (ek )) = T ( k th column of B ) = b1k v1 + b2k v2 + · · · + bnk vn , where v1 , . . . , vn are the columns of A . Since the ith position of vj is aij , we have c1k . T (U (ek )) = . . cmk where cik = ai1 b1k + ai2 b2k + · · · + ain bnk . So the standard matrix of T ◦ U is C = AB ! So, multiplication of matrices corresponds to composition of linear transformations. A sample computation: 2 4 −1 3 1 5 −3 3 = 19 7 −1 33
Properties of matrix multiplication are: (a). (b). (c). (d). (e). A(BC) = (AB)C A(B + C) = AB + AC (B + C)A = BA + CA r(AB) = (rA)B = A(rB) Im A = A = AIn
Here A is an m × n matrix, B and C have sizes such that the expressions make sense, and r is a scalar. Proof of (a) using composition of linear transformations. Let T , U , and V be the linear transformations T (x) = Ax , U (y) = By , and V (z) = Cz . Then (A(BC))z = A((U ◦ V )(z)) = T ((U ◦ V )(z)) = T (U (V (z))) and ((AB)C)z = (T ◦ U )(Cz) = (T ◦ U )(V (z)) = T (U (V (z))) so A(BC) = (AB)C since both are equal to the standard matrix of the linear transformation T ◦ U ◦ V . Proof of (d). The (i, j) entry of (rA)B is (rai1 )b1j + · · · + (rain )bnj , and the (i, j) entry of r(AB) is r(ai1 b1j + · · · + ain bnj ) . These two expressions are equal.
6
Non-property of matrix multiplication: You can’t (always) cancel: if AB = AC then it doesn’t necessarily follow that B = C . (See Exercise 10.) The Transpose of a Matrix Definition. The transpose of an m × n matrix A is the n × m matrix AT whose (i, j) entry is the (j, i) entry of A : AT 9 = 4 7 2 0. 3
ij
= Aji .
Example.
9 2
4 0
7 3
T
Properties of the transpose are: (a). AT )T = A (b). (A + B)T = AT + B T (c). (rA)T = rAT (d). (AB)T = B T AT (rows become columns and vice versa)
Matrix Inversion Definition. A matrix A is invertible if it is square and if there is a square matrix C of the same size such that AC = I and CA = I .
If so, then we write C = A−1 and call A−1 the inverse of A . Example. We have 3 1 so 3 1 Is 2 1 2 1 invertible? 2 1 2 1 would be the 5 2 5 2 2 −1 −5 1 = 3 0 0 1
−1
and
2 −1 −5 3
−5 3
3 1
5 1 = 2 0
0 1
=
2 −1
.
No, because if C was its inverse then both columns of C same, so the product couldn’t be the identity matrix. The inverse of a 2 × 2 matrix is fairly easy to compute:
7
Theorem. If ad − bc = 0 then the 2 × 2 matrix is 1 d −b ad − bc −c a
a c .
b d
is invertible, and its inverse
If ad − bc = 0 then the matrix is not invertible. Proof of second part. Call the matrix A . If a = b = 0 then the top row of the matrix is zero, so the top row of AC is zero for any 2 × 2 matrix C , so the product cannot equal I2 . If a = 0 or b = 0 , then the homogeneous system Ax = 0 has a nontrivial solution, since 0 −b a b =0. = −bc + ad a c d This contradicts the following theorem. Theorem. If A is an invertible n × n matrix, then for each b ∈ Rn the equation Ax = b has exactly one solution, and it is given by x = A−1 b . Proof. x = A−1 b is a solution because A(A−1 b) = (AA−1 )b = In b = b . On the other hand, if x is a solution of Ax = b , then A−1 Ax = A−1 b . But A−1 Ax = In x = x , so x must equal A−1 b . Properties of the matrix inverse are: (a). If A is invertible, then A−1 is also invertible, and A−1
−1
=A.
(b). If A and B are invertible n × n matrices, then AB is invertible, and (AB)−1 = B −1 A−1 . (c). If A is invertible, then so is its transpose, and AT
−1
= A−1
T
.
8
Proof of (a). (AB)(B −1 A−1 ) = A(BB −1 )A−1 = AIn A−1 = AA−1 = In and likewise for (B −1 A−1 )(AB) . If A , B , and C are invertible, then (ABC)−1 = C −1 B −1 A−1 (not A−1 B −1 C −1 – the slides used in class were wrong) because (ABC)−1 = (A(BC))−1 = (BC)−1 A−1 = C −1 B −1 A−1 .
Algorithm for Finding the Inverse (1) Let A be an n × n matrix. Write out the n × 2n matrix [ A In ] . (2) Row reduce the matrix to reduced echelon form. (3) The left half of the resulting matrix should be the identity matrix In . If it isn’t, then A isn’t invertible. (4) The right half will then be A−1 . Example: 3 1 5 2 1 0 0 1 1 3 1 0 Therefore 3 1 5 2 2 5 2 1
−1
0 1 0 −1
1 0 1 3
1 0
2 −1 1 0 0 1
0 1 1 −3 2 −1 −5 3
=
2 −1
−5 3
.