QR Decomposition Calculator

Quick answer

The QR decomposition calculator factors a square matrix with independent columns into Q (orthogonal) times R (upper triangular) with the Gram–Schmidt process.

Result
A = Q·R (Q orthogonal, R upper triangular)
Q (orthogonal)
⎡ 0.872872 −0.120386 −0.472866 ⎤ ⎢ 0.218218 0.963087 0.157622 ⎥ ⎣ 0.436436 −0.240772 0.866921 ⎦
R (upper triangular)
⎡ 4.58258 1.52753 3.92792 ⎤ ⎢ 0 2.76887 −1.44463 ⎥ ⎣ 0 0 3.38887 ⎦

QR decomposition solves least squares problems stably and is the engine of the QR algorithm for eigenvalues. Q holds an orthonormal basis of the column space and R records how to rebuild A from it.

How to use the QR Decomposition Calculator

  1. Choose the matrix size – the matching grid of fields appears.
  2. Enter the entries row by row (a₁ b₁ c₁ is the first row, a₂ b₂ c₂ the second, and so on).
  3. Read the result; integer matrices give exact fractions.

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

How it works

Each column is orthogonalised against the previous ones (modified Gram–Schmidt); the projection coefficients fill R and the normalised vectors form Q.

Formula

A = Q·R, QᵀQ = I, rᵢⱼ = qᵢ · aⱼ

Worked example

Inputs — Matrix size: 3 × 3; a₁: 4; b₁: 1; c₁: 2; a₂: 1; b₂: 3; c₂: 0; a₃: 2; b₃: 0; c₃: 5.
Results — Result = A = Q·R (Q orthogonal, R upper triangular); Q (orthogonal) = ⎡ 0.872872 −0.120386 −0.472866 ⎤
⎢ 0.218218 0.963087 0.157622 ⎥
⎣ 0.436436 −0.240772 0.866921 ⎦; R (upper triangular) = ⎡ 4.58258 1.52753 3.92792 ⎤
⎢ 0 2.76887 −1.44463 ⎥
⎣ 0 0 3.38887 ⎦.

Key terms

Orthogonal matrix
Columns are orthonormal.

Frequently asked questions

What does QR decomposition need?

Linearly independent columns (for a unique R with positive diagonal).

How is it used for least squares?

Solve Rx = Qᵀb instead of the normal equations.

Is Gram–Schmidt the only way?

Householder reflections and Givens rotations are more stable alternatives.

Is Q square?

For a square A, yes; for tall A, the thin Q has the same shape as A.

Sources

  1. Wolfram MathWorld – QR decomposition
  2. MIT OpenCourseWare – 18.06 Linear Algebra (Gilbert Strang)
  3. Jim Hefferon – Linear Algebra (free textbook)

Cite this calculator

Speedy Calculator. (2026). QR Decomposition Calculator. Speedy Calculator. https://speedycalculator.com/calculators/math/qr-decomposition/