QR Decomposition and Gram-Schmidt
Turn any basis into an orthonormal one by subtracting the part that already points the wrong way. Watch the subtraction happen.
QR Decomposition and Gram-Schmidt
This module needs JavaScript: the numbers are computed in the page rather than recorded.
Worth knowing
A = QR: Q holds an orthonormal basis for the columns of A, R holds the coefficients that rebuild them.Overview
What Q and R contain
For a real matrix A, QR factorisation writes A = QR. The columns of Q are orthonormal; R is upper triangular. For a full-column-rank matrix, the reduced factorisation keeps only the columns needed for its column space. Signs of paired columns in Q and rows in R may vary while their product stays the same.
To solve a least-squares problem min‖Ax − b‖₂, substitute A = QR. Since QᵀQ = I, solve the triangular system Rx = Qᵀb. This avoids forming AᵀA, which can worsen conditioning. See projections for the geometric view and matrix multiplication for the products involved.
What Q and R contain
For a real matrix A, QR factorisation writes A = QR. The columns of Q are orthonormal; R is upper triangular. For a full-column-rank matrix, the reduced factorisation keeps only the columns needed for its column space. Signs of paired columns in Q and rows in R may vary while their product stays the same.
To solve a least-squares problem min‖Ax − b‖₂, substitute A = QR. Since QᵀQ = I, solve the triangular system Rx = Qᵀb. This avoids forming AᵀA, which can worsen conditioning. See projections for the geometric view and matrix multiplication for the products involved.