QR Decomposition Calculator
Factor a 2 by 2 matrix into orthogonal Q and upper triangular R matrices.
About QR decomposition
QR decomposition examples
| Matrix A | Factors | Observation |
|---|---|---|
| [1, 0] [0, 1] | Q = identity, R = identity | The columns are already orthonormal |
| [3, 0] [4, 5] | Q = [0.6, -0.8] [0.8, 0.6], R = [5, 4] [0, 3] | Gram-Schmidt separates length and direction |
| [1, 1] [1, -1] | Q approximately [0.707107, 0.707107] [0.707107, -0.707107] | The input columns are perpendicular but not normalized |
How to calculate a QR decomposition
- Enter all four entries of matrix A in their labeled row and column positions.
- Confirm that the two columns are not zero or scalar multiples of each other.
- Select Calculate QR decomposition to apply the Gram-Schmidt process.
- Read Q by rows, read R by rows, and multiply them to check the factorization.
Frequently asked questions
What do Q and R represent?
Q contains orthonormal column vectors that describe directions. R is upper triangular and records the lengths and projection coefficients needed to reconstruct the original matrix.
Why must the columns be independent?
Gram-Schmidt needs a nonzero perpendicular remainder for every new Q column. Dependent columns make that remainder zero, so a full two-column orthonormal basis cannot be formed this way.
Is QR decomposition unique?
Sign choices can produce equivalent decompositions because matching signs in Q and R cancel in their product. Requiring nonnegative diagonal entries in R provides a common uniqueness convention.
How can I verify the result?
Multiply Q by R and compare each entry with the original matrix A. You can also check that Q transposed times Q equals the identity matrix.
What is QR decomposition used for?
It is widely used for least-squares problems, eigenvalue algorithms, and stable equation solving. Orthogonal matrices help control numerical error during those calculations.