Chapter 17

Matrix Decompositions — QR

00 · Symbol Glossary

$A = QR$A equals Q R — QR factorisation

The decomposition of a matrix AA with linearly independent columns into an orthogonal factor QQ (orthonormal columns) and an upper triangular factor RR. Extends the Gram-Schmidt construction from Chapter 11 into a matrix factorisation usable for least squares and eigenvalue algorithms.

$Q^TQ = I$Q transpose Q equals I — orthonormal columns

The defining property of the QQ factor when AA has nn linearly independent columns: the columns of QQ are orthonormal. Read aloud as "Q transpose Q equals the identity." Inversion of QQ is free: Q1=QTQ^{-1} = Q^T.

$\mathbf{r}$bold r — residual vector

The residual r=Axb\mathbf{r} = A\mathbf{x} - \mathbf{b} in a least squares problem — the part of b\mathbf{b} that the column space of AA cannot explain. Minimising r2\|\mathbf{r}\|_2 is the objective of ordinary least squares regression.

$A^TA$A transpose A — normal equations matrix

The Gram matrix formed from the columns of AA. The classical least squares normal equations are ATAx=ATbA^TA\mathbf{x} = A^T\mathbf{b}. This system is theoretically correct but numerically dangerous when κ(ATA)=κ(A)2\kappa(A^TA) = \kappa(A)^2 — QR avoids forming ATAA^TA entirely.


01 · From Gram-Schmidt to QR

Chapter 11 constructed orthonormal vectors from a linearly independent set via the Gram-Schmidt process. QR packages that construction into a single matrix factorisation: the columns of QQ are the orthonormalised vectors, and RR records the projection coefficients that reconstruct the original columns of AA.

Definition — QR Decomposition

If ARm×nA \in \mathbb{R}^{m \times n} has linearly independent columns (mnm \geq n), then there exists a factorisation:

A=QRA = QR

QRm×nQ \in \mathbb{R}^{m \times n} has orthonormal columns: QTQ=InQ^TQ = I_n.

RRn×nR \in \mathbb{R}^{n \times n} is upper triangular with positive diagonal entries rii>0r_{ii} > 0.

The columns of QQ are q1,,qn\mathbf{q}_1, \ldots, \mathbf{q}_n produced by Gram-Schmidt on the columns of AA. The entry rij=aj,qir_{ij} = \langle \mathbf{a}_j, \mathbf{q}_i \rangle for iji \leq j, and rij=0r_{ij} = 0 for i>ji > j.

✓ Example — Factor Model Regression Setup

A fund manager runs a 3-factor model on 252 trading days. The design matrix AR252×3A \in \mathbb{R}^{252 \times 3} has columns: market, size, and value factor returns. The response bR252\mathbf{b} \in \mathbb{R}^{252} holds the fund's daily excess returns.

Factor exposures (betas) solve the overdetermined system AxbA\mathbf{x} \approx \mathbf{b} in the least squares sense. QR factorisation of AA gives numerically stable betas without forming ATAA^TA, which squares the condition number of a potentially ill-conditioned factor correlation structure.

❌ Failure — QR on Linearly Dependent Columns

Let A=(122436)A = \begin{pmatrix}1&2\\2&4\\3&6\end{pmatrix} — column 2 equals 2×2 \times column 1.

Gram-Schmidt on a2\mathbf{a}_2 gives u2=a2a2,q1q1=0\mathbf{u}_2 = \mathbf{a}_2 - \langle\mathbf{a}_2,\mathbf{q}_1\rangle\mathbf{q}_1 = \mathbf{0}. Normalising u2\mathbf{u}_2 requires division by u2=0\|\mathbf{u}_2\| = 0.

Why it breaks: RR would have r22=0r_{22} = 0, violating the positive-diagonal requirement. The columns of AA do not span a full nn-dimensional subspace.

Consequence: QR requires linearly independent columns. Rank-deficient AA needs a pivoted variant (AP=QRAP = QR) or SVD-based least squares.


