Unit 9, lesson 48

Householder QR Factorization

How length-preserving Householder reflectors clear a column, why the stable sign choice avoids cancellation in each reflector, and how full and reduced QR give the least-squares solution by a triangular solve and its residual.

  • Video 48
  • Reliable Factorization Choices

How can we put zeros below the diagonal of a matrix without changing any lengths? Elimination creates zeros with row operations, but those operations generally change the length of Ax−bAx - b, which is exactly what a least-squares problem minimizes. A reflection changes no lengths, and one well-chosen reflection sends an entire column to a multiple of e1e_1. This lesson constructs these Householder reflectors, chooses their sign so that the vector defining each one is formed without cancellation, assembles them into a QR factorization, and reads both the least-squares solution and its residual from it. Everything here is real, a tuple such as (1,2,2)(1, 2, 2) stands for a column vector, and ∥⋅∥\lVert \cdot \rVert is the Euclidean norm.

Key terms

Householder reflector

Definition Let v∈Rmv \in \mathbb{R}^m be nonzero. The Householder reflector determined by vv is the m×mm \times m matrix

H=I−2 vvTvTv.H = I - 2\,\frac{vv^{\mathsf{T}}}{v^{\mathsf{T}}v}.

The matrix P=vvT/(vTv)P = vv^{\mathsf{T}}/(v^{\mathsf{T}}v) is the orthogonal projector onto the line spanned by vv. So H=I−2PH = I - 2P reverses the component of a vector along vv and keeps the component perpendicular to vv. In particular Hv=−vHv = -v, and Hw=wHw = w whenever vTw=0v^{\mathsf{T}}w = 0. In R3\mathbb{R}^3 this is the mirror reflection in the plane perpendicular to vv, and the same formula works in every dimension. The matrix HH is symmetric and orthogonal, and it is its own inverse. Indeed PT=PP^{\mathsf{T}} = P, and P2=PP^2 = P because the scalar vTvv^{\mathsf{T}}v in the middle cancels one factor of the denominator,

P2=v (vTv) vT(vTv)2=P.P^2 = \frac{v\,(v^{\mathsf{T}}v)\,v^{\mathsf{T}}}{(v^{\mathsf{T}}v)^2} = P.

Hence HT=HH^{\mathsf{T}} = H and

HTH=(I−2P)2=I−4P+4P2=I.\begin{aligned} H^{\mathsf{T}}H &= (I - 2P)^2 \\[0.4em] &= I - 4P + 4P^2 \\[0.4em] &= I. \end{aligned}

Consequently ∥Hz∥2=zTHTHz=zTz\lVert Hz \rVert^2 = z^{\mathsf{T}}H^{\mathsf{T}}Hz = z^{\mathsf{T}}z for every zz, inner products are preserved as well, and H2=IH^2 = I. Multiplying vv by a nonzero number does not change HH. Over C\mathbb{C} one uses I−2vv∗/(v∗v)I - 2vv^{*}/(v^{*}v), which is Hermitian and unitary, with the phase of the first entry in place of the sign chosen below. This lesson stays with real matrices.

In plain words A Householder reflector is a mirror. It flips the single direction vv and leaves everything perpendicular to vv alone, so it moves vectors without stretching them.

Example For v=(2,1,1)v = (2, 1, 1) we have vTv=6v^{\mathsf{T}}v = 6, so

H=I−13[422211211]=13[−1−2−2−22−1−2−12].\begin{aligned} H &= I - \frac{1}{3}\begin{bmatrix} 4 & 2 & 2 \\ 2 & 1 & 1 \\ 2 & 1 & 1 \end{bmatrix} \\[0.4em] &= \frac{1}{3}\begin{bmatrix} -1 & -2 & -2 \\ -2 & 2 & -1 \\ -2 & -1 & 2 \end{bmatrix}. \end{aligned}

Then Hv=(−2,−1,−1)=−vHv = (-2, -1, -1) = -v, and the vector w=(1,−2,0)w = (1, -2, 0), which is perpendicular to vv, satisfies Hw=wHw = w. Each column of HH has length 11, and the columns are mutually perpendicular, as orthogonality requires.

Stable sign choice

Definition Let a∈Rma \in \mathbb{R}^m with m≥2m \ge 2, and suppose its tail (a2,…,am)(a_2, \dots, a_m) is not zero. Let α=∥a∥\alpha = \lVert a \rVert, let s=1s = 1 if a1≥0a_1 \ge 0 and s=−1s = -1 if a1<0a_1 < 0, so that the sign of 00 is taken to be 11, and set

