Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Math 170A, Fall 2022

Midterm Review / Practice

Q1.    a) Does the matrix

A =  l  

  4   1   4

have an LU factorization? If so, compute it. If not, explain why not.

b) Does the matrix

B =  l  

    3       0   1

have an LU factorization? If so, compute it. If not, explain why not. Q2. Compute the PLU factorization for the matrix

A =  l  

    4   4       0

Q3. Determine if the following matrix is positive definite and symmetric:

\

(               ) .

Q4.    a) Let || · ||  :  R3    →  R be the function given by

||x|| = 5 · |x1 | + 3 · |x2 | + 1 · |x3 | ,

where x = (x1 ,x2 ,x3 )T . Is || · || a norm?

b) Repeat the above but this time with the function ||x|| = 5 · |x1 + x2 | + |x3 | .

Q5. An experiment has produced the following four points of 2-dimensional data:  (−3, 1),

(−1, 0), (1, 2), and (2, 4).

a)  Set up a least squares problem for the best line fit for this set of points, explicitly writing out the matrix A and the vector b.

b)  Set up a least squares problem for the best quadratic fit for this set of points, explicitly writing out the matrix A and the vector b.

Q6. Show the following facts about orthogonal matrices.

(a) The product of two orthogonal matrices is orthogonal.

(b) The absolute value of the determinant of an orthogonal matrix is 1.

Q7.    a) Find a reflector Q that maps the vector x = [3, 4, 1, 3, 1]T to a multiple of the first

column of the 5 × 5 identity, e1 .

Compute Q by writing it as

uuT 

Q = I 2

for some appropriate u, and write it explicitly as a completely assembled matrix. We will call this sort of expression that is dependent on u the short” form for Q.

b) Let a = [0, 2, 1, −1, 0]T . Calculate Qa in two different ways: by using the short” form for Q you found in part a) (using vector-vector, rather than matrix-vector, multiplication),  and by using the  assembled matrix  Q.   (The  answers should match.)

Q8.  (This is similar to Exercise 3.3.7 from the textbook)

Work out the following problem by hand.

Consider the overdetermined system

[1(1) ] [x] = [5(9) ]

Calculate a full QR decomposition of the coefficient matrix, where Q is 2 × 2 and R is 2 × 1.  Use this QR decomposition to calculate the least squares solution (the minimizer). Use the formulas given in lecture or textbook to calculate the norm of the residual with the help of Q (the minimum).

Q9. Compute the reduced QR decomposition of the matrix with columns a1  = [1, 0, −1, 0]T ,

a2  = [1, 3, 5, 3]T , a3  = [3, 3, 1, 1]T , once by using the classical Gram-Schmidt process, and then again by using the modified Gram-Schmidt process.  (Both have to be done by hand). Note: you should get the same Q and R!

Q10. Find the full QR decomposition for A and use it to find the minimizer x and the

minimum value that solve the least squares problem minR ||b − Ax||2 , with

a) A = [1(2) ] and b = [1(4) ].

b)  A =  l 0(1) 

 1 

and b =  l 2(2) 

0

Q11. Find the QR decomposition of A =  [1(1)   2(3) ] with the help of Householder reflectors.

Check it against finding the same with Gram-Schmidt (use whichever one of classical and modified you feel more comfortable with).

Q12. Consider the following simple MATLAB function.

a)  Calculate exactly the number of flops it performs as a function of n.  You may assume that taking a square root is a single flop.

b) Explain what the output is in terms of the input.

function unknown  = mysteryfunction(n)

x  =  ones(n,1);      y  =  zeros(n);      unknown  =  eye(n) ;

x(1)  =  x(1)  -  sqrt(n);

prod  =  0;

for  i=1:n

prod  = prod  +  (x(i))2 ;

end

for  i=1:n

for  j  =  1:n

y(i,j)  =  x(i)*x(j)/prod;

unknown(i,j)  = unknown(i,j)  -  2*y(i,j);

end

end