Inferensys

Glossary

QR Decomposition (QRD)

QR decomposition (QRD) is a matrix factorization technique that decomposes a matrix A into the product of an orthogonal matrix Q and an upper triangular matrix R (A = QR), used to solve linear least squares problems with high numerical stability.
Wide-angle shot of a modern WeWork open floor plan with creative walls covered in AI system architecture diagrams, product team collaborating in standing desk area with industrial lighting.
MATRIX FACTORIZATION

What is QR Decomposition (QRD)?

QR Decomposition is a matrix factorization technique that decomposes a matrix into an orthogonal matrix Q and an upper triangular matrix R, used to solve linear least squares problems with high numerical stability.

QR Decomposition (QRD) is a matrix factorization that expresses a matrix A as the product of an orthogonal matrix Q and an upper triangular matrix R (A = QR). This decomposition is a cornerstone of numerical linear algebra, providing a numerically stable method for solving linear least squares problems without explicitly forming the normal equations, which squares the condition number and amplifies rounding errors.

In adaptive filtering and Digital Pre-Distortion (DPD) coefficient estimation, QRD is implemented recursively via Givens rotations to update the triangular factor R directly. This approach avoids the numerical instability of the Recursive Least Squares (RLS) algorithm when processing highly correlated input signals, making it the preferred method for real-time parameter extraction in embedded systems where precision is critical.

NUMERICAL LINEAR ALGEBRA

Key Properties of QR Decomposition

QR Decomposition (QRD) factorizes a matrix A into an orthogonal matrix Q and an upper triangular matrix R. This structure provides a numerically stable foundation for solving linear least squares problems, making it a cornerstone algorithm for coefficient estimation in digital predistortion systems.

01

Numerical Stability via Orthogonalization

Unlike solving the Normal Equation directly, QRD avoids squaring the condition number of the data matrix. By operating on the original matrix A using orthogonal transformations, it prevents the amplification of rounding errors. This is critical for ill-conditioned correlation matrices common in wideband DPD where signal bandwidths are large and memory depth is high.

  • Condition Number Preservation: The condition number of R equals that of A.
  • No Explicit Matrix Inversion: The upper triangular structure of R allows solution via simple back-substitution.
02

Solving the Least Squares Problem

QR decomposition transforms the overdetermined system Ax ≈ b into an equivalent, easily solvable form. By applying the transpose of Q to both sides, the problem reduces to solving Rx = Qᵀb. Since R is upper triangular, the optimal coefficient vector x is found through efficient back-substitution.

  • Minimizes ||Ax - b||²: Directly solves the minimization problem without forming the normal equations.
  • Residual Analysis: The bottom rows of Qᵀb directly provide the least squares residual norm.
03

Computation via Householder Reflections

The most common method for computing QRD in practice uses Householder reflections. These are elementary orthogonal transformations that zero out all elements below the diagonal of a column vector in a single step. This method is preferred over Gram-Schmidt for its superior numerical stability on finite-precision hardware.

  • Block Operations: Householder vectors can be aggregated to apply transformations in matrix-matrix operations, maximizing cache efficiency on DSPs.
  • Compact Storage: The reflection vectors can be stored in the lower triangular part of the original matrix, saving memory.
04

Givens Rotations for Adaptive Updates

Givens rotations provide an alternative method for computing QRD by zeroing out matrix elements one at a time. While less efficient for batch computation, they are the fundamental building block for the QR-RLS adaptive algorithm. Givens rotations allow the triangular factor R to be updated directly when new data rows arrive, without recomputing the entire decomposition.

  • Selective Zeroing: Targets specific matrix elements for elimination.
  • Pipelined Hardware: The regular, rotation-based structure is highly amenable to systolic array implementation on FPGAs.
05

Relationship to the Gram Matrix

The upper triangular matrix R in QRD is mathematically equivalent to the Cholesky factor of the Gram matrix AᵀA. This connection reveals why QRD is superior: it computes the Cholesky factor directly from A without explicitly forming the product AᵀA, an operation that squares the condition number and introduces numerical instability.

  • AᵀA = RᵀR: The Gram matrix is the product of the transpose of R and R.
  • Square-Root Algorithm: QRD is often called a "square-root" method because it works on the data matrix directly, analogous to taking the square root of the correlation matrix.
06

Rank Revelation and Regularization

Column pivoting can be integrated into the QRD process to handle rank-deficient or near-rank-deficient matrices. By reordering columns based on their norm, the algorithm produces a factorization where the diagonal elements of R are non-increasing. This reveals the numerical rank and allows for effective regularization by truncating small diagonal elements, preventing overfitting in coefficient extraction.

  • Diagonal Inspection: The magnitude of diagonal entries of R indicates linear independence of basis functions.
  • Truncated SVD Alternative: Provides a computationally cheaper alternative to full SVD for regularization.
NUMERICAL STABILITY COMPARISON

QR Decomposition vs. Normal Equations for Least Squares

A comparison of two methods for solving the linear least squares problem for DPD coefficient extraction, highlighting trade-offs in numerical stability, computational cost, and conditioning.

FeatureQR DecompositionNormal EquationsSVD

Methodology

Factorizes design matrix A into orthogonal Q and upper triangular R; solves Rx = Qᵀb

Solves AᵀAx = Aᵀb directly by forming and inverting the Gram matrix

Factorizes A into UΣVᵀ; solves using pseudoinverse

Squares Condition Number

κ(A)

κ(A)²

κ(A)

Numerical Stability

High

Low

Very High

Handles Rank Deficiency

Operation Count (m×n)

~2mn² flops

~mn² + n³/3 flops

~4mn² + 8n³ flops

Susceptibility to Round-off Error

Low

High

Very Low

Preferred for Ill-Conditioned Matrices

Typical DPD Application

Standard batch extraction with moderate condition numbers

Rapid prototyping; avoided in production

Diagnosing ill-conditioning and rank deficiency

QR DECOMPOSITION INSIGHTS

Frequently Asked Questions

Explore the core mechanics and practical applications of QR decomposition in solving linear least squares problems for digital predistortion coefficient estimation.

QR decomposition (QRD) is a matrix factorization technique that decomposes a matrix A into the product of an orthogonal matrix Q and an upper triangular matrix R. The 'orthogonal' property of Q means its transpose equals its inverse, which preserves the Euclidean norm of vectors. The algorithm works by applying a sequence of orthogonal transformations—typically Householder reflections or Givens rotations—to systematically zero out the elements below the main diagonal of A. This process effectively isolates the triangular structure in R while capturing the transformation history in Q. For a system Ax = b, this factorization allows the least squares solution to be computed by solving the triangular system Rx = Qᵀb via simple back-substitution, avoiding the numerical instability of directly inverting the normal equations.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.