v=a+sα e1.v = a + s\alpha\,e_1.

Then v≠0v \ne 0, and the reflector HH of vv satisfies Ha=−sα e1Ha = -s\alpha\,e_1. To check this, note that sa1=∣a1∣sa_1 = \lvert a_1 \rvert, so

vTa=α2+α∣a1∣,vTv=2α2+2α∣a1∣=2 vTa.\begin{aligned} v^{\mathsf{T}}a &= \alpha^2 + \alpha\lvert a_1 \rvert, \\[0.4em] v^{\mathsf{T}}v &= 2\alpha^2 + 2\alpha\lvert a_1 \rvert = 2\,v^{\mathsf{T}}a. \end{aligned}

Both are positive because α>0\alpha > 0, and therefore

Ha=a−2 vTavTv v=a−v=−sα e1.\begin{aligned} Ha &= a - \frac{2\,v^{\mathsf{T}}a}{v^{\mathsf{T}}v}\,v \\[0.4em] &= a - v \\[0.4em] &= -s\alpha\,e_1. \end{aligned}

The other sign, v=a−sα e1v = a - s\alpha\,e_1, also gives a reflector that sends aa to sα e1s\alpha\,e_1 in exact arithmetic. Its first entry, however, has absolute value α−∣a1∣\alpha - \lvert a_1 \rvert. When aa is close to the e1e_1 axis this is a difference of two nearly equal numbers, and such a difference can lose most of its significant digits. The stable choice adds the two nonnegative numbers ∣a1∣\lvert a_1 \rvert and α\alpha, so this step has no cancellation. That explains the design choice. It is not by itself a proof that the whole algorithm is stable, which needs an error analysis of every operation, including the computation of α\alpha.

When the tail is already zero, including the case a=0a = 0, there is nothing to eliminate, and the algorithm uses H=IH = I. A reflector is never formed from the zero vector, whose denominator vTvv^{\mathsf{T}}v would be 00. A zero leading entry with a nonzero tail is not such a case. There the formula applies with s=1s = 1.

In plain words Reflect the column onto the first axis, on the side opposite to its first entry, or on the negative side when that entry is zero. Then the vector that defines the mirror is built from a sum of two lengths rather than a difference, and nothing is lost to cancellation.

Example For a=(1,2,2)a = (1, 2, 2) we get α=3\alpha = 3 and s=1s = 1, so v=(4,2,2)v = (4, 2, 2), a multiple of (2,1,1)(2, 1, 1), and HH is the reflector of the previous example. Here vTa=12v^{\mathsf{T}}a = 12 and vTv=24v^{\mathsf{T}}v = 24, so Ha=a−v=(−3,0,0)Ha = a - v = (-3, 0, 0).

To see the cancellation, take a=(1,10−3)a = (1, 10^{-3}), with α=1+10−6≈1.0000005\alpha = \sqrt{1 + 10^{-6}} \approx 1.0000005, and suppose α\alpha is rounded to six significant digits, giving 1.000001.00000. The other sign computes the first entry 1−1.00000=01 - 1.00000 = 0 in place of the true value of about −5⋅10−7-5 \cdot 10^{-7}, so the computed vector is (0,10−3)(0, 10^{-3}). Its reflector is diag⁡(1,−1)\operatorname{diag}(1, -1), which sends aa to (1,−10−3)(1, -10^{-3}) and eliminates nothing. The stable choice computes 1+1.00000=2.000001 + 1.00000 = 2.00000, within a relative 2.5⋅10−72.5 \cdot 10^{-7} of the true value 2.00000052.0000005, and its reflector sends aa to about (−1.0000005,−2.5⋅10−10)(-1.0000005, -2.5 \cdot 10^{-10}), very close to the target −αe1-\alpha e_1.

Householder QR factorization

Definition Let A∈Rm×nA \in \mathbb{R}^{m \times n} with m≥nm \ge n. For k=1,…,nk = 1, \dots, n, look at column kk of the current matrix in rows kk through mm. If its entries below row kk are all zero, take H~k=I\tilde{H}_k = I. Otherwise take the stable reflector H~k\tilde{H}_k of size m−k+1m - k + 1 that sends this piece of the column to a multiple of its first unit vector. Embed it as

Hk=[Ik−100H~k],H_k = \begin{bmatrix} I_{k-1} & 0 \\ 0 & \tilde{H}_k \end{bmatrix},

