QR Decomposition Calculator
Factor a matrix into Q R (orthogonal × upper-triangular).
About this tool
Enter a matrix to factor it into an orthogonal Q and an upper triangular R. For [3 4; 4 −3], Q is [0.6 0.8; 0.8 −0.6] and R is [5 0; 0 5].
How to use
How it works
The columns of Q are orthonormal, built from the columns of A, and R holds the coefficients that rebuild A from them, so A = QR. QR is the standard route to least squares fits and to the QR algorithm for eigenvalues.
A = QR QᵀQ = I R is upper triangular
Worked example
Column lengths of 5
- Input
- [3 4; 4 −3]
- Output
- Q = [0.6 0.8; 0.8 −0.6], R = [5 0; 0 5]
- Walkthrough
- Column 1 is (3, 4) with length 5, so the first Q column is (0.6, 0.8) and R₁₁ = 5. Column 2 (4, −3) is perpendicular to it and also has length 5.
Limitations
- Entries must be real numbers; complex entries are refused.
- For a tall m×n matrix the Q returned is the full m×m orthogonal matrix and R is m×n, so the extra rows of R are zero.
- Signs of Q and R columns can differ between software packages.
Questions
What is the QR decomposition of [3 4; 4 −3]?
What is R for [1 1; 1 2; 1 3]?
What does orthogonal mean for Q?
Features
- Orthonormal Q
- Tall matrices
- Runs in your browser
Related resources
Guides and videos from around the web—opens on YouTube or the publisher’s site.
Rectangle area as product of dimensions
Khan Academy
Foundational area thinking across math tools.
Watch on YouTubeDerivative as a concept
Khan Academy
When general calculators hand off to calculus tools.
Watch on YouTube
- OpenStax Math
OpenStax
Free textbooks for algebra through calculus.
- Euler's Number (e)
Math is Fun
e for exponential and scientific calculator keys.