02 · Constructing QQ and RR via Gram-Schmidt

The algorithm from Chapter 11, now read as a factorisation.

Definition — QR via Gram-Schmidt

Given linearly independent columns a1,,an\mathbf{a}_1, \ldots, \mathbf{a}_n of AA:

Step 1: u1=a1\mathbf{u}_1 = \mathbf{a}_1, q1=u1/u1\mathbf{q}_1 = \mathbf{u}_1/\|\mathbf{u}_1\|, r11=u1r_{11} = \|\mathbf{u}_1\|.

Step jj (for j=2,,nj = 2, \ldots, n):

uj=aji=1j1rijqi,rij=aj,qi,rjj=uj,qj=uj/rjj\mathbf{u}_j = \mathbf{a}_j - \sum_{i=1}^{j-1} r_{ij}\mathbf{q}_i, \quad r_{ij} = \langle \mathbf{a}_j, \mathbf{q}_i \rangle, \quad r_{jj} = \|\mathbf{u}_j\|, \quad \mathbf{q}_j = \mathbf{u}_j/r_{jj}

Assemble Q=[q1qn]Q = [\mathbf{q}_1 \mid \cdots \mid \mathbf{q}_n] and the upper triangular RR.

Step-by-step — QR of $A = \begin{pmatrix}1&1\\1&0\\0&1\end{pmatrix}$ (columns $\mathbf{a}_1, \mathbf{a}_2$)
1

Column 1: a1=(110)\mathbf{a}_1 = \begin{pmatrix}1\\1\\0\end{pmatrix}. a1=1+1+0=2\|\mathbf{a}_1\| = \sqrt{1+1+0} = \sqrt{2}.

r11=2r_{11} = \sqrt{2}. q1=12(110)\mathbf{q}_1 = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\\0\end{pmatrix}.

2

Project a2\mathbf{a}_2 onto q1\mathbf{q}_1: r12=a2,q1=12(11+01+10)=12r_{12} = \langle\mathbf{a}_2, \mathbf{q}_1\rangle = \frac{1}{\sqrt{2}}(1\cdot1 + 0\cdot1 + 1\cdot0) = \frac{1}{\sqrt{2}}.

The 12\frac{1}{\sqrt{2}} comes from the dot product formula with q1\mathbf{q}_1 already normalised.

3

Orthogonalise a2\mathbf{a}_2: u2=a2r12q1=(101)1212(110)=(101)(1/21/20)=(1/21/21)\mathbf{u}_2 = \mathbf{a}_2 - r_{12}\mathbf{q}_1 = \begin{pmatrix}1\\0\\1\end{pmatrix} - \frac{1}{\sqrt{2}}\cdot\frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\\0\end{pmatrix} = \begin{pmatrix}1\\0\\1\end{pmatrix} - \begin{pmatrix}1/2\\1/2\\0\end{pmatrix} = \begin{pmatrix}1/2\\-1/2\\1\end{pmatrix}.

r22=u2=14+14+1=32=62r_{22} = \|\mathbf{u}_2\| = \sqrt{\frac{1}{4}+\frac{1}{4}+1} = \sqrt{\frac{3}{2}} = \frac{\sqrt{6}}{2}.

4

Normalise: q2=1r22(1/21/21)=26(1/21/21)=16(112)\mathbf{q}_2 = \frac{1}{r_{22}}\begin{pmatrix}1/2\\-1/2\\1\end{pmatrix} = \frac{2}{\sqrt{6}}\begin{pmatrix}1/2\\-1/2\\1\end{pmatrix} = \frac{1}{\sqrt{6}}\begin{pmatrix}1\\-1\\2\end{pmatrix}.

5

Assemble factors:

Q=(12161216026),R=(212062)Q = \begin{pmatrix}\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{6}} \\ \frac{1}{\sqrt{2}} & \frac{-1}{\sqrt{6}} \\ 0 & \frac{2}{\sqrt{6}}\end{pmatrix}, \quad R = \begin{pmatrix}\sqrt{2} & \frac{1}{\sqrt{2}} \\ 0 & \frac{\sqrt{6}}{2}\end{pmatrix}