which acts only on rows kk through mm. When m=nm = n the last step is the identity, since a single entry has no tail. The zeros already created in columns 1,…,k−11, \dots, k - 1 survive, because in those columns rows kk through mm are zero and H~k\tilde{H}_k sends zero to zero. After the last step

Hn⋯H2H1A=Rfull=[R0],H_n \cdots H_2 H_1 A = R_{\text{full}} = \begin{bmatrix} R \\ 0 \end{bmatrix},

where R∈Rn×nR \in \mathbb{R}^{n \times n} is upper triangular and the zero block has m−nm - n rows. Each HkH_k is symmetric and orthogonal, so Q=H1H2⋯HnQ = H_1 H_2 \cdots H_n is orthogonal with QT=Hn⋯H2H1Q^{\mathsf{T}} = H_n \cdots H_2 H_1, and

A=QRfull.A = QR_{\text{full}}.

This shows that every real m×nm \times n matrix with m≥nm \ge n has such a factorization, with no assumption on its rank. If AA has full column rank nn, then RR has the same rank, so it is invertible and its diagonal entries are nonzero. They may be negative. Changing the sign of column jj of QQ together with row jj of RfullR_{\text{full}} gives another factorization, so a nonnegative diagonal can always be arranged if a convention requires it. In practice QQ is often stored as the list of vectors that define the reflectors rather than multiplied out.

In plain words Each reflector clears one column below the diagonal and leaves the columns already cleared alone. After nn reflections the matrix is upper triangular, and the product of the reflectors records the way back to AA.

Example Let

A=[102224].A = \begin{bmatrix} 1 & 0 \\ 2 & 2 \\ 2 & 4 \end{bmatrix}.

The first column is (1,2,2)(1, 2, 2), and the reflector H1=HH_1 = H of the previous examples gives

H1A=[−3−40002].H_1 A = \begin{bmatrix} -3 & -4 \\ 0 & 0 \\ 0 & 2 \end{bmatrix}.

In rows 22 and 33 the second column is (0,2)(0, 2). Its leading entry is zero but its tail is not, so a reflector is needed. With α=2\alpha = 2 and s=1s = 1 the vector is (2,2)(2, 2), and its reflector H~2\tilde{H}_2 has rows (0,−1)(0, -1) and (−1,0)(-1, 0), which sends (0,2)(0, 2) to (−2,0)(-2, 0). Hence

Rfull=[−3−40−200],R_{\text{full}} = \begin{bmatrix} -3 & -4 \\ 0 & -2 \\ 0 & 0 \end{bmatrix},

and

Q=H1H2=13[−122−21−2−2−21].Q = H_1H_2 = \frac{1}{3}\begin{bmatrix} -1 & 2 & 2 \\ -2 & 1 & -2 \\ -2 & -2 & 1 \end{bmatrix}.

Multiplying back, −3-3 times the first column of QQ is (1,2,2)(1, 2, 2), and −4-4 times the first column plus −2-2 times the second is (0,2,4)(0, 2, 4). So QRfull=AQR_{\text{full}} = A.

Triangular solve

Definition Let R∈Rn×nR \in \mathbb{R}^{n \times n} be upper triangular with nonzero diagonal entries r11,…,rnnr_{11}, \dots, r_{nn}, and let c∈Rnc \in \mathbb{R}^n. The system Rx=cRx = c has exactly one solution, found by back substitution from the last equation upward,

xn=cnrnn,xi=1rii(ci−∑j=i+1nrijxj),\begin{gathered} x_n = \frac{c_n}{r_{nn}}, \\[0.4em] x_i = \frac{1}{r_{ii}}\Big(c_i - \sum_{j = i+1}^{n} r_{ij}x_j\Big), \end{gathered}

for i=n−1,…,1i = n - 1, \dots, 1 in turn. It takes about n2n^2 arithmetic operations and never forms R−1R^{-1}. A lower triangular system is solved the same way from the top down, by forward substitution. If some rii=0r_{ii} = 0, the matrix RR is singular and the substitution breaks down at that step. For a QR factorization this happens exactly when AA does not have full column rank, and a rank-revealing method such as QR with column pivoting or the SVD is then needed. To solve a square invertible system Ax=bAx = b with A=QRA = QR, apply QTQ^{\mathsf{T}} and solve Rx=QTbRx = Q^{\mathsf{T}}b. Least squares uses the same step on the first nn coordinates of QTbQ^{\mathsf{T}}b.

