LINEAR-ALGEBRA ยท Unit 16 ยท Video 3 ยท Interactive Practice

Subtract Until Perpendicular: The Gram-Schmidt Process

IKey Formulas

Formula Name Description
proja(b)=aTbaTaโ‹…a\text{proj}_{\mathbf{a}}(\mathbf{b}) = \dfrac{\mathbf{a}^T \mathbf{b}}{\mathbf{a}^T \mathbf{a}} \cdot \mathbf{a} Vector projection Shadow of b\mathbf{b} along a\mathbf{a}
B=bโˆ’proja(b)\mathbf{B} = \mathbf{b} - \text{proj}_{\mathbf{a}}(\mathbf{b}) Perpendicular residual Part of b\mathbf{b} orthogonal to a\mathbf{a}
vkโŠฅ=vkโˆ’โˆ‘j=1kโˆ’1(vjโŠฅ)Tvk(vjโŠฅ)TvjโŠฅโ‹…vjโŠฅ\mathbf{v}_k^{\perp} = \mathbf{v}_k - \displaystyle\sum_{j=1}^{k-1} \frac{(\mathbf{v}_j^{\perp})^T \mathbf{v}_k}{(\mathbf{v}_j^{\perp})^T \mathbf{v}_j^{\perp}} \cdot \mathbf{v}_j^{\perp} Gram-Schmidt (k-th step) Subtract all previous shadows
qk=vkโŠฅโˆฅvkโŠฅโˆฅ\mathbf{q}_k = \dfrac{\mathbf{v}_k^{\perp}}{\lVert \mathbf{v}_k^{\perp} \rVert} Normalization Scale to unit length

IIVisualization 1 โ€” Projection and Residual

Split b\mathbf{b} into a shadow along a\mathbf{a} and a leftover B\mathbf{B} โ€” the leftover is perpendicular to a\mathbf{a} wherever b\mathbf{b} lands.

The cancellation is structural, not a coincidence of this b\mathbf{b}: aT(bโˆ’projab)=aTbโˆ’aTb=0\mathbf{a}^T(\mathbf{b} - \text{proj}_{\mathbf{a}}\mathbf{b}) = \mathbf{a}^T\mathbf{b} - \mathbf{a}^T\mathbf{b} = 0.

IIIVisualization 2 โ€” The Ratio That Lands on Perpendicular

Only one scaling tt of a\mathbf{a} leaves a residual bโˆ’tโ€‰a\mathbf{b} - t\,\mathbf{a} perpendicular to a\mathbf{a} โ€” where does the dot product hit zero?

aโ‹…(bโˆ’tโ€‰a)=aโ‹…bโˆ’tโ€‰โˆฅaโˆฅ2\mathbf{a}\cdot(\mathbf{b} - t\,\mathbf{a}) = \mathbf{a}\cdot\mathbf{b} - t\,\lVert\mathbf{a}\rVert^2 is linear in tt, so it vanishes at exactly one ratio: tโ‹†=aโ‹…baโ‹…at^\star = \dfrac{\mathbf{a}\cdot\mathbf{b}}{\mathbf{a}\cdot\mathbf{a}}.

IVVisualization 3 โ€” Gram-Schmidt, Step by Step

Subtract the shadow, then rescale: a skewed pair a,b\mathbf{a}, \mathbf{b} becomes an orthonormal pair q1,q2\mathbf{q}_1, \mathbf{q}_2 spanning the same plane.

Step 1 โ€” The skewed pair
a=(3,1),b=(1,3)\mathbf{a} = (3, 1),\quad \mathbf{b} = (1, 3)
aโ‹…b=3+3=6โ‰ 0\mathbf{a}\cdot\mathbf{b} = 3 + 3 = 6 \ne 0  (angle โ‰ˆ53ยฐ\approx 53\degree)
Step 2 โ€” Project b onto a
aโ‹…baโ‹…a=610=35\dfrac{\mathbf{a}\cdot\mathbf{b}}{\mathbf{a}\cdot\mathbf{a}} = \dfrac{6}{10} = \tfrac{3}{5}
proj=35a=(1.8,ย 0.6)\text{proj} = \tfrac{3}{5}\mathbf{a} = (1.8,\ 0.6)
Step 3 โ€” Subtract to get orthogonal B
B=bโˆ’proj=(1,3)โˆ’(1.8,0.6)=(โˆ’0.8,ย 2.4)\mathbf{B} = \mathbf{b} - \text{proj} = (1,3) - (1.8, 0.6) = (-0.8,\ 2.4)
Aโ‹…B=3(โˆ’0.8)+1(2.4)=0ย โœ“\mathbf{A}\cdot\mathbf{B} = 3(-0.8) + 1(2.4) = 0\ \checkmark
Step 4 โ€” Normalize to orthonormal
q1=AโˆฅAโˆฅ=(3,1)10โ‰ˆ(0.95,ย 0.32)\mathbf{q}_1 = \dfrac{\mathbf{A}}{\lVert\mathbf{A}\rVert} = \dfrac{(3,1)}{\sqrt{10}} \approx (0.95,\ 0.32)
q2=BโˆฅBโˆฅโ‰ˆ(โˆ’0.32,ย 0.95)\mathbf{q}_2 = \dfrac{\mathbf{B}}{\lVert\mathbf{B}\rVert} \approx (-0.32,\ 0.95)
โˆฅq1โˆฅ=โˆฅq2โˆฅ=1,q1โ‹…q2=0\lVert\mathbf{q}_1\rVert = \lVert\mathbf{q}_2\rVert = 1,\quad \mathbf{q}_1\cdot\mathbf{q}_2 = 0