6

Verify A=QRA = QR: (QR)11=122+160=1(QR)_{11} = \frac{1}{\sqrt{2}}\cdot\sqrt{2} + \frac{1}{\sqrt{6}}\cdot0 = 1 ✓.

(QR)21=122+160=1(QR)_{21} = \frac{1}{\sqrt{2}}\cdot\sqrt{2} + \frac{-1}{\sqrt{6}}\cdot0 = 1 ✓.

(QR)32=2662=1(QR)_{32} = \frac{2}{\sqrt{6}}\cdot\frac{\sqrt{6}}{2} = 1 ✓. All six entries of the 3×23 \times 2 product match AA.

Reading $R$

The upper triangular RR is the coefficient matrix in the expansion aj=r1jq1+r2jq2++rjjqj\mathbf{a}_j = r_{1j}\mathbf{q}_1 + r_{2j}\mathbf{q}_2 + \cdots + r_{jj}\mathbf{q}_j. Entry rijr_{ij} is the component of aj\mathbf{a}_j in direction qi\mathbf{q}_i. Zeros below the diagonal reflect the fact that aj\mathbf{a}_j has no component in directions qi\mathbf{q}_i for i>ji > j.


03 · Properties of the QR Factorisation

Definition — Orthonormal Columns

The columns q1,,qn\mathbf{q}_1, \ldots, \mathbf{q}_n of QQ satisfy:

QTQ=In    qi,qj=δijQ^TQ = I_n \iff \langle \mathbf{q}_i, \mathbf{q}_j \rangle = \delta_{ij}

δij\delta_{ij} — Kronecker delta: 11 when i=ji=j, 00 when iji \neq j.

When QQ is square (m=nm = n), QQ is an orthogonal matrix and QQT=ImQQ^T = I_m also holds.

Definition — $R$ Is Upper Triangular

R=(rij)R = (r_{ij}) satisfies rij=0r_{ij} = 0 for all i>ji > j. The diagonal entries rii=uir_{ii} = \|\mathbf{u}_i\| are the norms of the orthogonalised vectors before normalisation — strictly positive when columns of AA are independent.

❌ Failure — Assuming $QQ^T = I$ for Tall $Q$

For ARm×nA \in \mathbb{R}^{m \times n} with m>nm > n, QRm×nQ \in \mathbb{R}^{m \times n} has QTQ=InQ^TQ = I_n but QQTImQQ^T \neq I_m.

Setup: QQ from the 3×23 \times 2 example above.

Computation: QQTQQ^T is 3×33 \times 3, not I3I_3 — the three rows of QQ span only a 2-dimensional subspace of R3\mathbb{R}^3.

Why it breaks: QQT=ImQQ^T = I_m requires mm orthonormal columns in Rm\mathbb{R}^m. A tall thin QQ has only n<mn < m columns.

Consequence: for tall QQ, use QTQ=InQ^TQ = I_n for inversion in the nn-dimensional column space. Do not treat QQ as a square orthogonal matrix.


04 · Least Squares via QR

The normal equations ATAx=ATbA^TA\mathbf{x} = A^T\mathbf{b} solve least squares algebraically. QR solves the same problem without squaring the condition number.

Definition — Least Squares Problem

Given ARm×nA \in \mathbb{R}^{m \times n} with m>nm > n and full column rank, find x^\hat{\mathbf{x}} that minimises:

r2=Ax^b2\|\mathbf{r}\|_2 = \|A\hat{\mathbf{x}} - \mathbf{b}\|_2

r=Ax^b\mathbf{r} = A\hat{\mathbf{x}} - \mathbf{b} — the residual vector. The minimiser x^\hat{\mathbf{x}} satisfies the normal equations ATAx^=ATbA^TA\hat{\mathbf{x}} = A^T\mathbf{b}.

Definition — QR Least Squares Solution