In plain words A triangular system can be solved one unknown at a time. The last equation contains only the last unknown, and each equation above it brings in just one new unknown.

Example For the matrix AA above and b=(3,2,7)b = (3, 2, 7),

QTb=13[−1−2−221−22−21][327]=[−7−23].\begin{aligned} Q^{\mathsf{T}}b &= \frac{1}{3}\begin{bmatrix} -1 & -2 & -2 \\ 2 & 1 & -2 \\ 2 & -2 & 1 \end{bmatrix}\begin{bmatrix} 3 \\ 2 \\ 7 \end{bmatrix} \\[0.4em] &= \begin{bmatrix} -7 \\ -2 \\ 3 \end{bmatrix}. \end{aligned}

The triangular solve uses the first two entries. The second equation −2x2=−2-2x_2 = -2 gives x2=1x_2 = 1, and the first equation −3x1−4x2=−7-3x_1 - 4x_2 = -7 then gives x1=1x_1 = 1. The third entry 33 is not used by the solve. It returns below as the residual.

Full and reduced QR

Definition Let A∈Rm×nA \in \mathbb{R}^{m \times n} with m≥nm \ge n. A full QR factorization is A=QRfullA = QR_{\text{full}} with Q∈Rm×mQ \in \mathbb{R}^{m \times m} orthogonal and Rfull∈Rm×nR_{\text{full}} \in \mathbb{R}^{m \times n} upper triangular in its top n×nn \times n block RR and zero in its last m−nm - n rows. Split Q=[ Q1  Q2 ]Q = [\,Q_1 \ \ Q_2\,] into its first nn columns Q1∈Rm×nQ_1 \in \mathbb{R}^{m \times n} and its last m−nm - n columns Q2Q_2. The zero rows of RfullR_{\text{full}} multiply Q2Q_2, so the reduced, or thin, QR factorization is

A=Q1R,Q1TQ1=In.A = Q_1 R, \qquad Q_1^{\mathsf{T}}Q_1 = I_n.

When m>nm > n the matrix Q1Q_1 is not orthogonal, since Q1Q1T≠ImQ_1Q_1^{\mathsf{T}} \ne I_m. If AA has full column rank, then RR is invertible, the columns of Q1Q_1 form an orthonormal basis of the column space of AA, the matrix Q1Q1TQ_1Q_1^{\mathsf{T}} is the orthogonal projector onto that column space, and the columns of Q2Q_2 form an orthonormal basis of its orthogonal complement. In that case the reduced factorization with positive diagonal entries in RR is unique. When m>nm > n the block Q2Q_2 is not unique, since any orthonormal basis of the complement will do. When m=nm = n there is no Q2Q_2, and the full and reduced factorizations coincide.

In plain words For a matrix with independent columns, the full factorization extends an orthonormal basis of the column space to an orthonormal basis of all of Rm\mathbb{R}^m. The reduced one keeps only the part that spans the column space. That part is enough to rebuild AA, but it does not show the residual, which then has to be computed separately.

Example For the matrix AA above, Q1Q_1 consists of the first two columns of QQ, the block Q2Q_2 is the third column (2,−2,1)/3(2, -2, 1)/3, and

A=13[−12−21−2−2][−3−40−2].A = \frac{1}{3}\begin{bmatrix} -1 & 2 \\ -2 & 1 \\ -2 & -2 \end{bmatrix}\begin{bmatrix} -3 & -4 \\ 0 & -2 \end{bmatrix}.

The projector onto the column space is

Q1Q1T=19[54−2452−228].Q_1Q_1^{\mathsf{T}} = \frac{1}{9}\begin{bmatrix} 5 & 4 & -2 \\ 4 & 5 & 2 \\ -2 & 2 & 8 \end{bmatrix}.

Changing the signs of both columns of Q1Q_1 and both rows of RR gives the reduced factorization with positive diagonal,

A=13[1−22−122][3402],A = \frac{1}{3}\begin{bmatrix} 1 & -2 \\ 2 & -1 \\ 2 & 2 \end{bmatrix}\begin{bmatrix} 3 & 4 \\ 0 & 2 \end{bmatrix},

which is what Gram-Schmidt produces from the columns of AA.

Least-squares residual from QR

