QR Decomposition Calculator
QR decomposition factors a matrix into an orthogonal matrix Q and an upper triangular matrix R such that A = QR, and this calculator computes both via Gram-Schmidt. Q is orthogonal (Qᵀ Q = I), R is upper triangular. Verification included.
QR Decomposition
Gram-Schmidt method: A = QR
QR Decomposition
QR decomposition breaks a matrix A into two simpler matrices: Q, an orthogonal matrix (its columns are perpendicular unit vectors), and R, an upper triangular matrix. Together, A = QR.
How It's Calculated
This calculator uses the Gram-Schmidt process: it takes the columns of A one at a time and turns them into a set of perpendicular unit-length vectors — these become the columns of Q. R is then found from how the original columns relate to these new perpendicular ones.
Worked Example (2×2)
For A = [[1,1],[0,1]]: the first column becomes the unit vector (1,0) for Q. The second column, made perpendicular to the first, becomes (0,1). So Q = [[1,0],[0,1]] and R = [[1,1],[0,1]], and multiplying Q by R gives back the original A.
Applications
- Solving least-squares problems (finding the best-fit line or curve through data)
- Computing eigenvalues numerically (the QR algorithm)
- Signal processing and computer graphics
Frequently Asked Questions
Related Calculators
- Gram-Schmidt Calculator — the method used to compute Q
- LU Decomposition Calculator — an alternative, often faster decomposition