With A=QRA = QR:

Rx^=QTbR\hat{\mathbf{x}} = Q^T\mathbf{b}

QTbQ^T\mathbf{b} projects b\mathbf{b} onto the coordinate system of the orthonormal columns of AA. Back-substitution on the small n×nn \times n upper triangular system Rx^=QTbR\hat{\mathbf{x}} = Q^T\mathbf{b} gives x^\hat{\mathbf{x}} directly.

Step-by-step — Least squares for $A = \begin{pmatrix}1\\1\\0\end{pmatrix}$, $\mathbf{b} = \begin{pmatrix}2\\0\\1\end{pmatrix}$ (column vector)
1

Note: AA is 3×13 \times 1 here — one regressor. Q=q1=12(110)Q = \mathbf{q}_1 = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\\0\end{pmatrix}, R=(2)R = \begin{pmatrix}\sqrt{2}\end{pmatrix}.

2

Compute QTbQ^T\mathbf{b}: 12(12+10+01)=22=2\frac{1}{\sqrt{2}}(1\cdot2 + 1\cdot0 + 0\cdot1) = \frac{2}{\sqrt{2}} = \sqrt{2}.

3

Solve Rx^=QTbR\hat{x} = Q^T\mathbf{b}: 2x^=2\sqrt{2}\,\hat{x} = \sqrt{2}, so x^=1\hat{x} = 1.

4

Residual: Ax^=(110)A\hat{\mathbf{x}} = \begin{pmatrix}1\\1\\0\end{pmatrix}. r=(201)(110)=(111)\mathbf{r} = \begin{pmatrix}2\\0\\1\end{pmatrix} - \begin{pmatrix}1\\1\\0\end{pmatrix} = \begin{pmatrix}1\\-1\\1\end{pmatrix}.

r=1+1+1=3\|\mathbf{r}\| = \sqrt{1+1+1} = \sqrt{3}. The part of b\mathbf{b} orthogonal to the column of AA has length 3\sqrt{3}.


05 · QR vs Normal Equations — Numerical Stability

Definition — Why QR Beats Normal Equations

The normal equations form ATAA^TA, whose condition number satisfies:

κ(ATA)=κ(A)2\kappa(A^TA) = \kappa(A)^2

Squaring the condition number amplifies relative errors in floating-point arithmetic. QR works directly with AA: solving Rx^=QTbR\hat{\mathbf{x}} = Q^T\mathbf{b} has conditioning κ(R)=κ(A)\kappa(R) = \kappa(A) — no squaring.

For a regression with κ(A)=104\kappa(A) = 10^4, normal equations have κ(ATA)=108\kappa(A^TA) = 10^8 — potentially losing 8 digits of precision in double arithmetic. QR retains 4 digits of reliability relative to AA.

✓ Example — Ill-Conditioned Factor Regression

Design matrix AR500×5A \in \mathbb{R}^{500 \times 5} with nearly collinear factor columns (value and growth proxies with correlation ρ=0.99\rho = 0.99). κ(A)103\kappa(A) \approx 10^3.

Normal equations: κ(ATA)106\kappa(A^TA) \approx 10^6. Beta estimates on the 4th and 5th factors may have relative errors 1010\sim 10^{-10} in double precision — unreliable for risk attribution.

QR: solves Rx^=QTbR\hat{\mathbf{x}} = Q^T\mathbf{b} with κ(R)103\kappa(R) \approx 10^3. Same theoretical answer, but stable betas. Production quant libraries (LAPACK dgels) use QR or SVD, not ATAA^TA.

❌ Failure — Forming $A^TA$ Explicitly

For A=(1110500105)A = \begin{pmatrix}1&1\\10^{-5}&0\\0&10^{-5}\end{pmatrix}, columns are nearly orthogonal but κ(A)105\kappa(A) \approx 10^5.

