4.5.35 · D4Linear Algebra (Full)

Exercises — Gram-Schmidt orthogonalization — algorithm

1,742 words8 min readBack to topic

This page is a graded workout for Gram-Schmidt orthogonalization — algorithm. Every problem uses only the one tool the parent built: remove the overlap (projection), keep the leftover. Try each before opening the solution.

For and in the plane, . In 3D you add a third product . That is the only arithmetic you need.

Figure — Gram-Schmidt orthogonalization — algorithm

Level 1 — Recognition

L1.1

State the projection coefficient so that is perpendicular to , and say in words why that exact value works.

Recall Solution

Why: we demand . Expand: , solve for . The value is not a guess — it is forced by requiring zero leftover overlap. Look at the right triangle in the figure above: is the base (shadow) and is the vertical leg meeting it at a right angle.

L1.2

Given , , write down with no computation and explain.

Recall Solution

. Why: the very first vector has nothing earlier to be perpendicular to, so there is no overlap to subtract. Gram–Schmidt always starts by copying .

L1.3

Compute and for , .

Recall Solution

. . These are exactly the two numbers you feed into the coefficient .


Level 2 — Application

L2.1

Orthogonalize , (do not normalize).

Recall Solution

. ; ; so . Check: ✅. The leftover points straight up, perpendicular to the horizontal .

L2.2

Take the orthogonal pair from L2.1 and normalize it into an Orthonormal basis.

Recall Solution

, so . , so . The orthonormal set is the standard basis — clean and unit length.

L2.3

Orthonormalize , .

Recall Solution

. ; ; . Check: ✅. Normalize: ; .

Figure — Gram-Schmidt orthogonalization — algorithm

Level 3 — Analysis

L3.1

Orthogonalize , , in .

Recall Solution

, . ; : . Now : subtract overlaps with both and . , coefficient . , coefficient . Check: ✅; ✅.

L3.2

Explain, using the perpendicularity proof, why in L3.1 needed two subtractions but needed only one.

Recall Solution

When we build we must make it perpendicular to every already-settled vector . For there is one earlier vector () → one subtraction. For there are two () → two subtractions. Each subtraction kills the overlap with exactly one clean direction, and because those clean directions are already mutually orthogonal, the subtractions do not interfere (this is why we project onto the , not the raw — see Orthogonal projection).

L3.3

Without full computation, decide which vector will collapse: orthogonalize , , .

Recall Solution

. For : , so . because is just — it lies entirely in the span of , leaving zero leftover. This signals the input set is not linearly independent (see Linear independence). You cannot normalize a zero vector (division by zero).


Level 4 — Synthesis

L4.1

Gram–Schmidt on the columns of produces (see QR decomposition). For , (the parent's Example 1), find (orthonormal columns ) and (upper-triangular).

Recall Solution

From the parent: , . , . entries are the projection/length data: , , and . Sanity: is upper-triangular (zero below the diagonal) and , which equals ✅.

L4.2

Use the normalized form of the recursion, , to orthonormalize , . Show why no denominators appear.

Recall Solution

already unit length. . Then , already unit, so . Why no denominator: when we project onto a unit vector , the coefficient is . The self-inner-product is , so the division disappears.


Level 5 — Mastery

L5.1

Orthonormalize the polynomials on using the inner product . (This is Inner product spaces with functions instead of arrows.)

Recall Solution

, so . Overlap of with : (odd function). So . , so and . Insight: the machine is identical — dot products just became integrals. These are the first two (normalized) Legendre polynomials.

L5.2

Prove that if the input vectors are linearly dependent, Gram–Schmidt outputs a zero vector at the first dependent step — and connect this to why the process detects dependence.

Recall Solution

Suppose (the spans match by construction). Write . The Gram–Schmidt formula subtracts precisely the projection onto that span: Because the are orthogonal, , so the sum reconstructs exactly, giving . A zero residual means "nothing new" — no perpendicular leftover exists because added no new direction. Thus a zero is Gram–Schmidt's built-in dependence detector.

L5.3

Least-squares tie-in (Least squares): using the orthonormal , , express in that basis and state its coordinates. Then explain why an orthonormal basis makes the coordinates just dot products.

Recall Solution

Coordinate along : . Along : . So . Why so easy: in a general basis you'd solve a linear system. With an orthonormal basis, each coordinate decouples: , one independent dot product per axis. This is exactly why least squares uses Gram–Schmidt — the normal equations become diagonal (no cross-terms), so each best-fit coefficient is read off directly.


Recall Self-test recap

Every settled vector needs its own denominator ::: , recomputed each time. A zero residual means ::: the input set was linearly dependent. Coordinates in an orthonormal basis are ::: single dot products . in a QR equals ::: .

Connections