Definition Let A∈Rm×nA \in \mathbb{R}^{m \times n} with m≥nm \ge n have full column rank and a full QR factorization A=QRfullA = QR_{\text{full}} with Q=[ Q1  Q2 ]Q = [\,Q_1 \ \ Q_2\,] as above, and let b∈Rmb \in \mathbb{R}^m. Because QTQ^{\mathsf{T}} preserves lengths and QTA=RfullQ^{\mathsf{T}}A = R_{\text{full}}, for every x∈Rnx \in \mathbb{R}^n

∥Ax−b∥2=∥QT(Ax−b)∥2=∥Rx−Q1Tb∥2+∥Q2Tb∥2.\begin{aligned} \lVert Ax - b \rVert^2 &= \lVert Q^{\mathsf{T}}(Ax - b) \rVert^2 \\[0.4em] &= \lVert Rx - Q_1^{\mathsf{T}}b \rVert^2 \\[0.4em] &\quad + \lVert Q_2^{\mathsf{T}}b \rVert^2. \end{aligned}

The two terms come from the first nn and the last m−nm - n coordinates, which are perpendicular groups. The second term does not depend on xx. The first is zero exactly for x^=R−1Q1Tb\hat{x} = R^{-1}Q_1^{\mathsf{T}}b, computed by a triangular solve, so x^\hat{x} is the unique least-squares solution, and the minimal residual norm is

∥b−Ax^∥=∥Q2Tb∥.\lVert b - A\hat{x} \rVert = \lVert Q_2^{\mathsf{T}}b \rVert.

The residual itself is r=b−Ax^=b−Q1Q1Tb=Q2Q2Tbr = b - A\hat{x} = b - Q_1Q_1^{\mathsf{T}}b = Q_2Q_2^{\mathsf{T}}b, the component of bb perpendicular to the column space, so ATr=0A^{\mathsf{T}}r = 0. It is zero exactly when bb lies in the column space of AA. Watch for this when only the reduced factorization is kept. The triangular system Rx^=Q1TbR\hat{x} = Q_1^{\mathsf{T}}b is then solved exactly, which says nothing about whether bb lies in the column space. The omitted component still exists and can be computed as b−Q1(Q1Tb)b - Q_1(Q_1^{\mathsf{T}}b).

In plain words In the orthonormal coordinates given by the columns of QQ, the first nn coordinates of bb can be matched exactly and the others cannot be matched at all. Those leftover coordinates make up the residual, and their length is the smallest possible error.

Example For AA and b=(3,2,7)b = (3, 2, 7) above, QTb=(−7,−2,3)Q^{\mathsf{T}}b = (-7, -2, 3) gave x^=(1,1)\hat{x} = (1, 1). The leftover coordinate is 33, so the minimal residual norm is 33, and the residual is 33 times the third column of QQ,

r=(2,−2,1)=(3,2,7)−(1,4,6)=b−Ax^.\begin{aligned} r &= (2, -2, 1) \\[0.4em] &= (3, 2, 7) - (1, 4, 6) \\[0.4em] &= b - A\hat{x}. \end{aligned}

Its length is 4+4+1=3\sqrt{4 + 4 + 1} = 3, and ATr=(2−4+2, 0−4+4)=(0,0)A^{\mathsf{T}}r = (2 - 4 + 2, \, 0 - 4 + 4) = (0, 0). In exact arithmetic the reduced factorization gives the same norm through ∥b∥2−∥Q1Tb∥2=62−53=9\lVert b \rVert^2 - \lVert Q_1^{\mathsf{T}}b \rVert^2 = 62 - 53 = 9. In floating point this difference of squares loses most of its digits when the residual is small, so it is better to compute the vector b−Q1(Q1Tb)b - Q_1(Q_1^{\mathsf{T}}b) directly, or to read the residual norm from the last m−nm - n entries of QTbQ^{\mathsf{T}}b. By contrast, the right-hand side b~=A(1,1)=(1,4,6)\tilde{b} = A(1, 1) = (1, 4, 6) has QTb~=(−7,−2,0)Q^{\mathsf{T}}\tilde{b} = (-7, -2, 0), and the zero last coordinate shows that b~\tilde{b} lies in the column space.

Check yourself

  1. Find the stable Householder vector vv for a=(0,3,4)a = (0, 3, 4) and compute HaHa. What does the algorithm do with the column (−2,0,0)(-2, 0, 0)?
Show the answer

