Tutorials › Linear Algebra › Reduced QR Factorization And Its Dimensions

Least Squares and QR Factorization · Tutorial 699 of 1000

Reduced QR Factorization And Its Dimensions

See how a tall full-column-rank matrix factors into a matrix with orthonormal columns and a square upper-triangular matrix.

Intermediate 11 min read

What You'll Learn

  • State the dimensions and defining properties of reduced QR factors.
  • Explain why full column rank allows Gram–Schmidt to produce every column of Q.
  • Compute reduced QR factors for exact matrices with two and three columns.
  • Check a factorization by multiplying Q and R and verifying the columns of Q are orthonormal.
  • Distinguish reduced QR dimensions from the dimensions of a full QR factorization.

What “Reduced” Means

A QR factorization expresses a matrix as a product: the letter \(Q\) denotes a matrix whose columns are orthonormal, and \(R\) denotes an upper-triangular matrix. When the original matrix has more rows than columns, choosing the dimensions of these factors matters. In reduced QR, the factor \(Q\) has the same number of columns as the original matrix, and \(R\) is square. This keeps the factorization compact while retaining the original matrix’s shape through the product.

Throughout, the scalars are real. Let \(\mathbf{A}\in\mathbb{R}^{m\times n}\), where \(1\le n\le m\), and write its columns as \(\mathbf{a}_1,\dots,\mathbf{a}_n\). The matrix has full column rank when these columns are linearly independent: the equation \(c_1\mathbf{a}_1+\cdots+c_n\mathbf{a}_n=\mathbf{0}\) then forces every coefficient \(c_j\) to be zero. Two vectors are orthogonal when their dot product is zero, and a list is orthonormal when its vectors are pairwise orthogonal and each has norm \(1\).

Definition: A reduced QR factorization of \(\mathbf{A}\in\mathbb{R}^{m\times n}\) is a factorization \(\mathbf{A}=\mathbf{Q}\mathbf{R}\), where \(\mathbf{Q}\in\mathbb{R}^{m\times n}\) has orthonormal columns and \(\mathbf{R}\in\mathbb{R}^{n\times n}\) is upper triangular. Having orthonormal columns means \(\mathbf{q}_i\cdot\mathbf{q}_j=0\) for \(i\ne j\) and \(\|\mathbf{q}_j\|=1\) for every column. Upper triangular means \(r_{ij}=0\) whenever \(i>j\).

The dimensions make the product possible: an \(m\times n\) matrix multiplied by an \(n\times n\) matrix gives an \(m\times n\) matrix. The triangular shape of \(\mathbf{R}\) records the order in which the columns are built. For a full-column-rank matrix, Gram–Schmidt constructs each new column of \(\mathbf{Q}\) from the corresponding column of \(\mathbf{A}\) after removing its components in earlier directions.

Why Full Column Rank Gives These Factors

The construction uses the dot product and norm in \(\mathbb{R}^m\). At stage \(j\), subtract from \(\mathbf{a}_j\) its projections onto the previously constructed orthonormal columns. The remaining vector is the part not already accounted for by those columns. Full column rank ensures that this remainder is not zero, so it can be normalized to have norm \(1\).

Theorem (Existence of reduced QR for full column rank): If \(\mathbf{A}\in\mathbb{R}^{m\times n}\), \(1\le n\le m\), has full column rank, then it has a reduced QR factorization \(\mathbf{A}=\mathbf{Q}\mathbf{R}\), with \(\mathbf{Q}\in\mathbb{R}^{m\times n}\) having orthonormal columns and \(\mathbf{R}\in\mathbb{R}^{n\times n}\) upper triangular. The Gram–Schmidt construction gives \(r_{jj}>0\) for every \(j\).

Proof. We construct the columns \(\mathbf{q}_1,\dots,\mathbf{q}_n\) in order. Set \(\mathbf{u}_1=\mathbf{a}_1\), \(r_{11}=\|\mathbf{u}_1\|\), and \(\mathbf{q}_1=\mathbf{u}_1/r_{11}\). Because the columns of \(\mathbf{A}\) are independent, \(\mathbf{a}_1\ne\mathbf{0}\), so \(r_{11}>0\) and \(\mathbf{q}_1\) is defined with norm \(1\).

For each \(j=2,\dots,n\), assuming \(\mathbf{q}_1,\dots,\mathbf{q}_{j-1}\) have been constructed as an orthonormal list, set \(r_{ij}=\mathbf{q}_i\cdot\mathbf{a}_j\) for \(1\le i<j\), and define

