3 Linear Function
Total Page:16
File Type:pdf, Size:1020Kb
3 Linear function 3.1 Introduction In calculus, a vector in the plane R2 with components 2 and −3 is usually written using notation such as −→v = h2, −3i. For our purposes it turns out to be more convenient to express such a vector as a 2 × 1 matrix: 2 x = . −3 More generally, a vector in Rn is written as an n × 1 matrix. When writing vectors in text we usually use the matrix transpose notation to avoid unseemly vertical spacing. For instance, we might write x = [6, −1, 3, 2]T , when we want to say 6 −1 x = . 3 2 The addition and scalar multiplication defined for matrices (Section 2.1) gives an addition and scalar multiplication for vectors, which coincides with the calculus definitions. The idea of a function plays a central role in calculus and the same is true for linear algebra. For most of the functions in calculus the inputs and outputs are both real numbers, but in linear algebra, the functions we study have inputs and outputs that are vectors. For instance, here is a function L from the set R2 to the set R3: x1 +4x2 x1 L = 3x1 − x2 . x2 x2 The notation works just like it did in calculus. For example, if the input vector is [2, 1]T , then the output vector is (2) + 4(1) 6 2 L = 3(2) − (1) = 5 . 1 (1) 1 This function satisfies a couple of properties that make it “linear,” meaning that it is compatible with the addition and scalar multiplication of vectors (the precise definition is given below). Linear functions are the main functions in linear algebra. We study them in this section. 1 3 LINEAR FUNCTION 2 3.2 Definition and examples Linear function. A function L : Rn → Rm is linear if (a) L(x + y)= L(x)+ L(y), (b) L(αx)= αL(x), for all x, y ∈ Rn, α ∈ R. The notation L : Rn → Rm is used to indicate that the input vectors come from the set Rn (= domain of L) and the output vectors are in the set Rm (= codomain of L). 3.2.1 Example Show that the function L : R2 → R3 given by x1 +4x2 L(x)= 3x1 − x2 x2 is linear. Solution First, the input vector x is an element of R2 (according to the nota- 2 3 T tion L : R → R ), so it is of the form x = [x1, x2] . This is the meaning of x1 and x2 in the formula. We need to verify that L satisfies the two properties in the definition of linear function. For any x, y ∈ R2, we have x1 + y1 L(x + y)= L x2 + y2 (x1 + y1)+4(x2 + y2) (In the formula, x1 + y1 plays the role of x1 = 3(x1 + y1) − (x2 + y2) and x2 + y2 plays the role of x2.) (x2 + y2) (x1 +4x2) + (y1 +4y2) = (3x1 − x2)+(3y1 − y2) (x2) + (y2) x1 +4x2 y1 +4y2 = 3x1 − x2 + 3y1 − y2 x2 y2 = L(x)+ L(y), 3 LINEAR FUNCTION 3 so property (a) holds. Next, for any x ∈ R2 and α ∈ R, we have (αx1)+4(αx2) αx1 L(αx)= L = 3(αx1) − (αx2) αx2 (αx2) α(x1 +4x2) x1 +4x2 = α(3x1 − x2) = α 3x1 − x2 α(x2) x2 = αL(x), so property (b) holds. Therefore, L is linear. 3.2.2 Example Show that the function L : R1 → R2 given by 2x1 L(x)= −x1 is linear. Solution For any x, y ∈ R1, we have 2(x1 + y1) L(x + y)= L([x1 + y1]) = −(x1 + y1) (2x1)+(2y1) = (−x1) + (−y1) 2x1 2y1 = + −x1 −y1 = L(x)+ L(y), so property (a) holds. Next, for any x ∈ R1 and α ∈ R, we have 2(αx1) L(αx)= L([αx1]) = −(αx1) α(2x1) 2x1 = = α α(−x1) −x1 = αL(x), so property (b) holds. Therefore, L is linear. If a is any number, then the function f : R → R given by f(x)= ax has as its graph a straight line (through the origin with slope a). In fact, this function is linear in the sense of the above definition (regarding R as the same thing as R1). The next theorem generalizes this statement with the number a being replaced by a matrix A. 3 LINEAR FUNCTION 4 Theorem. Let A be an m × n matrix. The function L : Rn → Rm defined by L(x)= Ax is linear. The function L in the theorem is called the linear function corresponding to the matrix A. Proof. It should be checked that L makes sense as a function from Rn to Rm. If x is an input vector, then it is an element of Rn, and is therefore an n × 1 matrix. Since A is m×n, the product Ax is defined and equals an m×1 matrix, which is an element of Rm, as desired. We now check that L satisfies the two properties of a linear function. For any x, y ∈ Rn, we have L(x + y)= A(x + y)= Ax + Ay = L(x)+ L(y), where the second equality is due to the distributive property of matrix multi- plication (property (d) in Section 2.3). This verifies property (a). Next, for any x ∈ Rn and α ∈ R, we have L(αx)= A(αx)= α(Ax)= αL(x) where the second equality is due to a property of matrix and scalar multipli- cation (property (i) in Section 2.3). This verifies property (b) and finishes the proof that L is linear. This gives us another way to check whether a given function is linear: 3.2.3 Example Use the last theorem to show that the function L : R2 → R3 given by x1 +4x2 L(x)= 3x1 − x2 x2 is linear. Solution We have x1 +4x2 1 4 x1 L(x)= 3x1 − x2 = 3 −1 = Ax, x2 x2 0 1 where 1 4 A = 3 −1 . 0 1 3 LINEAR FUNCTION 5 Therefore, L is linear by the preceding result. The zero vector in Rn is the vector T 0 = [0, 0,..., 0] . Theorem. Let L : Rn → Rm be a function. If L is linear, then L(0)= 0. Proof. Assume that L is linear. We have L(0)+ L(0)= L(0 + 0)= L(0), where the first equality is due to property (a) of a linear function. Subtracting L(0) from both sides of this equation gives L(0)= 0, as desired. Put another way, the theorem says that if L does not send 0 to 0, then it cannot be linear. 3.2.4 Example Is the function F : R1 → R2, given by 2x1 +1 F (x)= , −x1 linear? Explain. Solution Note that 2(0) + 1 1 0 F (0)= = 6= = 0 −(0) 0 0 (the string says that F (0) 6= 0), so F is not linear according to the preceding theorem. 3.2.5 Example Is the function F : R2 → R2, given by x1x2 F (x)= , x1 linear? Explain. Solution If we can show that the function does not send 0 to 0, then we can quickly conclude that it is not linear (as in the preceding example). However, (0)(0) 0 F (0)= = = 0, (0) 0 3 LINEAR FUNCTION 6 so all we know is that F has a chance of being linear. We see if we can verify property (a) of a linear function. Let x, y ∈ R2. We have x1 + y1 (x1 + y1)(x2 + y2) F (x + y)= F = x2 + y2 (x1 + y1) x1x2 + x1y2 + y1x2 + y1y2 = . x1 + y1 We are trying to show that this equals x1x2 y1y2 F (x)+ F (y)= + x1 y1 x1x2 + y1y2 = . x1 + y1 Since the first components (in red) do not match up, we suspect that F is not linear. We cannot write F (x+y) 6= F (x)+F (y), though, since there are choices for x and y that actually give equality (for instance, x = 0 and y = 0). However, in order to show that F fails property (a) it is enough to give a single counterexample. Using inspection, we see that if x1, x2, y1, y2 are all equal to 1, for instance, then the first components are not equal, so this should give our counterexample. Everything we have done up to this point can be considered scratch work. It was done just to come up with an idea for a counterexample. To solve the problem, all we really need to write is this: If x = [1, 1]T and y = [1, 1]T , then 2 4 2 1 1 F (x + y)= F = 6= = + = F (x)+ F (y), 2 2 2 1 1 so F is not linear. 3 LINEAR FUNCTION 7 3.3 Image, Preimage, and Kernel Definition of image. Let L : Rn → Rm be a function. n Let x be a vector in R . The image of x under L is L(x). The image of L (denoted im L) is the set of all images L(x) as x ranges through Rn. In symbols, n im L = {L(x) | x ∈ R }. In other words, given an input vector x, its image is the corresponding output vector. And the image of L is the set of all actual output vectors. 3.3.1 Example Let L : R3 → R2 be given by x1 − 3x2 +2x3 L(x)= −2x1 +6x2 − x3 (a) Find the image of [4, 1, −7]T under L. (b) Is [−5, 7]T in im L? Explain. Solution (a) The image of [4, 1, −7]T under L is 4 (4) − 3(1) + 2(−7) −13 L 1 = = . −2(4) + 6(1) − (−7) 5 −7 (b) The question amounts to asking if there is a vector x in R3 such that 3 LINEAR FUNCTION 8 L(x) = [−5, 7]T , that is, x1 − 3x2 +2x3 −5 = .