The first entry is 00, so s=1s = 1, and α=5\alpha = 5. Hence v=a+5e1=(5,3,4)v = a + 5e_1 = (5, 3, 4), with vTa=25v^{\mathsf{T}}a = 25 and vTv=50=2 vTav^{\mathsf{T}}v = 50 = 2\,v^{\mathsf{T}}a, so Ha=a−v=(−5,0,0)Ha = a - v = (-5, 0, 0). A zero leading entry is no reason to skip the step, because the tail (3,4)(3, 4) still has to be eliminated.

The column (−2,0,0)(-2, 0, 0) already has a zero tail, so the algorithm uses the identity and leaves it alone. The negative entry −2-2 on the diagonal of RR is perfectly acceptable.

  1. A matrix has the reduced QR factorization A=Q1RA = Q_1R with
Q1=12[111−1111−1],R=[2402].Q_1 = \frac{1}{2}\begin{bmatrix} 1 & 1 \\ 1 & -1 \\ 1 & 1 \\ 1 & -1 \end{bmatrix}, \qquad R = \begin{bmatrix} 2 & 4 \\ 0 & 2 \end{bmatrix}.

For b=(1,2,3,4)b = (1, 2, 3, 4), find the least-squares solution, the residual and its norm.

Show the answer

First Q1Tb=12(1+2+3+4, 1−2+3−4)=(5,−1)Q_1^{\mathsf{T}}b = \tfrac{1}{2}(1 + 2 + 3 + 4, \, 1 - 2 + 3 - 4) = (5, -1). Back substitution gives 2x2=−12x_2 = -1, so x2=−12x_2 = -\tfrac{1}{2}, and then 2x1+4x2=52x_1 + 4x_2 = 5, so x1=72x_1 = \tfrac{7}{2}.

The matrix is A=Q1RA = Q_1R with rows (1,3)(1, 3), (1,1)(1, 1), (1,3)(1, 3) and (1,1)(1, 1), so Ax^=(2,3,2,3)A\hat{x} = (2, 3, 2, 3) and r=b−Ax^=(−1,−1,1,1)r = b - A\hat{x} = (-1, -1, 1, 1), with norm 22. As a check, ∥b∥2−∥Q1Tb∥2=30−26=4\lVert b \rVert^2 - \lVert Q_1^{\mathsf{T}}b \rVert^2 = 30 - 26 = 4, and ATr=(0,0)A^{\mathsf{T}}r = (0, 0). The triangular system was solved exactly, yet the residual is not zero. It is the part of bb that the reduced factorization does not show.

  1. For a=(−4,0,3)a = (-4, 0, 3), find the stable vector vv and HaHa. A classmate always uses v=a+αe1v = a + \alpha e_1, whatever the sign of a1a_1. Check that this also works in exact arithmetic for a=(−4,0,3)a = (-4, 0, 3), and explain what goes wrong for a=(−1,10−4,0)a = (-1, 10^{-4}, 0) when α\alpha is rounded to six significant digits.
Show the answer

Here s=−1s = -1 and α=5\alpha = 5, so v=a−5e1=(−9,0,3)v = a - 5e_1 = (-9, 0, 3), with vTa=45v^{\mathsf{T}}a = 45 and vTv=90v^{\mathsf{T}}v = 90. Then Ha=a−v=(5,0,0)Ha = a - v = (5, 0, 0).

The classmate’s vector is (1,0,3)(1, 0, 3), with vTa=5v^{\mathsf{T}}a = 5 and vTv=10v^{\mathsf{T}}v = 10, so its reflector sends aa to a−v=(−5,0,0)a - v = (-5, 0, 0). That is correct in exact arithmetic, but the first entry 1=α−∣a1∣1 = \alpha - \lvert a_1 \rvert is a difference.

For a=(−1,10−4,0)a = (-1, 10^{-4}, 0) we have α=1+10−8≈1.000000005\alpha = \sqrt{1 + 10^{-8}} \approx 1.000000005, which rounds to 1.000001.00000. The classmate’s first entry becomes −1+1.00000=0-1 + 1.00000 = 0 instead of about 5⋅10−95 \cdot 10^{-9}, so the computed vector is (0,10−4,0)(0, 10^{-4}, 0). Its reflector is diag⁡(1,−1,1)\operatorname{diag}(1, -1, 1), which sends aa to (−1,−10−4,0)(-1, -10^{-4}, 0) and leaves the tail in place. The stable rule computes −1−1.00000=−2.00000-1 - 1.00000 = -2.00000, with no cancellation, and its reflector sends aa to about (1.000000005,−2.5⋅10−13,0)(1.000000005, -2.5 \cdot 10^{-13}, 0).

How this lesson connects