ATA=(1+1010111+1010)(1111)A^TA = \begin{pmatrix}1+10^{-10}&1\\1&1+10^{-10}\end{pmatrix} \approx \begin{pmatrix}1&1\\1&1\end{pmatrix} in limited precision — the small 101010^{-10} terms vanish, making ATAA^TA singular or nearly so.

Consequence: normal equations destroy information present in AA. QR on AA directly preserves the nearly-orthogonal structure. This is why Chapter 20 treats condition numbers as first-class objects.


06 · Practice Exercises

EXERCISE 17.1

Apply Gram-Schmidt to the two columns. r11=a1r_{11} = \|\mathbf{a}_1\|, r12=a2,q1r_{12} = \langle\mathbf{a}_2,\mathbf{q}_1\rangle, r22=u2r_{22} = \|\mathbf{u}_2\|.

a1=(304)\mathbf{a}_1 = \begin{pmatrix}3\\0\\4\end{pmatrix}. r11=9+16=5r_{11} = \sqrt{9+16} = 5. q1=15(304)\mathbf{q}_1 = \frac{1}{5}\begin{pmatrix}3\\0\\4\end{pmatrix}.

r12=a2,q1=15(30+04+40)=0r_{12} = \langle\mathbf{a}_2,\mathbf{q}_1\rangle = \frac{1}{5}(3\cdot0 + 0\cdot4 + 4\cdot0) = 0.

u2=a2=(040)\mathbf{u}_2 = \mathbf{a}_2 = \begin{pmatrix}0\\4\\0\end{pmatrix}. r22=4r_{22} = 4. q2=(010)\mathbf{q}_2 = \begin{pmatrix}0\\1\\0\end{pmatrix}.

Q=(3/50014/50),R=(5004)Q = \begin{pmatrix}3/5&0\\0&1\\4/5&0\end{pmatrix}, \quad R = \begin{pmatrix}5&0\\0&4\end{pmatrix}

Verify: (QR)31=455=4(QR)_{31} = \frac{4}{5}\cdot5 = 4 ✓.

Find the QR decomposition of A=(300440)A = \begin{pmatrix}3&0\\0&4\\4&0\end{pmatrix}. Show r12=0r_{12}=0 and verify A=QRA=QR.

EXERCISE 17.2

After building QQ and RR from Gram-Schmidt, verify QTQ=I2Q^TQ = I_2 by computing the four entries of the 2×22 \times 2 product.

From the chapter example: Q=(1/21/61/21/602/6)Q = \begin{pmatrix}1/\sqrt{2}&1/\sqrt{6}\\1/\sqrt{2}&-1/\sqrt{6}\\0&2/\sqrt{6}\end{pmatrix}.

(QTQ)11=12+12+0=1(Q^TQ)_{11} = \frac{1}{2}+\frac{1}{2}+0 = 1 ✓.

(QTQ)12=112112+0=0(Q^TQ)_{12} = \frac{1}{\sqrt{12}} - \frac{1}{\sqrt{12}} + 0 = 0 ✓.

(QTQ)22=16+16+46=1(Q^TQ)_{22} = \frac{1}{6}+\frac{1}{6}+\frac{4}{6} = 1 ✓.

QTQ=I2Q^TQ = I_2. Columns are orthonormal.

For A=(111001)A = \begin{pmatrix}1&1\\1&0\\0&1\end{pmatrix}, verify QTQ=I2Q^TQ = I_2 using the QQ from the chapter's step-by-step. Show all three diagonal/off-diagonal entries.

EXERCISE 17.3

Compute QTbQ^T\mathbf{b} first — a vector in R2\mathbb{R}^2. Then back-substitute on Rx^=QTbR\hat{\mathbf{x}} = Q^T\mathbf{b}.

Use QR from the chapter: R=(21/206/2)R = \begin{pmatrix}\sqrt{2}&1/\sqrt{2}\\0&\sqrt{6}/2\end{pmatrix}, b=(312)\mathbf{b}=\begin{pmatrix}3\\1\\2\end{pmatrix}.

