Throughout, m, p, X, y, RSS, 0p, and 0m are as in the theorem statement. For v=(v1,…,vp) in Euclidean space Rp and w=(w1,…,wm)∈Rm, the vectors Xv∈Rm and X⊤w∈Rp are matrix-vector products, where X⊤ is the transpose of X; u⋅z denotes the dot product and u−z the difference of points u,z of the same Euclidean space; and dE is the Euclidean distance. All coordinatewise manipulations below use only the arithmetic of real numbers (commutativity, associativity, and distributivity of addition and multiplication, and the ordering of squares), applied to finite sums.
Step 0: Preliminary identities.
(a) Squared distance as a sum of squares. Let k be a natural number and u,z∈Rk. By the definition of the Euclidean distance, dE(u,z) is the nonnegative square root of the nonnegative real number ∑i=1k(ui−zi)2, so by the defining property of the nonnegative square root,
dE(u,z)2=i=1∑k(ui−zi)2=(u−z)⋅(u−z).
In particular three facts follow. First, dE(u,z)2≥0, as a finite sum of squares. Second, dE(u,z)2=dE(z,u)2, since (ui−zi)2=(zi−ui)2 for each i. Third, if dE(u,z)2=0 then u=z: each term (ui−zi)2 is nonnegative, so if the sum is 0 every term is 0, hence ui=zi for every i.
(b) Adjoint identity. For every v∈Rp and w∈Rm,
(Xv)⋅w=v⋅(X⊤w).
Indeed, by the definitions of the matrix-vector product and of the transpose, (X⊤w)i=∑α=1m(X⊤)iαwα=∑α=1mXαiwα for each i∈{1,…,p}, and exchanging the order of the two finite sums (allowed by commutativity and associativity of real addition, together with distributivity) gives
(Xv)⋅w=α=1∑m(i=1∑pXαivi)wα=i=1∑pvi(α=1∑mXαiwα)=i=1∑pvi(X⊤w)i=v⋅(X⊤w).
(c) Linearity in the vector argument. For all β,γ∈Rp and each α∈{1,…,m},
(Xβ−Xγ)α=i=1∑pXαiβi−i=1∑pXαiγi=i=1∑pXαi(βi−γi)=(X(β−γ))α,
so Xβ−Xγ=X(β−γ).
(d) Symmetry of the dot product. For u,z∈Rk we have u⋅z=∑i=1kuizi=∑i=1kziui=z⋅u, by commutativity of real multiplication.
Step 1: The normal equations imply minimality (sufficiency in part 1).
Assume X⊤(y−Xβ^)=0p and write r=y−Xβ^∈Rm. Let β∈Rp be arbitrary. Consider the three points A=Xβ^, B=y, C=Xβ of Rm. Then B−A=r and, using Step 0(c), (b), and (d),
(B−A)⋅(C−A)=r⋅(Xβ−Xβ^)=(X(β−β^))⋅r=(β−β^)⋅(X⊤r)=(β−β^)⋅0p=0,
since a dot product with 0p is a sum of zero terms. Thus B−A and C−A are orthogonal, and the Pythagorean theorem in Euclidean space yields
dE(B,C)2=dE(A,B)2+dE(A,C)2,that is,dE(y,Xβ)2=dE(Xβ^,y)2+dE(Xβ^,Xβ)2.
By the symmetry in Step 0(a), dE(y,Xβ)2=RSS(β) and dE(Xβ^,y)2=dE(y,Xβ^)2=RSS(β^), so
RSS(β)=RSS(β^)+dE(Xβ^,Xβ)2 ≥ RSS(β^),(1)
because dE(Xβ^,Xβ)2≥0 by Step 0(a). Since β was arbitrary, β^ is a least squares estimator.
Step 2: Minimality implies the normal equations (necessity in part 1).
Assume β^ is a least squares estimator. Write r=y−Xβ^ and v=X⊤r∈Rp, and set
S=v⋅v=i=1∑pvi2 ≥0,T=(Xv)⋅(Xv)=α=1∑m(Xv)α2 ≥0.
For each real number t, let β(t)∈Rp be the point with coordinates β(t)i=β^i+tvi for i∈{1,…,p}. By the matrix-vector product formula and distributivity,
(Xβ(t))α=i=1∑pXαi(β^i+tvi)=(Xβ^)α+t(Xv)α(α∈{1,…,m}),
so the coordinates of y−Xβ(t) are rα−t(Xv)α. By Step 0(a), expanding each square,
RSS(β(t))=α=1∑m(rα−t(Xv)α)2=α=1∑mrα2−2tα=1∑mrα(Xv)α+t2α=1∑m(Xv)α2=RSS(β^)−2t((Xv)⋅r)+t2T.
By Step 0(b) and (d), (Xv)⋅r=v⋅(X⊤r)=v⋅v=S. Since β^ is a least squares estimator, RSS(β(t))≥RSS(β^) for every t, which gives
−2tS+t2T ≥ 0for every real t.(2)
Suppose, for contradiction, that S>0. If T=0, taking t=1 in (2) gives −2S≥0, contradicting S>0. If T>0, taking t=S/T in (2) gives −2S2/T+S2/T=−S2/T≥0, contradicting S2/T>0. Hence S=0. Since S is a finite sum of the nonnegative terms vi2, every vi equals 0, that is,
X⊤(y−Xβ^)=v=0p.
Together with Step 1, this proves part 1.
Step 3: Uniqueness of fitted values (part 2).
Let β^ and γ^ both be least squares estimators. Applying the definition of least squares estimator twice, RSS(β^)≤RSS(γ^) and RSS(γ^)≤RSS(β^), so RSS(β^)=RSS(γ^). By part 1 (Step 2), γ^ satisfies the normal equations, so identity (1) of Step 1 holds with γ^ in the role of β^ and β=β^:
RSS(β^)=RSS(γ^)+dE(Xγ^,Xβ^)2.
Subtracting RSS(γ^)=RSS(β^) gives dE(Xγ^,Xβ^)2=0, and by the third fact in Step 0(a), Xβ^=Xγ^.
Step 4: Uniqueness of the estimator (part 3).
Assume that the only v∈Rp with Xv=0m is v=0p, and let β^ and γ^ both be least squares estimators. By part 2 (Step 3), Xβ^=Xγ^, so every coordinate of Xβ^−Xγ^ is 0, that is, Xβ^−Xγ^=0m. By Step 0(c), X(β^−γ^)=0m, so the hypothesis forces β^−γ^=0p. Hence β^i−γ^i=0, i.e. β^i=γ^i, for every i∈{1,…,p}, so β^=γ^. ■