Let \(A\) be an \(m \times n\) matrix (\(m \ge n\)) of full column rank, and suppose \(A = QR\) is its reduced QR factorization. The columns of \(Q\) form an orthonormal basis for which of the following subspaces?
A. The row space of \(A\)
B. The column space of \(A\)
C. The null space of \(A\)
D. The orthogonal complement of the column space of \(A\)
Nonsingular equations with QR
Given \(n\times n\) matrix \(A\), full rank, solve \[
A x = b
\] solve by QR factorization \(A = QR\) and \(Q\T Q = I\)
mathematically
\[
x = A^{-1}b = (QR)^{-1}b = R^{-1}Q^{-1}b = R^{-1}Q\T b
\]
computationally
usingLinearAlgebraQ, R =qr(A) # O(n^3) <-- dominant costy = Q'b # O(n^2) <-- matrix-vector multiply x = R \ y # O(n^2) <-- triangular solve
where (1) is minimized when \(\hat Rx=\hat Q\T b\) and (2) is constant
Question: Least-Squares and Orthogonal Projections
Consider the least-squares problem \[
\min_{x \in \mathbb{R}^n} \|A x - b\|,
\] Let \(A = QR\) and \(c = Q^T b\). Which of the following best describes the meaning of c$?
A. \(c\) is the orthogonal projection of \(b\) in the original space.
B. \(c\) is the coordinate vector of the projection of \(b\) onto the column space of \(Q\).
C. \(c\) is orthogonal to every column of \(Q\).
D. \(c\) has no geometric interpretation for the least-squares problem.
Solving Least-Squares via QR
\[
\min_{x\in\Rn}\ \|Ax-b\|^2, \qquad A = QR
\]
mathematically
\[
\begin{align}
A\T A x &= A\T b \\
R\T Q\T Q R x &= R\T Q\T b \\
Rx &= Q\T b\\
x &= R^{-1}Q\T b
\end{align}
\]
computationally
usingLinearAlgebraF =qr(A) # O(n^3) <-- dominant costQ, R =Matrix(F.Q), F.R # extract _thin_ Q, and Ry = Q'b # O(n^2) <-- matrix-vector multiplyx = R \ y # O(n^2) <-- triangular solve
more numerically stable than solving \(A\T Ax = A\T b\) directly
Question: Geometric Interpretation of \(R\)
In the factorization \(A = QR\), with \(Q\) having orthonormal columns, what is the geometric interpretation of the triangular matrix \(R\)?
\(R\) is an orthogonal matrix that preserves angles and lengths.
\(R\) describes how the columns of \(A\) can be expressed as linear combinations of the columns of \(Q\), capturing their coordinates in the orthonormal basis.
\(R\) is the null-space basis of \(A\).
\(R\) is a diagonal matrix containing the singular values of \(A\).
Accuracy of QR vs Normal Equations
For \(\epsilon\) positive, this matrix has full rank because \(\sin^2(\theta)+\cos^2(\theta)=1\)\[ A =
\begin{bmatrix}
sin^2(\theta_1) & cos^2(\theta_1+\epsilon) & 1 \\
sin^2(\theta_2) & cos^2(\theta_2+\epsilon) & 1 \\
\vdots & \vdots & \vdots \\
sin^2(\theta_m) & cos^2(\theta_m+\epsilon) & 1 \\
\end{bmatrix}
\]
usingLinearAlgebraθ =LinRange(0,3,400)ε =1e-7A = @. [sin(θ)^2cos(θ+ε)^2 θ^0]xᵉ = [1., 2., 1.]b = A*xᵉxn = A'A \ A'b # Compute xn via normal equationsQ, R =qr(A); Q =Matrix(Q) # Compute xr via QRxr = R \ (Q'b)xb = A \ b # Compute xb via backslash@show xn xr xb;