Euler Hall — free maths guides

Subtract one projection in a Gram-Schmidt step

Compute the coefficient aT b / aT a and explain why the denominator is the squared length. The idea in plain words, a worked example, and a check with the answers shown — part of the free Linear Algebra guides.

The formula, and where each piece comes from

Given an earlier directionaa and a new vectorbb, the second orthogonal vector is B=b−aTbaTa a.B=b-\frac{a^Tb}{a^Ta}\,a.

The coefficient is not a convention — it is forced.BB must be a multiple ofaa subtracted frombb, sayB=b−taB=b-ta, and it must satisfyaTB=0a^TB=0. That gives aT(b−ta)=aTb−t aTa=0⟹t=aTbaTa.a^T(b-ta)=a^Tb-t\,a^Ta=0\quad\Longrightarrow\quad t=\frac{a^Tb}{a^Ta}.

Read the two dots as answering two questions: -aTba^Tb — how much ofbb points alongaa. -aTaa^Ta — how longaa is, squared. This converts that amount into a multiple of the vectoraa.

The first step, for completeness.A=aA=a: the first direction is accepted as it comes, with no subtraction. Normalising happens at the end, once per vector — never before the projections.

The step in four moves, in order. Both dots, then the division, then the subtraction, then the checkaTB=0a^TB=0. Each move needs the one before it.

Why the check is worth the one multiplication

Every failure mode of this step shows up in the same number.

The check isaTBa^TB, and it must be zero. Compute it before moving on, and each possible slip is diagnosed by it:

| what went wrong |aTBa^TB | |---|---| | forgot the division |aTb−aTb (aTa)≠0a^Tb-a^Tb\,(a^Ta)\ne0 | | inverted the fraction |aTb−aTaaTb(aTa)≠0a^Tb-\frac{a^Ta}{a^Tb}(a^Ta)\ne0 | | added instead of subtracting |2aTb≠02a^Tb\ne0 | | leftbb unchanged |aTb≠0a^Tb\ne0 |

The check does not tell you which of the four happened — but you know it is one of them, and the four are easy to tell apart by looking at your coefficient.

Why the check is exactly the condition.BB was defined as the leftover after the projection came off. That leftover is perpendicular toaa precisely when the coefficient was the projection coefficient. So the check is not a heuristic; it is the definition restated.

Why the step generalises. With two earlier vectorsAA andB1B_1, the third vector subtracts two projections, and the check is two dots. Withkk earlier vectors,kk projections andkk dots. The idea never changes; only the count does.

Worked example: the textbook's pair, and a third vector

Run Gram-Schmidt ona=(1,−1,0)a=(1,-1,0),b=(2,0,−2)b=(2,0,-2),c=(3,−3,3)c=(3,-3,3).

First.A=aA=a,ATA=1+1+0=2A^TA=1+1+0=2.

Second.ATb=2+0+0=2A^Tb=2+0+0=2, sot=22=1t=\frac22=1 and B=b−1⋅A=[20−2]−[1−10]=[11−2].B=b-1\cdot A=\begin{bmatrix}2\\0\\-2\end{bmatrix}-\begin{bmatrix}1\\-1\\0\end{bmatrix}=\begin{bmatrix}1\\1\\-2\end{bmatrix}. Check:ATB=1−1+0=0A^TB=1-1+0=0 ✓ andBTB=6B^TB=6.

Third.ATc=3+3+0=6A^Tc=3+3+0=6 andBTc=3−3−6=−6B^Tc=3-3-6=-6, so C=c−62A−−66B=[3−33]−3[1−10]+1[11−2]=[111].\def\arraystretch{1.6}C=c-\frac62A-\frac{-6}{6}B=\begin{bmatrix}3\\-3\\3\end{bmatrix}-3\begin{bmatrix}1\\-1\\0\end{bmatrix}+1\begin{bmatrix}1\\1\\-2\end{bmatrix}=\begin{bmatrix}1\\1\\1\end{bmatrix}. Check both:ATC=1−1+0=0A^TC=1-1+0=0 ✓ andBTC=1+1−2=0B^TC=1+1-2=0 ✓

The lengths.∥A∥2=2\|A\|^2=2,∥B∥2=6\|B\|^2=6,∥C∥2=3\|C\|^2=3, soq1=12Aq_1=\frac{1}{\sqrt2}A,q2=16Bq_2=\frac{1}{\sqrt6}B,q3=13Cq_3=\frac{1}{\sqrt3}C.

The one mistake this example catches. Usingbb instead ofBB in the third projection.bb is not orthogonal toAA, so subtracting along it removes part of theAA-direction again and leaves aCC withATC≠0A^TC\ne0. Here that would giveC=c−62A−bTcbTbbC=c-\frac62A-\frac{b^Tc}{b^Tb}b, andbTc=6−0−6=0b^Tc=6-0-6=0, so this particular pair happens to survive — which is exactly why you check rather than assume.

By the end you can
  • Compute the coefficient a^T b / a^T a and explain why the denominator is the squared length
  • Form B = b - (a^T b / a^T a) a and verify a^T B = 0
  • Put the steps of one Gram-Schmidt step in order and name the first line that goes wrong
Test yourself

(a) Fora=(1,0,1)a=(1,0,1) andb=(2,1,0)b=(2,1,0), what coefficient does the step use? (b) What is the first thing to compute if you suspect yourBB is wrong? (c) In the step, isBB guaranteed nonzero?

Answers

(a)aTb=2+0+0=2a^Tb=2+0+0=2 andaTa=2a^Ta=2, sot=1t=1 andB=b−a=(1,1,−1)B=b-a=(1,1,-1).

(b)aTBa^TB. If it is not zero, the coefficient or the sign is wrong.

(c) Only ifbb is not a multiple ofaa. Ifbb is a multiple,B=0B=\mathbf{0} and the process stops and reports dependence — which is the next skill.

Work out where to start — free, no accountAnswer six real questions — free, no account