Starting from:

$24.99

MATH 461 Project- Part 3 Solution

1. Method
2. New Commands
(a) The command eye(n) which returns the n × n identity (eye-dentity?) matrix. For example
>> eye(5) produces a 5 × 5 identity matrix.
(b) >> rank(A) will compute the rank of a matrix A.
(c) Eigenvalues can be found easily. If A is a matrix then:
>> eig(A)
will return the eigenvalues. Note that it will return complex eigenvalues too. So keep an i open for those.
(d) If we have an eigenvalue λ for A, we can use rref on an augmented matrix [A − λI | 0] to lead us to the eigenvectors. For example if A is 4 × 4 and λ = 3 is an eigenvalue, then we can obtain the coefficient matrix of this system by entering A - 3*eye(4).
(e) Even better: MATLAB can do everything in one go. If you recall from class, diagonalizing a matrix A means finding a diagonal matrix D and an invertible matrix P with A = PDP−1. The diagonal matrix D contains the eigenvalues along the diagonal and the matrix P contains eigenvectors as columns, with column j of P corresponding to the eigenvalue in column j of D.
To do this we use the eig command again but demand different output. The format is:
>> [P,D]=eig(A)
which assigns P and D for A, if possible. If it’s not possible MATLAB returns very strange-looking output.
(f) We can compute the dot product of two vectors using the command dot. For example: >> dot([1;2;4],[-2;1;5])
(g) We can find the length of a vector from the basic definition. If v is a vector then: >> sqrt(dot(v,v))
(h) Or we can just use the norm command:
>> norm(v)
(i) To get the transpose of a matrix A we do:
>> transpose(A) or
>> A’
(j) To find the rank of a matrix A we do
>> rank(A)
(k) When A is a matrix with linearly independent columns, the command
>> [Q,R]=qr(A,0)
will create and exhibit the matrices Q,R which give the QR factorization of A as defined in the text of Lay.
(l) MATLAB lets you define vectors and submatrices from matrices. For example, suppose A is an m × n matrix and we enter the commands
>> F=A(1:3,2:4), G = A(1:3, :), H = A(:,2)
Then F is the 3 × 3 matrix built from entries of A in rows 1-3 and columns 2-4; G is the 3 × n matrix built out of the first 3 rows; and H is 1 × n matrix (column vector) which equals column 2 of A.
(m) If you already have a coefficient matrix A and a vector b stored in MATLAB, then you can form the augmented matrix M of the system Ax = b with the command
>> M = [A b]
This is useful when finding least-squares solutions. We can form the augmented matrix of the system of normal equations ATAx = ATb with the command
>> N = [A’*A A’*b]

Directions:
Previous guidelines on format hold. Please review them if you forget them. For this project, do all problems in format short.
As before, a question part marked with a star ⋆ indicates the answer should be typed into your output as a comment – the question isn’t asking for MATLAB output.