$$ \mathbf{u}_j=\mathbf{a}_j-\sum_{i=1}^{j-1}r_{ij}\mathbf{q}_i. $$

For any \(k<j\), orthonormality gives

$$ \mathbf{q}_k\cdot\mathbf{u}_j =\mathbf{q}_k\cdot\mathbf{a}_j-\sum_{i=1}^{j-1}r_{ij}(\mathbf{q}_k\cdot\mathbf{q}_i) =r_{kj}-r_{kj}=0. $$

Thus \(\mathbf{u}_j\) is orthogonal to all the earlier \(\mathbf{q}_i\). The construction also gives \(\operatorname{span}\{\mathbf{q}_1,\dots,\mathbf{q}_{j-1}\}=\operatorname{span}\{\mathbf{a}_1,\dots,\mathbf{a}_{j-1}\}\): at each previous stage, \(\mathbf{a}_i\) is a combination of \(\mathbf{q}_1,\dots,\mathbf{q}_i\), and \(\mathbf{q}_i\) is a combination of \(\mathbf{a}_1,\dots,\mathbf{a}_i\). If \(\mathbf{u}_j=\mathbf{0}\), its defining equation would express \(\mathbf{a}_j\) as a combination of earlier \(\mathbf{q}_i\), hence of earlier columns of \(\mathbf{A}\). That contradicts independence. Therefore \(r_{jj}=\|\mathbf{u}_j\|>0\), and we can set \(\mathbf{q}_j=\mathbf{u}_j/r_{jj}\). This extends the orthonormal list.

For each \(j\), the construction rearranges to \(\mathbf{a}_j=\sum_{i<j}r_{ij}\mathbf{q}_i+r_{jj}\mathbf{q}_j\). Define \(\mathbf{Q}\) to have columns \(\mathbf{q}_1,\dots,\mathbf{q}_n\), and define \(\mathbf{R}\) by these \(r_{ij}\) for \(i\le j\), with \(r_{ij}=0\) for \(i>j\). Then \(\mathbf{Q}\) has orthonormal columns, \(\mathbf{R}\) is upper triangular, and the column equations give \(\mathbf{A}=\mathbf{Q}\mathbf{R}\). Its dimensions are \(m\times n\) and \(n\times n\), respectively. \(\square\)

Computing and Checking the Factors

Worked Example: A Three-by-Two Matrix

Find a reduced QR factorization of the matrix whose columns are \(\mathbf{a}_1=(1,1,0)^{\top}\) and \(\mathbf{a}_2=(1,0,1)^{\top}\).

First, \(r_{11}=\|\mathbf{a}_1\|=\sqrt{2}\), so \(\mathbf{q}_1=(1,1,0)^{\top}/\sqrt{2}\). The component of \(\mathbf{a}_2\) in the \(\mathbf{q}_1\) direction is \(r_{12}\mathbf{q}_1\), where

$$ r_{12}=\mathbf{q}_1\cdot\mathbf{a}_2=\frac{1}{\sqrt{2}}, \qquad r_{12}\mathbf{q}_1= \begin{bmatrix}1/2\\1/2\\0\end{bmatrix}. $$

Subtract it to obtain \(\mathbf{u}_2=(1/2,-1/2,1)^{\top}\). Its squared norm is \(1/4+1/4+1=3/2\), so \(r_{22}=\sqrt{6}/2\) and \(\mathbf{q}_2=(1,-1,2)^{\top}/\sqrt{6}\). Therefore

$$ \mathbf{Q}= \begin{bmatrix} 1/\sqrt{2}&1/\sqrt{6}\\ 1/\sqrt{2}&-1/\sqrt{6}\\ 0&2/\sqrt{6} \end{bmatrix}, \qquad \mathbf{R}= \begin{bmatrix} \sqrt{2}&1/\sqrt{2}\\ 0&\sqrt{6}/2 \end{bmatrix}. $$

Check: Each column of \(\mathbf{Q}\) has norm \(1\), and their dot product is \(1/\sqrt{12}-1/\sqrt{12}=0\). Multiplying the first column of \(\mathbf{Q}\) by \(r_{11}\) gives \((1,1,0)^{\top}=\mathbf{a}_1\). The second product column is

