Since 2010 · Powering 2M+ tool runs every month
Since 2010
Add to Chrome

My Toolbox

Automatic Mode

No saved tools yet.

Go Premium
Related tools
Matrix LU Decomposition CalculatorCholesky Decomposition CalculatorMatrix Diagonalization CalculatorCharacteristic Polynomial CalculatorMatrix Inverse CalculatorMatrix Multiplication CalculatorGram-Schmidt Calculator
Home Page > Math > Linear Algebra

QR Decomposition Calculator

Decompose any matrix into an orthogonal Q and an upper triangular R with the Gram-Schmidt process. Handles 2x2 to 5x5 matrices with animated step-by-step orthogonalization and a check that Q transpose times Q equals the identity.

Free to useNo sign-up requiredInstant Results
QR Decomposition CalculatorTry it now — free ▼
Examples:
Rows: 3
×
Cols: 3
⚠ Rows must ≥ Cols
[
]

Embed QR Decomposition Calculator Widget

About QR Decomposition Calculator

The QR Decomposition Calculator factors any matrix A into the product of an orthogonal matrix Q and an upper triangular matrix R, so that A = QR. Enter a 2×2 to 5×5 matrix (including non-square matrices where rows ≥ columns) and get the complete Gram-Schmidt orthogonalization with step-by-step solutions, interactive animation, orthogonality verification QᵀQ = I, and detailed educational insights.

What Is QR Decomposition?

QR decomposition (also called QR factorization) writes a matrix A as:

$$A = QR$$

where Q is an orthogonal matrix (its columns are orthonormal vectors satisfying QᵀQ = I), and R is an upper triangular matrix. For an m×n matrix with m ≥ n and full column rank, the reduced QR gives Q as m×n and R as n×n.

Q
Orthogonal Matrix Q
Columns are orthonormal: unit length and mutually perpendicular. QᵀQ = I.
Upper Triangular R
All entries below the diagonal are zero. Diagonal entries are the norms from Gram-Schmidt.
Gram-Schmidt Process
Iteratively orthogonalizes columns by subtracting projections, then normalizes.
κ
Numerical Stability
QR is more stable than LU for solving Ax = b because Q preserves vector norms.

The Gram-Schmidt Process Explained

Given column vectors a₁, a₂, …, aₙ of A, the classical Gram-Schmidt algorithm produces orthonormal vectors e₁, e₂, …, eₙ:

Step 1. Set u₁ = a₁, then normalize: e₁ = u₁ / ‖u₁‖.

Step 2. For each subsequent column aⱼ, subtract its projections onto all previous eₖ:

$$\mathbf{u}_j = \mathbf{a}_j - \sum_{k=1}^{j-1} (\mathbf{a}_j \cdot \mathbf{e}_k) \, \mathbf{e}_k$$

Then normalize: eⱼ = uⱼ / ‖uⱼ‖.

Step 3. The Q matrix has e₁, …, eₙ as columns. R is upper triangular with entries rᵢⱼ = eᵢ · aⱼ.

How to Use This Calculator

Step 1. Set the matrix dimensions (rows × columns). Rows must be ≥ columns for QR decomposition.

Step 2. Enter values into the grid, or click a quick example to load a preset. Use Tab or arrow keys to navigate.

Step 3. Click Decompose A = QR. The calculator runs the Gram-Schmidt process and displays Q and R.

Step 4. Watch the Gram-Schmidt animation to see how each column is orthogonalized: original vector → subtract projections → unnormalized result → normalized orthonormal vector.

Step 5. Verify the result: check that QR = A and QᵀQ = I (identity matrix). Step through the full derivation using the step navigator.

Applications of QR Decomposition

ApplicationHow QR Is Used
Least Squares (Ax ≈ b)Solve Rx = Qᵀb by back-substitution — more stable than normal equations AᵀAx = Aᵀb
QR Algorithm for EigenvaluesRepeatedly factor Aₖ = QₖRₖ, then set Aₖ₊₁ = RₖQₖ — converges to Schur form
Linear Systems (Ax = b)Factor A = QR, then solve Rx = Qᵀb. More numerically stable than LU for ill-conditioned systems
Signal ProcessingAdaptive beamforming and MIMO channel estimation use QR updates for real-time processing
Machine LearningQR-based orthogonalization in neural network training, Gram-Schmidt in feature engineering

QR vs. Other Matrix Decompositions

DecompositionFormBest For
QR (this tool)A = QRLeast squares, eigenvalue algorithms, numerically stable solves
LUA = LUFast solves of square systems, determinant computation
CholeskyA = LLᵀSymmetric positive definite systems (fastest)
SVDA = UΣVᵀRank analysis, pseudoinverse, PCA, image compression
EigendecompositionA = PDP⁻¹Matrix powers, differential equations, spectral analysis

Frequently Asked Questions

What is QR decomposition?

QR decomposition factors a matrix A into the product of an orthogonal matrix Q (whose columns are orthonormal) and an upper triangular matrix R. Every real matrix with linearly independent columns has a unique QR factorization when we require R to have positive diagonal entries.

What is the Gram-Schmidt process?

The Gram-Schmidt process is an algorithm that takes a set of linearly independent vectors and produces an orthonormal set spanning the same subspace. It works by iteratively subtracting the projections onto all previously computed orthonormal vectors and then normalizing the residual.

Does QR decomposition work for non-square matrices?

Yes. For an m×n matrix where m ≥ n, the reduced (or thin) QR decomposition gives Q as m×n with orthonormal columns and R as n×n upper triangular. This is the form most commonly used in practice, especially for least squares problems.

When should I use QR instead of LU decomposition?

Use QR when numerical stability matters more than speed — for example, with ill-conditioned matrices, least squares problems, or eigenvalue computation. LU is faster (roughly 2× for square systems) but can amplify rounding errors. QR preserves vector norms because Q is orthogonal.

What is the difference between QR and SVD?

Both produce orthogonal factors, but SVD decomposes A into three matrices (UΣVᵀ) revealing singular values and rank, while QR gives two matrices (QR) and is faster to compute. SVD is preferred for rank-deficient problems and pseudoinverse computation; QR is preferred for solving full-rank systems and eigenvalue algorithms.

Reference this content, page, or tool as:

"QR Decomposition Calculator" at https://MiniWebtool.com/qr-decomposition-calculator/ from MiniWebtool, https://MiniWebtool.com/

by miniwebtool team. Updated: 2026-04-12

You can also try our AI Math Solver GPT to solve your math problems through natural language question and answer.

Linear Algebra:

Top & Updated:

Singular Value Decomposition (SVD) CalculatorPartial Fraction Decomposition CalculatorQR Code GeneratorView all →
Home Page > Math > Linear Algebra > QR Decomposition Calculator