QTbQ^T\mathbf{b}: row 1 = 12(3+1+0)=4/2=22\frac{1}{\sqrt{2}}(3+1+0) = 4/\sqrt{2} = 2\sqrt{2}. Row 2 = 16(31+4)=6/6=6\frac{1}{\sqrt{6}}(3-1+4) = 6/\sqrt{6} = \sqrt{6}.

Solve: 62x^2=6\frac{\sqrt{6}}{2}\hat{x}_2 = \sqrt{6}, so x^2=2\hat{x}_2 = 2.

2x^1+12(2)=22\sqrt{2}\,\hat{x}_1 + \frac{1}{\sqrt{2}}(2) = 2\sqrt{2}, so 2x^1=222=2\sqrt{2}\,\hat{x}_1 = 2\sqrt{2} - \sqrt{2} = \sqrt{2}, x^1=1\hat{x}_1 = 1.

x^=(12)\hat{\mathbf{x}} = \begin{pmatrix}1\\2\end{pmatrix}.

Using the QR factors for A=(111001)A = \begin{pmatrix}1&1\\1&0\\0&1\end{pmatrix}, solve the least squares problem for b=(312)\mathbf{b}=\begin{pmatrix}3\\1\\2\end{pmatrix} via Rx^=QTbR\hat{\mathbf{x}} = Q^T\mathbf{b}.

EXERCISE 17.4

Compare the two solution paths: (1) solve ATAx=ATbA^TA\mathbf{x}=A^T\mathbf{b}; (2) solve Rx=QTbR\mathbf{x}=Q^T\mathbf{b}. Both give the same x^\hat{\mathbf{x}} in exact arithmetic.

A=(12)A = \begin{pmatrix}1\\2\end{pmatrix}, b=(12)\mathbf{b}=\begin{pmatrix}1\\2\end{pmatrix} — exact fit.

ATA=5A^TA = 5, ATb=5A^T\mathbf{b} = 5. Normal equations: x^=1\hat{x} = 1.

QR: Q=15(12)Q = \frac{1}{\sqrt{5}}\begin{pmatrix}1\\2\end{pmatrix}, R=(5)R = \begin{pmatrix}\sqrt{5}\end{pmatrix}. QTb=15(1+4)=5Q^T\mathbf{b} = \frac{1}{\sqrt{5}}(1+4) = \sqrt{5}. Rx^=5R\hat{x}=\sqrt{5}, x^=1\hat{x}=1 ✓.

Both methods agree. For this well-conditioned 1×11 \times 1 case they are identical. The advantage of QR appears when κ(A)1\kappa(A) \gg 1 and ATAA^TA loses precision.

For A=(12)A = \begin{pmatrix}1\\2\end{pmatrix} and b=(12)\mathbf{b}=\begin{pmatrix}1\\2\end{pmatrix}, solve via normal equations and via QR. Confirm both give the same x^\hat{x} and explain when they would diverge in floating point.

EXERCISE 17.5

κ(ATA)=κ(A)2\kappa(A^TA) = \kappa(A)^2. If κ(A)=103\kappa(A) = 10^3, how many digits of relative accuracy might normal equations lose in double precision (16\approx 16 digits)?

κ(A)=103\kappa(A) = 10^3, so κ(ATA)=106\kappa(A^TA) = 10^6.

In double precision, relative error in solving a system is roughly εmachκ2×1016106=2×1010\varepsilon_{\text{mach}} \cdot \kappa \approx 2\times10^{-16} \cdot 10^6 = 2\times10^{-10}.

Normal equations may lose log10(106)=6\log_{10}(10^6) = 6 digits of accuracy relative to the ideal answer — leaving 10\approx 10 reliable digits.

QR on AA directly: error 2×1016103=2×1013\approx 2\times10^{-16}\cdot10^3 = 2\times10^{-13} — about 1000 times more accurate.

Therefore production least squares uses QR or SVD, not ATAA^TA.

A regression design matrix has κ(A)=103\kappa(A) = 10^3. Estimate κ(ATA)\kappa(A^TA). Explain in one paragraph why a quant library would prefer QR over normal equations for computing factor betas.

