Give the Definition of Matrix-Matrix Multiplication (A Times B)
Total Page:16
File Type:pdf, Size:1020Kb
Quiz Give the definition of matrix-matrix multiplication (A times B) in which one of the matrices (which?) is broken into rows and columns (which?). In your definition, specify how the output matrix is obtained from the input matrices A and B. Illustrate your definition with an explicit numeric example. Your definition should not explicitly mention dot-products or linear combinations. What is the relation between matrix-matrix multiplication and function composition? Illustrate with an explicit numeric example. Review of concept of linear transformation A function f : where and are vector spaces is a linear transformation if V−!W V W Property L1: For every vector v in and every scalar ↵ in F, f (↵ v)=↵ f (v) V Property L2: For every two vectors u and v in , f (u + v)=f (u)+f (v) V Things to note: Most common example is: Given R C matrix M, ⇥ function is f : FC FR with rule f (x)=Mx ! We proved that such a function is a linear transformation. But this is not only kind of linear transformation: C R I and can be arbitrary vector spaces (not just F or F ) V W I The function f can be described in another way, e.g. “rotation by angle ⇡/3withinthe plane Span [1, 2, 3], [9, 1, 7] ” { } Nevertheless, it’s true that if domain of f is a subspace of FC and co-domain is a subspace of FR and f is a linear transformation then f can be represented as matrix-vector multiplication. Which functions are linear transformations? Define s([x, y]) = stretching by two in horizontal direction Property L1: s(v1 + v2)=s(v1)+s(v2) Property L2: s(↵ v)=↵ s(v) v1 and s(v1) (1,1) (2,1) Since the function s( ) satisfies Properties L1 and L2, it · is a linear transformation. Similarly can show rotation by ✓ degrees is a linear v2 and s(v2) (1,2) transformation. (2,2) What about translation? t([x, y]) = [x, y]+[1, 2] + This function violates Property L1. For example: t([4, 5] + [2, 1]) = t([6, 4]) =[7, 6] − but (2,3) (4,3) v1+v2 and s(v1+v2) t([4, 5]) + t([2, 1]) = [5, 7] + [3, 1] =[8, 8] − Since t( ) violates Property L1 for at · least one input, it is not alinear transformation. Can similarly show that t( ) does not · satisfy Property L2. Which functions are linear transformations? Define s([x, y]) = stretching by two in horizontal direction Property L1: s(v1 + v2)=s(v1)+s(v2) × 1.5 Property L2: s(↵ v)=↵ s(v) 1.5 v1 and s(1.5 v1) Since the function s( ) satisfies Properties L1 and L2, it (1.5,1.5) (3,1.5) · is a linear transformation. Similarly can show rotation by ✓ degrees is a linear Since t( ) violates Property L1 for at · transformation. least one input, it is not alinear transformation. What about translation? t([x, y]) = [x, y]+[1, 2] Can similarly show that t( ) does not · This function violates Property L1. For example: satisfy Property L2. t([4, 5] + [2, 1]) = t([6, 4]) =[7, 6] − but t([4, 5]) + t([2, 1]) = [5, 7] + [3, 1] =[8, 8] − Linear transformations: Pushing linear combinations through the function Defining properties of linear transformations: Property L1: f (↵ v)=↵ f (v) Property L2: f (u + v)=f (u)+f (v) Proposition: For a linear transformation f , for any vectors v1,...,vn in the domain of f and any scalars ↵1,...,↵n, f (↵ v + + ↵ v )=↵ f (v )+ + ↵ f (v ) 1 1 ··· n n 1 1 ··· n n “Proof”: Consider the case of n = 2. f (↵1 v1 + ↵2 v2) = f (↵1 v1)+f (↵2 v2) by Property L2 = ↵1 f (v1)+↵2 f (v2) by Property L1 Proof for general n is similar. QED linear transformations: Pushing linear combinations through the function Proposition: For a linear transformation f , f (↵ v + + ↵ v )=↵ f (v )+ + ↵ f (v ) 1 1 ··· n n 1 1 ··· n n 12 Example: f (x)= x 34 ⇤ Verify that f (10 [1, 1] + 20 [1, 0]) = 10 f ([1, 1]) + 20 f ([1, 0]) − − 12 10 [1, 1] + 20 [1, 0] 34 − ! 12 12 12 10 [1, 1] + 20 [1, 0] = [10, 10] + [20, 0] 34 ⇤ − ! 34 ⇤ ! 34 − ! = 10 ([1, 3] [2, 4]) + 20 (1[1, 3]) 12 − = [30, 10] = 10 [ 1, 1] + 20 [1, 3] 34 − − − =[10, 10] + [20, 60] = 30 [1, 3] 10[2, 4] − − − = [10, 50] = [30, 90] [20, 40] − = [10, 50] From function to matrix, revisited We saw a method to derive a matrix from a function: Given a function f : Rn Rm,wewantamatrixM such that f (x)=M x.... ! ⇤ I Plug in the standard generators e1 =[1, 0,...,0, 0],...,en =[0,...,0, 1] I Column i of M is f (ei ). This works correctly whenever such a matrix M really exists: Proof: If there is such a matrix then f is linear: I (Property L1) f (↵ v)=↵ f (v)and I (Property L2) f (u + v)=f (u)+f (v) n Let v =[↵1,...,↵n]beanyvectorinR . We can write v in terms of the standard generators. v = ↵ e + + ↵ e 1 1 ··· n n so f (v)=f (↵ e + + ↵ e ) 1 1 ··· n n = ↵ f (e )+ + ↵ f (e ) 1 1 ··· n n = ↵ (column 1 of M)+ + ↵ (columnn of M) = M v QED 1 ··· n ⇤ Alineartransformationmapszerovectortozerovector Lemma: If f : is a linear transformation then f maps the zero vector of to the zero U−!V U vector of . V Proof: Let 0 denote the zero vector of ,andlet0 denote the zero vector of . U V V f (0)=f (0 + 0)=f (0)+f (0) Subtracting f (0) from both sides, we obtain 0 = f (0) V QED linear transformations and zero vectors: Kernel Definition: Kernel of a linear transformation f is v : f (v)=0 { } Written Ker f For a function f (x)=M x, ⇤ Ker f =NullM Kernel and one-to-one One-to-One Lemma: A linear transformation is one-to-one if and only if its kernel is a trivial vector space. Proof: Let f : be a linear transformation. We prove two directions. U−!V I Suppose Ker f contains some nonzero vector u,sof (u)=0 . V Because a linear transformation maps zero to zero, f (0)=0 as well, V so f is not one-to-one. I Suppose Ker f = 0 . { } Let v1, v2 be any vectors such that f (v1)=f (v2). Then f (v1) f (v2)=0 − V so, by linearity, f (v1 v2)=0 , − V so v v Ker f . 1 − 2 2 Since Ker f consists solely of 0, it follows that v v = 0,sov = v . 1 − 2 1 2 QED Kernel and one-to-one One-to-One Lemma A linear transformation is one-to-one if and only if its kernel is a trivial vector space. Define the function f (x)=A x. ⇤ If Ker f is trivial (i.e. if Null A is trivial) then a vector b is the image under f of at most one vector. That is, at most one vector u such that A u = b ⇤ That is, the solution set of A x = b has at most one vector. ⇤ linear transformations that are onto? Question: How can we tell if a linear transformation is onto? Recall: for a function f : ,theimage of f is the set of all images of elements of the V−!W domain: f (v):v { 2V} (You might know it as the “range” but we avoid that word here.) The image of function f is written Im f “Is function f is onto?” same as “is Im f = co-domain of f ?” Example: Lights Out Define f ([↵1,↵2,↵3,↵4]) = 2 •• •• • • 3 [↵1,↵2,↵3,↵4] ⇤ • • •• •• 6 7 6 7 Im f is set of configurations4 for which 2 2 Lights Out can be solved,5 ⇥ so “f is onto” means “2 2 Lights Out can be solved for every configuration” ⇥ Can 2 2 Lights Out be solved for every configuration? What about 5 5? ⇥ ⇥ Each of these questions amounts to asking whether a certain function is onto. Linear transformations that are onto? “Is function f is onto?” same as “is Im f = co-domain of f ?” First step in understanding how to tell if a linear transformation f is onto: I study the image of f Proposition: The image of a linear transformation f : is a vector space V−!W The image of a linear transformation is a vector space Proposition: The image of a linear transformation f : is a vector space V−!W Recall: aset of vectors is a vector space if U V1: contains a zero vector, U V2: for every vector w in and every scalar ↵, the vector ↵ w is in U U V3: for every pair of vectors w and w in , the vector w + w is in 1 2 U 1 2 U Proof: V1: Since the domain contains a zero vector 0 and f (0 )=0 , the image of f includes V V V W 0 . This proves Property V1. W V2: Suppose some vector w is in the image of f . That means there is some vector v in the domain that maps to w: f (v)=w. V By Property L1, for any scalar ↵, f (↵ v)=↵ f (v)=↵ w so ↵ w is in the image. This proves Property V2. V3: Suppose vectors w1 and w2 are in the image of f . That is, there are vectors v1 and v2 in the domain such that f (v1)=w1 and f (v2)=w2.