Built and fact-checked by the DocNectar team — see our editorial standards
Key Features
Instant Calculation
Get accurate results in real time with our optimized algorithm.
Mobile Friendly
Fully responsive design. Works on all devices & screen sizes.
Privacy Focused
Your data stays on your device. We don't store any inputs.
100% Free
No hidden costs. This tool is completely free forever.
QR decomposition factors any matrix A into the product of an orthogonal matrix Q (QᵀQ = I) and an upper triangular matrix R, such that A = QR. It's a foundational building block for solving least-squares problems, computing eigenvalues (via the QR algorithm), and orthogonalizing a set of vectors.
This calculator uses Householder reflections — the standard, numerically stable method — to compute Q and R for any square matrix up to 6×6.
How it works
Enter a square matrix. The tool applies a sequence of Householder reflections, each one zeroing out the entries below the diagonal in one column, building up R directly and accumulating the reflections into Q.
- Click Calculate to see your results.
Examples
A textbook 3×3 example
For A = [[12,-51,4],[6,167,-68],[-4,24,-41]], QR decomposition gives an orthogonal Q and upper triangular R such that Q·R reconstructs A exactly.
Who should use it
- Solving least-squares regression problems.
- As a step toward computing eigenvalues via the QR algorithm.
Industry applications
- Numerical linear algebra and scientific computing
- Statistics (least-squares regression)
Advantages
- Numerically stable for a wide range of matrices, including nearly-singular ones.
- A genuine building block used inside eigenvalue algorithms, not just a standalone factorization.
Limitations
- More computationally involved than simpler decompositions like LU, though this is invisible to you as the calculator handles it.
Common mistakes to avoid
- Assuming Q and R are unique — signs of columns in Q (and corresponding rows in R) can differ between valid QR decompositions of the same matrix, depending on convention.
Best practices
- Verify a QR decomposition by checking that Q·R reconstructs your original matrix and that QᵀQ is (numerically) the identity matrix.
Tips
- If you need eigenvalues rather than a QR factorization itself, use the Eigenvalues Calculator (General Matrix) or Schur Decomposition Calculator, which apply QR decomposition internally as part of an iterative algorithm.