EXERCISE 17.6

Build AA with columns = factor returns. QR gives betas via Rx^=QTrR\hat{\mathbf{x}}=Q^T\mathbf{r} where r\mathbf{r} is the fund's excess returns. Interpret x^1\hat{x}_1 as market beta.

A=(100110111)A = \begin{pmatrix}1&0&0\\1&1&0\\1&1&1\end{pmatrix} (3 days, 3 factors), r=(0.010.020.03)\mathbf{r}=\begin{pmatrix}0.01\\0.02\\0.03\end{pmatrix}.

Gram-Schmidt: q1=13(111)\mathbf{q}_1 = \frac{1}{\sqrt{3}}\begin{pmatrix}1\\1\\1\end{pmatrix}, r11=3r_{11}=\sqrt{3}.

u2=(011)2313(111)=(2/31/31/3)\mathbf{u}_2 = \begin{pmatrix}0\\1\\1\end{pmatrix} - \frac{2}{\sqrt{3}}\cdot\frac{1}{\sqrt{3}}\begin{pmatrix}1\\1\\1\end{pmatrix} = \begin{pmatrix}-2/3\\1/3\\1/3\end{pmatrix}, r22=6/3r_{22}=\sqrt{6}/3, q2=16(211)\mathbf{q}_2=\frac{1}{\sqrt{6}}\begin{pmatrix}-2\\1\\1\end{pmatrix}.

u3=(001)\mathbf{u}_3 = \begin{pmatrix}0\\0\\1\end{pmatrix} - \cdots, eventually r33=1/2r_{33}=1/\sqrt{2}, q3=12(011)\mathbf{q}_3=\frac{1}{\sqrt{2}}\begin{pmatrix}0\\-1\\1\end{pmatrix}.

QTrQ^T\mathbf{r}: c1=0.01+0.02+0.033=0.06/30.0346c_1 = \frac{0.01+0.02+0.03}{\sqrt{3}} = 0.06/\sqrt{3} \approx 0.0346.

Back-substitute on Rx^=QTrR\hat{\mathbf{x}}=Q^T\mathbf{r} for x^\hat{\mathbf{x}} (factor exposures).

The market beta x^1\hat{x}_1 captures average sensitivity to the first factor column (1,1,1)T(1,1,1)^T — the parallel shift in all factors. QR isolates each factor's incremental contribution via orthogonality.

Three days of factor returns form A=(100110111)A = \begin{pmatrix}1&0&0\\1&1&0\\1&1&1\end{pmatrix} (market, size, value). Fund excess returns are r=(0.010.020.03)\mathbf{r}=\begin{pmatrix}0.01\\0.02\\0.03\end{pmatrix}. Outline the QR steps to estimate factor betas and interpret x^1\hat{x}_1 as market exposure.


07 · Summary

TermDefinition
QR decompositionA=QRA = QR; QQ has orthonormal columns, RR upper triangular
QTQ=InQ^TQ = I_nColumns of QQ are orthonormal; Q1=QTQ^{-1} = Q^T when square
rijr_{ij}rij=aj,qir_{ij} = \langle\mathbf{a}_j, \mathbf{q}_i\rangle — projection coefficient
Least squares via QRSolve Rx^=QTbR\hat{\mathbf{x}} = Q^T\mathbf{b} by back substitution
Normal equationsATAx^=ATbA^TA\hat{\mathbf{x}}=A^T\mathbf{b} — correct but κ(ATA)=κ(A)2\kappa(A^TA)=\kappa(A)^2
Numerical stabilityQR avoids forming ATAA^TA; preferred for regression
Residualr=Ax^b\mathbf{r} = A\hat{\mathbf{x}}-\mathbf{b}; minimised in 2\ell_2 norm

Next: Matrix Decompositions — SVD — the universal factorisation that exists for every matrix, connects to PCA and low-rank approximation, and underpins modern quant analytics.