------------------------------------------------------------------ Math 2270 sec. 3 Laboratory Assignment 5. Treibergs Due Nov. 16, 1998 ------------------------------------------------------------------ Create a document in which you answer the following questions, using a mixture of MAPLE computations and textual insertions (using "#" or text mode or handwritten text to comment .) Print out a copy and hand it in. Remember to put your name and section number on your paper. Matrices of Linear Transformations In this lab assignment, you will be asked to investigate how the choice of a basis in a real vector space identifies the space with R^n, and how linear transformations on the space may be studied using matrices. > with(linalg): 1. We enter vectors which will form a pair of bases for R^3. Choose three vectors. > s1:=vector([1,2,4]);s2:=vector([2,-1,1]);s3:=vector([3,1,2]); > t1:=vector([2,1,-1]);t2:=vector([3,1,-2]);t3:=vector([-2,1,5]); We also enter the natural basis for three space. > e1:=vector([1,0,0]);e2:=vector([0,1,0]);e3:=vector([0,0,1]); It is convenient to form matrices in which the basis vectors occur as column vectors. > MS:=augment(s1,s2,s3);MT:=augment(t1,t2,t3);ME:=augment(e1,e2,e3); > We can check if these choices are indeed bases if the determinants are nonzero: > det(MS),det(MT); 2. To find the coordinates of a vector V in a given basis, say in S={s1,s2,s3}, we need to solve for numbers c[i] so that V=c[1] s1 + c[2] s2 + c[3] s3. Then we write c=[V]_S. One way to do this in MAPLE is to define a function coor which gives the coordinates. We specify the basis using the matrix MS. Then [V]_S = coor(V,MS); > coor:= (x,Mbasis)-> evalm(Mbasis^(-1) &* x); > c:=coor(vector([15,45,60]),MS); We may reassemble the vector by forming the linear combination with the coordinates c. > evalm( scalarmul(s1,c[1]) +scalarmul(s2,c[2]) + scalarmul(s3,c[3])); Of course, this is equal to matrix multiplication: > evalm(MS &* c); When you find the coordinates of a vector already in S you get 0's and a single one. (Why?) > coor(s2,MS); Lets write the basis in a different order. > MS2:=augment(s2,s3,s1); > coor(vector([15,45,60]),MS2); For the same v ector, you get the same coordinate numbers but they occur in a different order. Let's see what happens in the natural basis. The general vector written in the natural basis has the simple form. > vector([x,y,z]),coor(vector([x,y,z]),ME); 3. Let's discuss change of basis. The coordinates in a new basis for any vector are obtained by multiplyng the coordinates in the old basis by a matrix. It means, for any vector v, [v]_T = P_TfromS [v]_S. By plugging in v = si, we get [si]_T = P_SfromT [s1]_S = P_TfromS [0,...,0,1,0,...,0]= col(P_TfromS,i) is the i-th column of the matrix P_S P_TfromS := coor(MS,MT); Using MAPLES power to compute with variables, we can see what the coordinates of the general vector [x,y,z] in the T basis. > genv:=vector([x,y,z]); > coor(genv,MT); We can also compute what the product P_TfromS and the coordinates of the genreal vector in the S basis. > evalm(P_TfromS &* coor(genv,MS)); We can also see that the matrix of the transformation going the other way is the inverse matrix. > P_SfromT:=coor(MT,MS); > inverse(P_TfromS); 4. Linear transformation given by a basis of the domain and image vectors. First, a linear transformation is determined if we know where the vectors of a basis are mapped. Suppose our transformation maps R^3 -> R^4. We choose vectors y1, y2, y3 in R^4 and define a linear map L:R^3 -> R^4 such that L(s1)=y1, L(s2) = y2, and L(s3) = y3. Then if we write any vector V = c[1] s1 + c[2] s2 + c[3] s3, then L(V) = L( c[1] s1 + c[2] s2 + c[3] s3) = c[1] L(s1) + c[2] L(s2) + c[3] L(s3) = c[1] y1 + c[2] y2+ c[3] y3 = MY c, where c = [V]_S are the coordinates of V in basis S. We write a linear transformation specified by a basis and its corresponding image vectors. > y1:=vector([2,3,4,3]);y2:=vector([1,1,1,1]);y3:=vector([3,4,5,4]); > MY:=augment(y1,y2,y3); > L:=(V,M_domain_basis,M_image_vectors)->evalm( M_image_vectors &* coor( V, M_domain_basis)); To check, lets compute L(s1), L(s2), L(s3) : (Should get y1, y2, y3.) > L(s1,MS,MY); L(s2,MS,MY); L(s3, MS, MY); 5. Matrix of a transformation. Supose were given a basis S for R^3 and a basis U for R^4. Then, the matrix of the transformation L relative to the bases S, U is the matrix which when multiplied by the coordinates of the vector w in the S basis produces the coordinates of vector L(w) in the U basis. In other words, there is a matrix M_UfromS such that for all w in R^3 we have [L(w)]_U = M_UfromS [w]_S. Note that P_UfromS is nothing more that the matrix of the identity transformation. Let's begin by defining a couple of candidates for bases in R^4 and checking that they are bases. > u1:=vector([1,1,2,2]);u2:=vector([3,0,1,1]); u3:=vector([3,2,1,0]);u4:=vector([2,1,-1,2]); > v1:=vector([1,0,1,0]);v2:=vector([0,1,0,1]); v3:=vector([2,3,1,4]);v4:=vector([0,1,1,1]); > MU:=augment(u1,u2,u3,u4); MV:=augment(v1,v2,v3,v4); > rank(MU),rank(MV); To find the matrix of the transformation, we only need to substitute the basic vectors of S into the equation. Thus [y1]_U =[L(s1)]_U = M_UfromS [s1]_S = M_UfromS [1,0,0] = col(M_UfromS,1) is the first column of the matrix. Thus, all columns give > M_UfromS := coor(MY,MU); Now we can check that multiplying the coordinates of a general vector in the S basis by the matrix of the transformation gives the same coordinates in the U basis as evaluating the U-coordinates of the linear transformation of a general vector. > evalm(M_UfromS &* coor(genv,MS)); > coor(L(genv,MS,MY),MU); 6. Change of the matrix of transformation from a change of basis. This is probably the most difficult thing we see all quarter. First, we store the change of basis matrix > P_VfromU:=coor(MU,MV); The idea is to use the change of basis formula to determine what the new matrix of the transformation should be. The new matrix has the property that for every w in R^3, [L(w)]_V = M_VfromT [w]_T defines the matrix of the transformation L in the bases V,T. Using the change of basis formula and the inverse relation, P_UfromV [L(w)]_V =[L(w)]_U = M_UfromS [w]_S = M_UfromS P_SfromT [w]_T which implies [L(w)]V=(P_UfromV)^(-1) M_UfromS P_SfromT [w]_T = M_VfromT [w]_T which means P_VfromU L_UfromS P_SfromT = L_VfromT. (The spaces all chain nicely.) Let us evaluate the matrix of the transformation L in the bases T, V directly and using the formula for the change of matrix of transformation. The notation L(t1,MS,MY) means the transformation of the vector t1 by the (same transformation) which is defined by L(si)=yi for all i=1,2,3. > M_VfromT:=coor(L(MT,MS,MY),MV); > evalm(P_VfromU &* M_UfromS &* P_SfromT); 7. To see that changing basis may be useful to understand a linear transformation, suppose that the transformation A: R^3->R^3 is given by > A:=x->evalm(matrix([[-7,-29,111],[8,26,-88],[3,7,-19]])&*x); The matrix for the transformation A in the natural basis is (obviously) > M_EfromE:=coor(A(ME),ME); Now we switch to a basis of eigenvectors R. This will be explained when we discuss diagonalization, but from the present point of view, let MAPLE find the eigenvectors. Then we encode the eigenvectors as columns in a matrix MR. We apply the transformation formula to rewrite the matrix of the transformation in the bases R to R. > eigenvects("); > MR:=matrix([[-7,-5,-11],[6,4,8],[1,1,1]]); > P_RfromE:=coor(ME,MR); > P_EfromR:=coor(MR,ME); > evalm(P_RfromE &* M_EfromE &* P_EfromR); which is easier to understand than A or M_EfromE. The diagonals are the eigenvalues. In this basis, the transformation merely dilates in the basis directions. Homework problems. 1. Choose a set of three vectors. W={w1, w2, w3} in R^3 which form a basis. Form a matrix MW in which your vectors appear as columns. Using MAPLE, check that the columns do form a basis. 2. Pick a vector q in R^3. Find the coordinates of q in your basis W. Show that a linear combination of the vectors of W with coefficients given by the coordinates equals q. 3. Choose another set of vectors X={x1,x2,x3} in R^3 and arrange that they also form a basis. Find the change of basis matrix P_XfromW and show that for a general vector [x,y,z], the coordinates in your new basis X are the same as the product of the transformation matrix P_XfromW times the coordinates of the vector in your original basis W. 4. Choose a pair of bases for R^4. Call them UU={u5,u6,u7,u8} and VV = {v5,v6,v7,v8}. Define a linear operator B:R^4 -> R^3 which takes B(u5)=w1+w2, B(u6)=w2+w3, B(u7)=w3+w1, B(u8)=w1+w2+w3. What is B([1,1,1,1])? Note that dimensions are different than my examples! 5. Find the matrix M_WfromUU of the transformation B from the basis UU to the basis W. Check that the coordinates in W of B([a,b,c,d]) of a general vector [a,b,c,d] are the same as the product of M_WfromUU and the coordinates of [a,b,c,d] in the basis UU. 6. Find the matrix M_XfromVV of the transformation B in the bases X and VV. Show that it is also given by the change of basis formula for the matrix of a transformation. 7. Let F:=x->evalm(matrix([[0,4,4],[2,-6,2],[-14,-10,-18]])&*x); denote a linear transformation R^3->R^3. Find the matirx of the transformation in the natural basis. Find the matrix of the transformation F from the basis of the eigenvectors of the matrix to the basis of the eigenvectors.