$$ \frac{1}{\sqrt{2}}\mathbf{q}_1+\frac{\sqrt{6}}{2}\mathbf{q}_2 = \begin{bmatrix}1/2\\1/2\\0\end{bmatrix} + \begin{bmatrix}1/2\\-1/2\\1\end{bmatrix} = \begin{bmatrix}1\\0\\1\end{bmatrix} =\mathbf{a}_2. $$

Worked Example: Three Columns in R³

Find the reduced QR factorization for the columns \(\mathbf{a}_1=(1,1,0)^{\top}\), \(\mathbf{a}_2=(1,-1,0)^{\top}\), and \(\mathbf{a}_3=(1,1,2)^{\top}\).

The first two columns are orthogonal, each with norm \(\sqrt{2}\). Hence \(\mathbf{q}_1=(1,1,0)^{\top}/\sqrt{2}\), \(\mathbf{q}_2=(1,-1,0)^{\top}/\sqrt{2}\), and \(r_{11}=r_{22}=\sqrt{2}\). For the third column,

$$ r_{13}=\mathbf{q}_1\cdot\mathbf{a}_3=\sqrt{2}, \qquad r_{23}=\mathbf{q}_2\cdot\mathbf{a}_3=0. $$

Subtracting \(r_{13}\mathbf{q}_1=(1,1,0)^{\top}\) and \(r_{23}\mathbf{q}_2=\mathbf{0}\) leaves \(\mathbf{u}_3=(0,0,2)^{\top}\). Thus \(r_{33}=2\) and \(\mathbf{q}_3=(0,0,1)^{\top}\). The factors are

$$ \mathbf{Q}= \begin{bmatrix} 1/\sqrt{2}&1/\sqrt{2}&0\\ 1/\sqrt{2}&-1/\sqrt{2}&0\\ 0&0&1 \end{bmatrix}, \qquad \mathbf{R}= \begin{bmatrix} \sqrt{2}&0&\sqrt{2}\\ 0&\sqrt{2}&0\\ 0&0&2 \end{bmatrix}. $$

Check: The columns of \(\mathbf{Q}\) each have norm \(1\); the first two have dot product \(1/2-1/2=0\), and the third is orthogonal to both because their third entries are zero. The columns of \(\mathbf{Q}\mathbf{R}\) are \(\sqrt{2}\mathbf{q}_1=(1,1,0)^{\top}\), \(\sqrt{2}\mathbf{q}_2=(1,-1,0)^{\top}\), and \(\sqrt{2}\mathbf{q}_1+2\mathbf{q}_3=(1,1,2)^{\top}\), as required.

What the Dimensions Tell You

For an \(m\times n\) matrix with \(m>n\), reduced \(Q\) is tall: it has \(m\) rows and \(n\) columns. Its columns provide exactly \(n\) orthonormal directions in \(\mathbb{R}^m\). The matrix \(R\) is \(n\times n\), not \(m\times n\), and its upper-triangular entries store the coefficients needed to rebuild each column of \(\mathbf{A}\) from those directions. When \(m=n\), reduced \(Q\) and \(R\) are both square. In either case, their product has the same dimensions as \(\mathbf{A}\).

A useful check on the construction is that each diagonal entry \(r_{jj}\) is the norm of a residual vector. Full column rank guarantees that each such residual is nonzero, so the construction produces \(r_{jj}>0\). This conclusion belongs to the stated Gram–Schmidt construction; it does not require treating the signs of all possible QR factors as a separate question.

Proposition: If \(\mathbf{Q}\in\mathbb{R}^{m\times n}\) has orthonormal columns, \(\mathbf{R}\in\mathbb{R}^{n\times n}\) is upper triangular with every diagonal entry nonzero, and \(\mathbf{A}=\mathbf{Q}\mathbf{R}\), then \(\mathbf{A}\) has full column rank.

