4.5.35 · D5Linear Algebra (Full)

Question bank — Gram-Schmidt orthogonalization — algorithm

1,430 words7 min readBack to topic

Before the questions, three tiny reminders so every symbol is earned:


True or false — justify

Order matters: swapping and can change the resulting orthogonal set.
True — is always the first input untouched, so a different first vector seeds a different chain and generally gives different (though still orthogonal, same-span) results.
Gram–Schmidt preserves the span at every stage: .
True — each is minus a combination of earlier vectors, an invertible triangular change of basis, so no direction is ever gained or lost.
If the inputs are already mutually orthogonal, Gram–Schmidt leaves them unchanged (up to normalization).
True — every projection coefficient is already zero, so nothing gets subtracted and .
The output is orthogonal to all previous , not just the immediately preceding one.
True — we subtract the shadow on every settled at once, and because those are mutually orthogonal the cross terms vanish, killing overlap with each simultaneously.
An orthogonal set of nonzero vectors is automatically linearly independent.
True — if a combination sums to zero, dotting with any isolates its coefficient times , forcing every coefficient to be zero.
Normalizing first (using ) and normalizing last give the same final orthonormal basis.
True — both routes produce the same orthogonal directions; the only difference is when you divide by lengths, and that never rotates a vector.
Gram–Schmidt requires the vectors to live in with the usual dot product.
False — it works in any inner product space (e.g. functions with ); only the meaning of changes.
If some comes out as the zero vector, you made an arithmetic mistake.
False — a zero is the algorithm correctly reporting that was linearly dependent on earlier vectors; the inputs, not your arithmetic, were the problem.
The in the resulting QR decomposition can have zeros on its diagonal.
False for independent inputs — a diagonal zero would mean some , i.e. a dependent vector, which is exactly what independence forbids.

Spot the error

"I'll orthogonalize by subtracting its projection onto instead of ." — where's the flaw?
Here so it happens to be fine for the second vector, but the habit fails from on: projecting onto raw (not orthogonal to ) leaves cross terms and the perpendicularity proof collapses.
"After finding , I normalized it to , then computed ." — what's redundant?
The denominator: once is a unit vector , so it should just be ; keeping the denominator isn't wrong, only mixing conventions carelessly is.
"My set came out orthogonal but I forgot to check it spans the original space." — is that a real worry?
No — the recursion is a triangular, invertible reshuffle of the same vectors, so the span is guaranteed preserved; you never need to re-verify span, only orthogonality if you fear arithmetic slips.
"I got instead of exactly 0, so my method is broken." — diagnosis?
The method is exact; a tiny nonzero is rounding error from finite-precision arithmetic, a known weakness of classical Gram–Schmidt that motivates the numerically stabler modified variant.
"To orthonormalize I divided each by ." — fix it.
You divided by the squared length; the norm is , so use or the resulting vectors won't be unit length.
"I projected onto and but used over in one denominator." — what broke?
The denominator must be , the settled vector dotted with itself; mixing in 's or numerators from different terms scales the shadow wrongly and destroys orthogonality.

Why questions

Why do we subtract the shadow onto and never onto ?
Only the are mutually orthogonal, so their overlaps are independent and removing each separately leaves a clean residual; the still overlap each other, so subtracting their shadows reintroduces overlap.
Why is the projection scalar forced to be exactly ?
It's the unique value making the leftover perpendicular: imposing and solving for leaves no freedom, so orthogonality picks , not our taste.
Why must the input vectors be linearly independent?
A dependent lies entirely in the span of earlier vectors, so subtracting all its shadows removes everything, giving which cannot be normalized (division by zero).
Why does orthogonality make coordinates "decouple"?
In an orthonormal basis the coordinate of a vector along is simply , computable independently of the others — no simultaneous equations, which is exactly why Least squares loves orthogonal bases.
Why is Gram–Schmidt "equivalent" to QR decomposition?
The orthonormal outputs form 's columns, and the projection coefficients you compute along the way are precisely the entries of the upper-triangular that rebuilds the original vectors.
Why normalize at all if we already have perpendicular vectors?
Perpendicularity handles direction; normalizing handles length, and only unit vectors give the clean formulas for coordinates and an actual Orthonormal basis.
Why does the perpendicularity proof rely on induction?
Each step assumes the earlier are already mutually orthogonal to collapse the sum; that assumption must be established for the previous vectors first, which is exactly an inductive chain.

Edge cases

What happens if you feed in a single vector alone?
Nothing to remove — , and normalization gives ; the algorithm is trivially complete.
What if two input vectors are identical, ?
The overlap is total, so , correctly flagging that the pair is dependent.
What if an input vector is the zero vector?
It has no direction, its norm is zero, so it fails independence immediately and cannot be normalized — the input set was invalid from the start.
What if two inputs are already perpendicular but not unit length?
Gram–Schmidt subtracts nothing (their projection coefficient is zero) and only the final normalization step rescales them to unit length.
In an infinite-dimensional inner product space (say polynomials), does Gram–Schmidt still terminate?
For any finite list of inputs, yes — the recursion runs exactly times; the space being infinite-dimensional never matters as long as your input set is finite.
If all inputs lie in a 2-D plane inside , what does the third output look like?
The third vector is dependent on the first two, so its residual is ; the algorithm produces only a 2-D orthogonal set, matching the true dimension of their span.

Recall One-line survival summary

Every trap on this page dissolves into one sentence. The single mantra ::: "Subtract the shadow on every settled , keep the leftover, and let a zero leftover mean dependence."

Connections