In 2D both bases span the whole plane; the real payoff appears in higher dimensions, where each new vector stays a combination of the originals, so the subspace is preserved exactly while its directions turn orthonormal.

VQuiz

Question 1

In the video's worked example, a=(1,1,1)\mathbf{a} = (1, 1, 1) and b=(1,0,2)\mathbf{b} = (1, 0, 2).

What is the projection ratio aTbaTa\dfrac{\mathbf{a}^T \mathbf{b}}{\mathbf{a}^T \mathbf{a}}?

โœ… Correct! Both the dot product and the squared norm equal 3, so the ratio is 3/3 = 1.

โŒ Not quite. Compute numerator (aยทb) and denominator (aยทa) separately, then divide.

Show solution

Solution:

Numerator: aTb=1โ‹…1+1โ‹…0+1โ‹…2=1+0+2=3\mathbf{a}^T \mathbf{b} = 1 \cdot 1 + 1 \cdot 0 + 1 \cdot 2 = 1 + 0 + 2 = 3

Denominator: aTa=12+12+12=1+1+1=3\mathbf{a}^T \mathbf{a} = 1^2 + 1^2 + 1^2 = 1 + 1 + 1 = 3

Ratio: 33=1\dfrac{3}{3} = 1

This means we subtract exactly one full copy of a\mathbf{a} from b\mathbf{b} to get the perpendicular residual.

Question 2

True or False: After applying the Gram-Schmidt process, the new orthogonal vectors span a different subspace than the original vectors.

โœ… Correct! Gram-Schmidt only changes the basis โ€” the subspace itself is preserved.

โŒ Not quite. Think about how each new vector is built: it's always a linear combination of the originals.

Show solution

Solution: False.

Gram-Schmidt preserves the subspace. Each new orthogonal vector is constructed as a linear combination of the original vectors:

B=bโˆ’aTbaTaโ‹…a\mathbf{B} = \mathbf{b} - \frac{\mathbf{a}^T \mathbf{b}}{\mathbf{a}^T \mathbf{a}} \cdot \mathbf{a}

Since B\mathbf{B} is a combination of a\mathbf{a} and b\mathbf{b}, it lies in the same plane they span. Every point reachable by combining a\mathbf{a} and b\mathbf{b} is also reachable by combining A\mathbf{A} and B\mathbf{B} (or q1\mathbf{q}_1 and q2\mathbf{q}_2).

As the video states: "The plane hasn't moved. Only the signposts within it changed."

Question 3

Continuing the video's example: A=(1,1,1)\mathbf{A} = (1, 1, 1), b=(1,0,2)\mathbf{b} = (1, 0, 2), and the projection ratio is 11.

What is the residual vector B=bโˆ’1โ‹…A\mathbf{B} = \mathbf{b} - 1 \cdot \mathbf{A}?

โœ… Correct! And you can verify: A ยท B = 1(0) + 1(โˆ’1) + 1(1) = 0. Perpendicular! โœ“

โŒ Not quite. Subtract component by component: (1, 0, 2) โˆ’ (1, 1, 1). Watch the signs carefully.

Show solution

Solution:

B=bโˆ’1โ‹…A=(1,0,2)โˆ’(1,1,1)\mathbf{B} = \mathbf{b} - 1 \cdot \mathbf{A} = (1, 0, 2) - (1, 1, 1)

Component by component:

  • 1โˆ’1=01 - 1 = 0
  • 0โˆ’1=โˆ’10 - 1 = -1
  • 2โˆ’1=12 - 1 = 1

B=(0,โˆ’1,1)\mathbf{B} = (0, -1, 1)

Verification: Aโ‹…B=1(0)+1(โˆ’1)+1(1)=0โˆ’1+1=0โœ“\mathbf{A} \cdot \mathbf{B} = 1(0) + 1(-1) + 1(1) = 0 - 1 + 1 = 0 \checkmark

The dot product is zero, confirming A\mathbf{A} and B\mathbf{B} are orthogonal.

Question 4

In the Gram-Schmidt process applied to a set of 5 linearly independent vectors, how many projection terms must be subtracted when orthogonalizing the 5th vector?

โœ… Correct! The k-th vector requires (k โˆ’ 1) projection subtractions โ€” one for each direction already established.

โŒ Not quite. The k-th vector subtracts projections onto vectors 1 through (k โˆ’ 1). How many terms is that when k = 5?

Show solution

Solution:

The general Gram-Schmidt formula for the kk-th vector is:

vkโŠฅ=vkโˆ’โˆ‘j=1kโˆ’1(vjโŠฅ)Tvk(vjโŠฅ)TvjโŠฅโ‹…vjโŠฅ\mathbf{v}_k^{\perp} = \mathbf{v}_k - \sum_{j=1}^{k-1} \frac{(\mathbf{v}_j^{\perp})^T \mathbf{v}_k}{(\mathbf{v}_j^{\perp})^T \mathbf{v}_j^{\perp}} \cdot \mathbf{v}_j^{\perp}

For k=5k = 5, the sum runs from j=1j = 1 to j=4j = 4, giving 4 projection subtractions.

The pattern:

Vector Projections subtracted
k=1k = 1 0 (accepted as is)
k=2k = 2 1
k=3k = 3 2
k=4k = 4 3
k=5k = 5 4

Each new vector must remove its shadow from every previously established orthogonal direction.

Solved: 0 / 4