Math 2270-1

Practice Exam 2 Solutions

Practice Exam

This exam is closed-book and closed-note. You may not use a calculator which is capable of doing linear algebra computations. In order to receive full or partial credit on any problem, you must show all of your work and justify your conclusions. There are 100 points possible, and the point values for each problem are indicated in the right-hand margin. Good Luck!

1a) Show that the following matrix equation has no solution

matrix([[1, 2], [-1, 0], [0, 1]])*matrix([[x1], [x2...

(5 points)

> with(linalg):
Aaugb:=matrix(3,3,[1,2,2,-1,0,0,0,1,4]);
#the augmented matrix for this system

Warning, the protected names norm and trace have been redefined and unprotected

Aaugb := matrix([[1, 2, 2], [-1, 0, 0], [0, 1, 4]])...

> rref(Aaugb);

matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]])

remember, this is an augmented matrix, and the bottoms row says 0*x1 + 0*x2 =1 so these equations are insconsistent.

1b) Find the least-squares solution to the problem in part (a).

(10 points)

> A:=matrix(3,2,[1,2,-1,0,0,1]);
b:=vector([2,0,4]);

A := matrix([[1, 2], [-1, 0], [0, 1]])

b := vector([2, 0, 4])

> transpose(A)&*evalm(A)=transpose(A)&*evalm(b);
#the least squares solution (well b should
#be written as a column vector

`&*`(matrix([[1, -1, 0], [2, 0, 1]]),matrix([[1, 2]...

> linsolve(transpose(A)&*A,transpose(A)&*b);
#least squares solution

vector([-1, 2])

So the least squares solution is [-1,2].

2) Let W be the span of the vectors {[1,-1,0],[2,0,1]} in 3-space.

2a) Find an orthonormal basis for the plane W.

(10 points)

Use Gram-Schmidt:

> w1:=vector([1,-1,0]);
w2:=vector([2,0,1]);
v1:=w1;
#first orthogonal element
v2:=w2-(dotprod(w2,v1)/dotprod(v1,v1))*v1;
#second orthogonal element;
evalm(v2); #actual value
u1:=(1/sqrt(dotprod(v1,v1)))*v1;
#first orthonormal element
u2:=(1/sqrt(dotprod(v2,v2)))*v2;
#second orthonormal element

w1 := vector([1, -1, 0])

w2 := vector([2, 0, 1])

v1 := w1

v2 := w2-w1

vector([1, 1, 1])

u1 := 1/2*sqrt(2)*w1

u2 := 1/3*sqrt(3)*(w2-w1)

>
{evalm(v1),evalm(v2)};
#orthogonal basis
{evalm(u1),evalm(u2)};
#orthonormal basis

{vector([1, 1, 1]), vector([1, -1, 0])}

{vector([1/3*sqrt(3), 1/3*sqrt(3), 1/3*sqrt(3)]), v...

2b) Let v=[2,0,4]. Find the projection of v onto the subspace W, using your answer from (2 a)

(10 points)

> v:=vector([2,0,4]);
projv:=dotprod(u1,v)*u1 + dotprod(u2,v)*u2;
evalm(projv);

v := vector([2, 0, 4])

projv := -w1+2*w2

vector([3, 1, 2])

2c) If you did your computations correctly, your answer to part (2b) should equal the matrix from number (1) multiplied by your least squares [x1,x2] to part (1b),

