Orthonormal columns give QᵀQ=I, so projection and least squares collapse into dot products; Gram-Schmidt turns any independent columns into orthonormal ones and yields A=QR.
Put them in the columns of Q. The condition becomes
Q⊤Q=I.
That is the cleanest formula in the chapter.
An immediate consequence
Orthonormal vectors are automatically independent. If ∑ciqi=0, take the dot product with qj:
cj=0.
All coefficients vanish, so the vectors are independent.
Timeline
Time
Topic
0:07
Orthonormal vectors
3:17
QTQ=I
4:37
Ones on the diagonal, zeros elsewhere
6:36
Orthogonal matrices are square
13:42
Permutation matrices are orthogonal
15:11
Rectangular matrices with orthonormal columns
17:38
Why orthonormal columns help
19:31
The projection meaning of QQT
23:42
Only a left inverse in the rectangular case
25:27
Gram-Schmidt begins
26:54
Producing q1,q2 from a1,a2
29:48
Subtracting the projection
31:04
The error vector is the perpendicular piece
38:35
A numerical example with two vectors
41:29
Normalizing to get q1,q2
45:04
A and Q span the same column space
46:28
The R in A=QR
Orthogonal matrices
When Q is square, Q⊤Q=I gives
Q⊤=Q−1.
Such a square matrix is called an orthogonal matrix. Note the terminology: a rectangular matrix only has "orthonormal columns"; only the square case earns the name orthogonal matrix.
Examples
Permutation matrix:
Q=010001100.
Each column is a coordinate unit vector, and they are mutually orthogonal.
Rotation matrix:
Q=[cosθsinθ−sinθcosθ].
Both columns are unit vectors and their dot product is −cosθsinθ+sinθcosθ=0.
Hadamard matrix:
Q=21[111−1].
The four-by-four version is
Q=2111111−11−111−1−11−1−11.
Orthogonal matrices with only ±1 entries exist for some sizes; exactly which sizes admit them is still open.
Rectangular case
Q need not be square. For instance
Q=31122−2−12
has two orthonormal columns but is 3×2. Then
Q⊤Q=I2,QQ⊤=I3.
QQ⊤ is a rank-2 projection matrix.
Why orthonormal columns are better
No inversion in the projection
The general formula is
P=A(A⊤A)−1A⊤.
With A=Q, Q⊤Q=I, so the inverse disappears:
P=QQ⊤.
If Q is also square, QQ⊤=I: projection onto the whole space is the identity.
The two properties still hold:
(QQ⊤)⊤=QQ⊤,(QQ⊤)2=Q(Q⊤Q)Q⊤=QQ⊤.
Least squares becomes a dot product
The normal equations Q⊤Qx^=Q⊤b reduce to
x^=Q⊤b.
Component by component,
x^i=qi⊤b.
In words: each coefficient is the projection of b onto the i-th basis vector. No system to solve, no inverse.
This is the shared structure of Fourier series, spherical harmonics, and much of applied mathematics: in an orthonormal basis, coefficients come directly from inner products.
Gram-Schmidt: from independent to orthonormal
Given independent a,b,c, construct orthonormal vectors.
Two vectors
Step one: keep the first direction.
A=a.
Step two: subtract from b its projection onto A.
B=b−A⊤AA⊤bA.
The remainder is perpendicular to A. Check:
A⊤B=A⊤b−A⊤AA⊤bA⊤A=0.
Finally normalize:
q1=∥A∥A,q2=∥B∥B.
Three vectors
The third vector must lose its components along both directions already built:
C=c−A⊤AA⊤cA−B⊤BB⊤cB.
Normalize to get q3.
In general, step k subtracts the projections onto all earlier directions:
vk=ak−i=1∑k−1qi⊤qiqi⊤akqi.
(If the earlier vectors are already normalized, the denominators are 1.)
A numerical example
Take
a=111,b=102.
Step one:
A=111,A⊤A=3,A⊤b=1+0+2=3.
Step two:
B=b−33A=102−111=0−11.
Check: A⊤B=0−1+1=0.
Step three, normalize:
q1=31111,q2=210−11.
The column space does not change
Gram-Schmidt only subtracts projections and rescales, so Q and A have the same column space. It merely replaces one basis by a better one: from independent but skewed to orthonormal.
The A=QR factorization
If the columns of A are a1,…,an, Gram-Schmidt produces Q with
A=QR,
where R is upper triangular.
For two columns:
[a1a2]=[q1q2][q1⊤a10q1⊤a2q2⊤a2].
Why is the lower-left entry zero? Because q2 was constructed orthogonal to a1:
q2⊤a1=0.
More generally, the j-th column uses only q1,…,qj, so column j of R is zero below row j — exactly upper triangular.
Analogy with LU
Factorization
Purpose
Structure
A=LU
Elimination
lower triangular × upper triangular
A=QR
Orthogonalization
orthonormal columns × upper triangular
Both split a matrix into better-structured factors. QR is especially important numerically: solving least squares with QR is more stable than forming (A⊤A)−1 directly.
Takeaways
Orthonormal columns satisfy Q⊤Q=I; for a square matrix Q⊤=Q−1, and it is called orthogonal.
Orthonormal vectors are automatically independent.
Projection reduces to QQ⊤, and least-squares coefficients to x^i=qi⊤b.
Gram-Schmidt builds orthogonal directions by subtracting projections, then normalizes.
A=QR with R upper triangular; the column space is unchanged.
Check your understanding
1. Why are orthonormal vectors necessarily independent? Write the dot-product proof.
Reference answer: Suppose
c1q1+c2q2+⋯+cnqn=0.
Take the dot product with qj and use qi⊤qj=δij:
c1(q1⊤qj)+⋯+cn(qn⊤qj)=cj⋅1=cj.
The left side equals 0⊤qj=0, so cj=0. Since j is arbitrary, all coefficients vanish and the set is independent.
The point is that orthogonality turns "solve a system" into "take dot products": each coefficient is isolated.
2. For rectangular Q with Q⊤Q=I, why is QQ⊤=I? What is its rank?
Reference answer: Let Q be m×n with n<m, as in the lecture's 3×2 example. The relation Q⊤Q=In says only that the n columns are orthonormal; but QQ⊤ is m×m.
By the rank inequality
rank(QQ⊤)≤rank(Q)=n<m,
the rank of QQ⊤ is at most n, so it cannot be the full-rank Im. Geometrically, QQ⊤ projects Rm onto the n-dimensional column space of Q, collapsing every orthogonal direction to zero, whereas Im preserves all directions. Only for square Q does QQ⊤=I hold.
3. Apply Gram-Schmidt to a=(1,0,0) and b=(1,1,0); write Q and R.
Reference answer: Step one: A=a=(1,0,0), with A⊤A=1 and A⊤b=1.
Step two, subtract the projection:
B=b−A⊤AA⊤bA=(1,1,0)−1⋅(1,0,0)=(0,1,0).
Both are already unit vectors, so normalizing changes nothing:
q1=(1,0,0)⊤,q2=(0,1,0)⊤,Q=100010.
The entries of R are rij=qi⊤aj for i≤j, and zero otherwise:
R=[q1⊤a0q1⊤bq2⊤b]=[1011].
Check:
QR=100010[1011]=100110,
whose two columns are exactly a and b.
4. Why is the lower-left entry of R zero, and how does the construction force it?
Reference answer: The entries are rij=qi⊤aj. For i>j we must show qi⊥aj.
When Gram-Schmidt builds qi, it starts from ai and subtracts its projections onto q1,…,qi−1, so qi is orthogonal to all earlier q1,…,qi−1. Since aj with j<i lies in span{q1,…,qj}⊆span{q1,…,qi−1}, we get qi⊥aj, i.e. rij=0.
So R is zero below the diagonal — the upper triangular structure is a direct consequence of "column j uses only the first j orthogonal directions."
5. In an orthonormal basis, why is the i-th least-squares coefficient exactly qi⊤b?
Reference answer: With orthonormal columns, A=Q and Q⊤Q=I. The normal equations
Q⊤Qx^=Q⊤b
have Q⊤Q=I on the left, giving directly
x^=Q⊤b.
Componentwise, the i-th coefficient is
x^i=qi⊤b,
the inner product of b with the i-th basis vector.
The reason is that an orthonormal basis removes the cross terms: in general the i-th equation couples to the other coefficients and the system must be solved jointly; when qi⊤qj=0 for i=j, each equation contains a single unknown, and every coefficient is projected out independently. This is the common source of "coefficient equals inner product" in Fourier series and spherical harmonic expansions.
How this connects to the course
This lecture closes the orthogonality chapter: from orthogonal vectors and subspaces to orthogonal bases and orthogonal matrices. The next chapter turns to determinants, where the determinant of Q, volume, and the geometry of orthogonal transformations reappear.