This problem is pledged! You may not discuss this with anyone but

CAAM 553
Homework 9 solutions
(1) (40 points) This problem is pledged! You may not discuss this with anyone but your
instructor. You may not consult any source other than Prof. Embree’s lecture notes,
your class notes, or the textbook to help you with the problem.
You are to write the following two Matlab codes which shall be used to solve Ax = b
for a given non-singular n by n matrix A and n-vector b .
a) 20 pts Use the routines House and ApplyHouse from Homework 8 to construct the
Householder QR factorization of A. Your code for computing the QR factorization
in product form should have the following calling sequence:
function [QR,tau] = QRfac(A);
%
% Input:
A - an n by n matrix
%
% Output: QR - The Householder QR factorization
%
in product form. QR can overwrite A.
%
%
tau - A vector of length n containing
%
"pivot" information
%
% Factors A = QR , where A is m by n
% Q’Q = I_n, R is m by n upper triangular
%
% The leading n by n block of R is an
% n by n upper triangular matrix R_n
b) 20 pts Use the routine ApplyHouse from Homework 8 to compute c = Q T b by
applying the n-1 Householder transformations held in strict the lower triangle of
the array QR that were used to reduce A to upper triangular form. Then write an
upper triangular solve code segment to solve R x = c where R is held in the
upper triangle of the array QR. Your code should have the following calling sequence:
function [x] = QRsolve(QR,tau,b);
%
% This function will solve Ax = b using the Householder
% QR factorization of the n by n matrix A in product form
% that is contained in the n by n array QR.
%
% The following steps are performed
%
%
1) c = Q’*b
%
%
2) Solve
Rx = c
%
% so that Ax = b.
%
% Input:
QR - The Householder QR factorization of the matrix A
%
in product form computed by QRfac.
1
2
%
%
%
%
%
%
%
%
%
%
%
%
tau -
A vector of "pivot" information from the QR
factorization computed by QRfac
b
-
The right hand side vector b (of length n)
x
-
The solution vector of the system Ax = b
Output:
You are to test your codes for correctness using the following script:
n = 500;
A = randn(n);
x = ones(n,1);
b = A*x;
[QR,tau] = QRfac(A);
[xhat] = QRsolve(QR,tau,b);
format short e
Diff = norm(xhat - x)/norm(x)
The number Diff should be on the order of 10−14 or less.
You are to turn in a listing of your codes QRfac and QRsolve and a print out (use
diary) of the above test and its result.
If you were unable to give a correct coding of House and ApplyHouse from Homework
8, please use the codes given in the Solution Set for that exercise.
Soln: See HW9 prob3.m.
3
(2) (30 points) Assume the matrix A ∈ Rm×n is rank r. Define κ(A) = σ1 /σr .
a) Show that κ(A) ≥ 1, and characterize what kind of matrix A is if κ(A) = 1 and
r = n.
Soln: Since σ1 ≥ σ2 ≥ . . . σr ≥ 0 . . ., σ1 /σr ≥ 1. If r = n and κ(A) = 1, then
σ1 = σ2 = . . . = σn , and
A = U SV ∗ = Un V
where Un are the first n columns of U . Since these columns are orthonormal, A is
subunitary, since A∗ A = V ∗ Un∗ Un V ∗ = I.
b) Show that for x ∈ Rn and Ax 6= 0,
kAxk
≤ σ1 .
kxk
Soln: The upper bound is shown by noting that
kAxk
kU SV ∗ xk
kU SV ∗ xk
kSyk
=
=
=
∗
∗
kxk
kV xk
kV xk
kyk
by the 2-norm preserving property of unitary matrices. Since S is a diagonal matrix,
X
X
kSyk2 =
(σj yj )2 ≤ σ12
yj2 = σ12 kyk2
σr ≤
j
j
implying the upper bound.
The lower bound can be shown similarly if x ⊥ N (A) such that vj∗ x = 0 for
j = r + 1, . . . , n.
X
X
kSyk2 =
(σj yj )2 ≥ σr2
yj2
j
j
Note: the problem as posted was missing the assumption x ⊥ N (A). No points
will be deducted for this.
c) Let à = A+E, x̃ = x+δx where E, δx are perturbations with norm mach . Bound
the relative error kÃx̃ − Axk/kAxk in terms of κ(A) and the sum of relative errors
in A, x
kà − Ak kx̃ − xk
+
.
˜ =
kAk
kxk
Soln: The error kÃx̃ − Axk is bounded by
kÃx̃ − Axk
kÃx̃ − Ãxk + kÃx − Axk
≤
kAxk
kAxk
kÃkkx̃ − xk kà − Akkxk
+
kAxk
kAxk
kAkkxk
kAk
σ1
≤ ˜
≤ ˜
≤ ˜ .
kAxk
kAxk/kxk
σr
≤
Note: this problem also required the assumption x ⊥ N (A).
4
(3) i. (10 points) Show that if a matrix A is both triangular and unitary, then it is diagonal.
Soln: Without loss of generality assume A lower triangular. Since A is unitary, we
know A∗ A = AA∗ = I. This implies A∗ = A−1 . By definition A∗ is upper triangular
but A−1 is lower triangular. Thus A∗ is diagonal which implies A is diagonal.
ii. (10 points) Prove that if A = LLT with L real and nonsingular, then A is symmetric
and positive definite.
Soln: First we will prove that A is symmetric. AT = (LLT )T = LLT = A.
Next we show A is positive definite.
< x, Ax >=< x, LLT x >=< Lx, Lx >= kLxk22 ≥ 0
Note xT Ax = 0 if and only if Lx = 0. Since A is nonsingular, L is nonsingular.
Thus xT Ax = 0 if and only if x = 0. Therefore A is positive definite.