QR Decomposition Formulas
For an m × n input with m ≥ n, this calculator returns the thin QR decomposition: Q is m × n, R is n × n, and A = QR.
Householder reflector
Hₖ = I − 2vₖvₖᵀThe unit vector vₖ is chosen so the reflector maps the active column onto a coordinate axis.
Orthogonality
QᵀQ = IEach reflector is symmetric and orthogonal, so their product is orthogonal too.
Factorization
R = Hₚ⋯H₂H₁ABecause every Hₖ⁻¹ = Hₖ, the corresponding columns of Q = H₁H₂⋯Hₚ reconstruct A.
How to Use the QR Calculator
- Select the row and column counts. Use at least as many rows as columns.
- Enter matrix A in the grid, or paste the matrix one row per line.
- Select Calculate QR. Read Q, R, the estimated rank, and each reflection below.
- Use the error checks to assess floating-point accuracy, then copy or download the result if needed.
Worked QR Example
The loaded example is A = [[12, −51, 4], [6, 167, −68], [−4, 24, −41]]. Its factors are approximately:
Q
[[−0.85714, 0.39429, −0.33143], [−0.42857, −0.90286, 0.03429], [0.28571, −0.17143, −0.94286]]R
[[−14, −21, 14], [0, −175, 70], [0, 0, 35]]Multiplying these rounded displays gives approximately A; the calculator verifies the full-precision factors before display rounding.
When QR Decomposition Is Useful
Least-squares problems
For a full-rank tall matrix, solve Rx = Qᵀb without forming the less stable normal-equation matrix AᵀA.
Orthonormal bases
The columns of Q give orthonormal directions spanning the column space when A has full column rank.
Eigenvalue algorithms
Repeated QR factorizations are a foundation of the QR algorithm for approximating eigenvalues.
QR Decomposition FAQs
What is QR decomposition?
It factors A into Q, whose columns are mutually orthogonal unit vectors, and an upper-triangular R such that A = QR.
Can I enter a rectangular matrix?
Yes. This calculator accepts tall matrices and square matrices, from 2 through 8 rows, as long as the number of columns does not exceed the rows.
What happens when the matrix is rank deficient?
The decomposition still exists. The calculator reports a lower estimated rank and one or more diagonal entries of R will be zero or numerically small. Some columns of thin Q then complete an orthonormal set rather than uniquely describing the column space.
Why are my Q or R signs different from another answer?
Both answers may be correct. Negating one column of Q and the corresponding row of R does not change their product.
Why does the calculator use Householder reflections?
They zero a complete column segment at each step and generally maintain orthogonality better in floating-point arithmetic than classical Gram–Schmidt.
What size are Q and R?
This page shows a thin factorization. For an m × n matrix, Q is m × n and R is n × n.
Are my matrix values private?
Yes. The calculations, clipboard text, and downloaded file are created in your browser. This page does not send or save your entries.
Calculation Notes
Last reviewed: August 5, 2026 by the Starlight Tools editorial team.
Inputs use JavaScript double-precision arithmetic and must be zero or have magnitude from 10⁻¹⁰⁰ through 10¹⁰⁰. Rank is estimated from the diagonal of R relative to the input scale. Severely ill-conditioned matrices may need higher-precision numerical software.