Proof. Suppose \(\mathbf{A}\mathbf{x}=\mathbf{0}\) for some \(\mathbf{x}\in\mathbb{R}^n\). Since the columns of \(\mathbf{Q}\) are orthonormal, the \((i,j)\) entry of \(\mathbf{Q}^{\top}\mathbf{Q}\) is \(\mathbf{q}_i\cdot\mathbf{q}_j\), so \(\mathbf{Q}^{\top}\mathbf{Q}=\mathbf{I}_n\). Therefore \(\mathbf{0}=\mathbf{Q}^{\top}\mathbf{A}\mathbf{x}=\mathbf{Q}^{\top}\mathbf{Q}\mathbf{R}\mathbf{x}=\mathbf{R}\mathbf{x}\). The last row of this triangular system gives \(r_{nn}x_n=0\), hence \(x_n=0\). The row above then gives \(r_{n-1,n-1}x_{n-1}+r_{n-1,n}x_n=0\), hence \(x_{n-1}=0\). Continuing upward, each row gives \(r_{ii}x_i=0\) once \(x_{i+1},\dots,x_n\) are zero, so every \(x_i=0\). Thus \(\mathbf{A}\mathbf{x}=\mathbf{0}\) has only the zero solution, which means its columns are independent. \(\square\)

Common Pitfall: Mixing the Two Dimension Choices

For a \(3\times2\) matrix, a common mistake is to write a reduced \(Q\) of size \(3\times2\) and an \(R\) of size \(3\times2\), then claim their product equals the original matrix. This is not a valid multiplication: the two inner dimensions are \(2\) and \(3\), so \((3\times2)(3\times2)\) is undefined. In reduced QR, \(Q\) is \(3\times2\) and \(R\) is \(2\times2\), making \((3\times2)(2\times2)\) a \(3\times2\) product.

There is also a full QR convention in which \(Q\) is \(m\times m\) and \(R\) is \(m\times n\). Those dimensions can give a valid factorization, but they describe a different choice of factors. Do not mix the full-size \(Q\) with the reduced-size \(R\), or vice versa. Before computing entries, write down the intended dimensions and check that the number of columns of the first factor equals the number of rows of the second.

Reduced QR is useful whenever a tall matrix needs a representation that separates orthonormal directions from triangular coefficients. Its factor dimensions are compact, and the defining properties give direct checks: verify the shape of each factor, verify orthonormality of \(Q\)’s columns, verify that entries below the diagonal of \(R\) vanish, and multiply \(QR\) to recover \(A\). These checks catch both arithmetic errors and dimension errors.

Worked Example: A Four-by-Two Matrix

Find and check the reduced QR factorization of the matrix with columns \(\mathbf{a}_1=(1,1,1,1)^{\top}\) and \(\mathbf{a}_2=(1,1,0,0)^{\top}\).

The first column has norm \(2\), so \(\mathbf{q}_1=(1,1,1,1)^{\top}/2\) and \(r_{11}=2\). The next coefficient is \(r_{12}=\mathbf{q}_1\cdot\mathbf{a}_2=1\). Subtracting \(\mathbf{q}_1\) from \(\mathbf{a}_2\) gives \(\mathbf{u}_2=(1/2,1/2,-1/2,-1/2)^{\top}\), whose squared norm is \(4(1/4)=1\). Thus \(r_{22}=1\) and \(\mathbf{q}_2=\mathbf{u}_2\). The factors are

$$ \mathbf{Q}= \begin{bmatrix} 1/2&1/2\\ 1/2&1/2\\ 1/2&-1/2\\ 1/2&-1/2 \end{bmatrix}, \qquad \mathbf{R}= \begin{bmatrix} 2&1\\ 0&1 \end{bmatrix}. $$

Check: Both columns of \(\mathbf{Q}\) have squared norm \(4(1/4)=1\), and their dot product is \(1/4+1/4-1/4-1/4=0\). Multiplication gives \(2\mathbf{q}_1=(1,1,1,1)^{\top}=\mathbf{a}_1\), while \(\mathbf{q}_1+\mathbf{q}_2=(1,1,0,0)^{\top}=\mathbf{a}_2\). Hence \(\mathbf{Q}\mathbf{R}=\mathbf{A}\).

Check Your Understanding

For each question, attend to both the factor properties and the matrix dimensions.

  1. For a full-column-rank matrix in \(\mathbb{R}^{5\times3}\), what are the dimensions of reduced \(Q\) and \(R\)?
  2. In the Gram–Schmidt construction, why must the residual at stage \(j\) be nonzero when the columns of \(A\) are independent?
  3. For the columns \((1,0,1)^{\top}\) and \((0,1,1)^{\top}\), calculate the first Gram–Schmidt vector and the coefficient \(r_{12}\).
  4. Explain why a \(3\times2\) reduced \(Q\) cannot be multiplied by a \(3\times2\) matrix \(R\).
  5. If \(Q\) has orthonormal columns and \(R\) is upper triangular with nonzero diagonal, why must \(QR\) have independent columns?

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon