QR Decomposition

2 min read Last updated Mon May 25 2026 17:16:27 GMT+0000 (Coordinated Universal Time)

The process of decomposing a matrix AA into Am×n=QRA_{m\times n}=QR where

  • Qm×nQ_{m\times n} is orthonormal (via Gram–Schmidt)
  • Rn×nR_{n\times n} is upper triangular

Used for solving linear least squares problem and iterative eigenvalue algorithms.

For Square Matrix

If AA is a n×nn\times n square matrix, both QQ and RR are square matrices of size nn.

If AA is complex, QQ is a unitary matrix.

If AA has nn linearly independent columns, then first nn columns of QQ form an orthonormal basis for the column space of AA.

For Rectangular Matrix

If AA is a m×nm\times n rectangular matrix (with mnm \ge n), as the product of m×mm\times m unitary matrix QQ and m×mm\times m upper triangular matrix RR where as the mnm-n bottom rows to be fully zeros.

Calculation

  • Apply Gram-Schmidit Orthogonalization to the columns of AA
  • The orthonormal set of matrices are the columns of QQ
  • R=QTAR=Q^{T}A (if AA is real) or R=QHAR = Q^HA (if AA is complex)

Application

Linear Least Solution

For Am×nXn×1=Bm×1A_{m\times n}X_{n\times 1}=B_{m\times 1}. If A=QRA=QR the equation can be converted into RHX=QHBR^{H}X = Q^{H}B which is easy to solve.

QR Algorithm

Suppose AA is a square matrix. And A=A0=Q0R0A = A_0 = Q_0 R_0 be the QR decomposition of AA. Define Rk1Qk1=Ak=QkRkR_{k-1}Q_{k-1} = A_k = Q_k R_k to recursively get AkA_k and its QR decomposition.

Ak=QkRkQkQkH=QkAk+1QkHA_k = Q_k R_k Q_k Q_k^H = Q_k A_{k+1} Q_k^H

By the above relationship, and induction, all AiA_i have the eigenvalue. Under suitable conditions AkA_k approaches a upper triangular matrix, which makes it easy to find the eigenvalues of AA.

Was this helpful?