1. Let .
(a) Compute rankA.
(b) ⋆ Use the rank to determine the values dim(NulA),dim(ColA), and dim(RowA).
(c) Compute rref(A) and use it to give a basis for
i. NulA
ii. ColA
iii. RowA
2. Consider the polynomials
p1(t) = 1 − t + t2 + 2t3, p2(t) = 1 + 2t + 3t2 + t3, p3(t) = 3 + 5t2 + 5t3, p4(t) = 3 + 3t + 7t2 + 4t3, p5(t) = 5 + t + 8t2 − 3t3,
which are all elements of the vector space P3. We shall investigate the subspace
W = Span{p1(t), p2(t), p3(t), p4(t), p5(t)}.
(a) Let vi = [pi(t)]E, the coordinate vector of pi(t) relative to the basis E = {1,t,t2,t3} for P3. Enter these coordinate vectors into MATLAB as v1, v2, v3, v4, v5.
(b) Let A be the matrix v2 v . Observe that Span{v1,v2,v3,v4,v5} = Col(A). Use this fact to compute a basis for Span{v1,v2,v3,v4,v5}. (Recall you can enter A into MATLAB as A = [v1 v2 v3 v4 v5].)
(c) ⋆ Translate your previous answer into a basis for W (consisting of polynomials). What is dimW?
(d) ⋆ Is W = P3? Justify your answer.
3. Consider the following four matrices from the vector space M2×3 of all 2 × 3 matrices:
.
(a) Let vi denote the coordinate vector [Ai]E relative to the basis
.
Enter the coordinate vectors for A1,A2,A3,A4 into MATLAB.
(b) Use MATLAB to show that the coordinate vectors v1,v2,v3,v4 are linearly dependent.
(c) ⋆ Express one of the matrices Ai as a linear combination of the other three. (Hint: first do the same for the coordinate vectors.)
4. Let .
(a) Execute the command [P,D] = eig(A) to diagonalize A.
(b) Use MATLAB to verify that A = PDP−1.
(c) ⋆ Use the previous results to give the eigenvalues of A, and give an eigenvector for each eigenvalue.
(d) MATLAB produces eigenvectors in such a way that they have length 1. A consequence is thatthe entries look a little messy. The eigenvectors in this example can all be rescaled so that their entries are all single digit integers. Do this rescaling to give nicer looking eigenvectors. (Hint: try multiplying each vector by its largest denominator and then divide by the smallest thing you see.)
(e) Enter your rescaled eigenvectors as the columns of a matrix Q. Then verify that A = QDQ−1. (Any basis of eigenvectors can be used to diagonalize a matrix.)
5. Let .
(a) Execute the command [P,D]=eig(A). Something strange should occur in the output.
(b) Use MATLAB to try see if A = PDP−1.
(c) Find a basis for the eigenspace of A corresponding to the eigenvalue λ = 3.
(d) ⋆ Is there a basis for R2 consisting of eigenvectors for A? Does this explain why something went wrong in part (b)? (There is a relevant theorem in §5.3.)
6. Let .
(a) Use MATLAB to compute An for n = 2,3,4,5,6,7,8. Do you notice a pattern?
(b) Have MATLAB produce an invertible P and a diagonal D such that A = PDP−1. Notice that complex numbers get involved.
(c) ⋆ To understand An, it suffices to understand Dn because An = PDnP−1. Describe the pattern that emerges when we consider powers of D: D,D2,D3,D4,etc.
(d) ⋆ Without doing a computation in MATLAB, determine A10000001
 1
7. Let A =  02 
−1 2
3
0
−2 0  3 .
5 
−1
(a) Enter A into MATLAB and use MATLAB to compute the dot product of the first column of A with its second column. Also compute the dot product of the third column with itself. (See guide for how to extract a column from a matrix.) (b) Compute the matrix product ATA.
(c) ⋆ What is the relationship between the entries of ATA and the dot products of the columns of A? Make sure your answer is consistent with your computations.
(d) ⋆ What in general is the relationship between the entries of AAT and dot products of vectors associated to A?
(e) Compute AAT and do at least two dot product computations to support your previous answer.
(f) Let . Do a single matrix computation which shows that the
columns of form an orthonormal set.
(g) ⋆ Explain carefully why your computation above shows that the columns form an orthonormal set.
(h) ⋆ Explain why the rows of Q must also form an orthonormal set.
8. Let W be the subspace of R5 given by
W = Span
(a) Enter the four vectors into MATLAB as v1,v2,v3 and v4 respectively.
(b) Let A = [v1 v2 v3 v4]. Compute the rank of this matrix. Explain briefly in a comment why this shows that this set of four vectors is a basis for W.
(c) We shall apply the Gram-Schmidt Process to produce an orthogonal basis {w1,w2,w3,w4} for W. To begin, let w1 = v1 and w2 = v2 - (dot(w1,v2)/dot(w1,w1))*w1.
(d) Continue the Gram-Schmidt Process and compute w3 and w4.
(e) Rescale each vector of the orthogonal basis {w1,w2,w3,w4} to produce an orthonormal basis {u1,u2,u3,u4} for W. (Recall there is a command in MATLAB to compute the norm of a vector.)
(f) Enter the vectors u1,u2,u3,u4 into the columns of a matrix Q. Verify that the columns of Q are orthonormal with a single matrix multiplication.
(g) Compute R = QTA. Verify that R is upper triangular with positive diagonal entries and that
A = QR.
(h) MATLAB can compute a QR factorization in a single command. Enter [Q1, R1] = qr(A,0). Notice that there is a small discrepancy between your Q, R and the Q1, R1 produced by MATLAB. This is because QR factorizations are not unique. They are only unique if we insist that the diagonal entries of R are all positive. Nonetheless, the columns of Q1 still form an orthonormal basis for W.

More products