matrix([[1, 2], [-1, 0], [0, 1]])*matrix([[x1], [x2...

> evalm(A&*([-1,2]));

vector([3, 1, 2])

YEP!

Explain why.

Because the projection of v=[2,0,4] onto V is the nearest point to it, in the subspace W. but W is also the column space of A, and when you find the least squares solution of Ax=b you are finding the value of x so that Ax is as close to be as possible to b, i.e. Ax is the projection of b onto colspace(A)=W.

(5 points)

3) Let

L(matrix([[x], [y]])) = matrix([[1, 3], [3, 1]])*ma...

be a matrix map from R^2 to R^2. Let S=T={[1,1],[-1,1]} be a non-standard basis for R^2. Find the matrix for L with respect to S and T. You may do this problem either of the two ways we discussed.

(20 points)

Method 1: The matrix

> A:=matrix(2,2,[1,3,3,1]);

A := matrix([[1, 3], [3, 1]])

is the matrix of L with respect to the standard bases. Therefore the matrix with respect to S and T is the triple product

[P T<-E ][A][P E<-S ]. Since S=T the two transition matrices are inverses of eachother. The transition matrix of S going to E is just the S-basis put into columns. so we want

> PES:=matrix(2,2,[1,-1,1,1]);

PES := matrix([[1, -1], [1, 1]])

> evalm(inverse(PES)&*A&*PES);

matrix([[4, 0], [0, -2]])

Method 2: the columns of the matrix with respect to S and T are made out of the coords of L of the S basis vectors with respect to the T-basis. Since L[1,1]=[4,4], its coords are [4,0]. Since L[1,-1]=[2,-2] its coords are [0,-2]. This would give the matrix above

Method 3: Doing method 2 systematically means we want to express L of the S-basis vectors in terms of the T basis. This leads to the augmented matrix in which the left two columns are the T-basis and the right two columns are L of the S-basis

> B:=matrix(2,4,[1,-1,4,2,1,1,4,-2]);

B := matrix([[1, -1, 4, 2], [1, 1, 4, -2]])

> rref(B);
#this says that L of the first S-basis
#vector hast T-coords [4,0], etc.

matrix([[1, 0, 4, 0], [0, 1, 0, -2]])

so we get the same matrix

4) Let A be the four by five matrix below. Also shown are the reduced row and reduced column cecheolon forms of A.

A := matrix([[2, 1, -1, 3, 0], [1, -1, 2, -1, 1], [...

> rref(A); #reduced row echelon form

matrix([[1, 0, 0, 1, 1], [0, 1, 0, 0, -4], [0, 0, 1...

> rcef:=M->transpose(rref(transpose(M)));

rcef := proc (M) options operator, arrow; transpose...

> rcef(A); #reduced column echelon form

matrix([[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [1, -2, 0...

4a) Find a ``good'' basis for the column space of A, i.e. one whose vectors have lots of zero entries.

(5 points)

elementary column operations do no change the column space, so a good column space basis for A is the 3 non-zero columns of the reduced column echelon form of A, i.e. {[1,0,1,0],[0,1,-2,0],0,0,0,1]}.

4b) Prove that the vectors you found in part (a) actually are linearly independent, using the definition of linear independence.

(10 points)

If we write c1*[1,0,1,0] + c2*[0,1,-2,0] + c3*[0,0,0,1]=[0,0,0,0], then the first component of this identity says c1=0; the second component says c2=0, and the fourth component says c3=0. Hence the vectors are independent.

4c) Find a basis for the nullspace of A.

(10 points)

We backsolve from rref(A), thinking of it being aumented with the zero vector. Thus we get: x5=t, x4=s, x3=s+2t, x2=4t, x1=-s-t; so [x1,x2,x3,x4,x5]=s[-1,0,1,1,0] + t[-1,4,2,0,1] so a basis is{[-1,0,1,1,0],[-1,4,2,0,1]}.

4d) Find a basis for the orthogonal complement to the nullspace of A. Verify that its basis elements are orthogonal to the nullspace basis.

(5 points)

The orthogonal complement to the nullspace of A is the rowspace, (since the orthogonal complement to the row space is the nullspac). A good basis for the row space consists of the nonzero rows of rref(A), since row operations do not change the rowspace. So a good basis is {[1,0,0,1,1],[0,1,0,0,-4],[0,0,1,-1,-2]. It is easy to verify that the six dot product of each rowspace basis element with each nullspace basis element are all zero.

4e) Find a basis for the orthogonal complement to the column space of A

(5 points)

The orthogonal complement of the columnspace of A is the orthogonal complement of the rowspace of A transpose, so it is the nullspace of A transpose. The rref of A transpose is the transpose of the reduced column echelon form, i.e.

> transpose(matrix([[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [1, -2, 0, 0, 0], [0, 0, 1, 0, 0]]));

matrix([[1, 0, 1, 0], [0, 1, -2, 0], [0, 0, 0, 1], ...

backsolving for the homogeneous solution we see y4=0, y3=t, y2=2t, y1=-t, so [y1,y2,y3,y4]=t*[-1,2,1,0], so a basis is the set consting of {[-1,2,1,0]}.

4f) Verify the theorem which relates rank, nullity, and domain dimension, for our matrix A above.

(5 points)

The row and column rank are both 3, the nullity is 2, and their sum is the number of columns of A, namely 5.