Why a Quadratic Sum Has a Geometric Meaning
A sum of squares is often introduced as a calculation on coordinates. But a quadratic form such as \(y^\mathsf{T}Py\) also has a geometric interpretation: when \(P\) is an orthogonal projection matrix, the form is the squared length of the component of \(y\) lying in a particular subspace. This viewpoint explains why certain sums of squares add exactly, before any probability distribution or inference is considered.
Throughout, vectors belong to \(\mathbb{R}^n\), with the usual inner product \(x^\mathsf{T}y\) and squared length \(\|x\|^2=x^\mathsf{T}x\). A matrix \(P\) is an orthogonal projection when it maps each vector to its nearest point in a subspace, using this inner product.
Quadratic Forms as Projection Lengths
The two matrix conditions have distinct geometric roles. Symmetry makes the projection orthogonal, so the leftover vector is perpendicular to the projected subspace. Idempotence means that applying the projection a second time changes nothing. Together, they give a direct identity between the quadratic form and a squared length.
Proof. First, \(Py\) belongs to \(\mathcal{C}(P)\). For any \(x\in\mathbb{R}^n\), idempotence gives \(P(y-Py)=Py-P^2y=0\). Therefore, for every \(x\), \((Px)^\mathsf{T}(y-Py)=x^\mathsf{T}P^\mathsf{T}(y-Py)=x^\mathsf{T}P(y-Py)=0\). Thus \(y-Py\) is orthogonal to every vector in the range of \(P\), including \(Py\). Also, \(\|Py\|^2=(Py)^\mathsf{T}(Py)=y^\mathsf{T}P^\mathsf{T}Py=y^\mathsf{T}P^2y=y^\mathsf{T}Py\). Finally, \(y=Py+(y-Py)\) is a sum of orthogonal vectors, so the Pythagorean identity gives \(\|y\|^2=\|Py\|^2+\|y-Py\|^2\). \(\square\)
The same reasoning also shows why the conditions matter. An arbitrary matrix may define a quadratic form, but without symmetry and idempotence it need not be an orthogonal projection, and its quadratic form need not equal the squared length of the transformed vector.
Worked Example: Projecting Onto a Line in Three Dimensions
Let \(u=(1,1,0)^\mathsf{T}\), and project \(y=(2,0,3)^\mathsf{T}\) onto the line spanned by \(u\). Since \(u^\mathsf{T}u=2\), the projection matrix is \(P=uu^\mathsf{T}/(u^\mathsf{T}u)=\frac12\begin{pmatrix}1&1&0\\1&1&0\\0&0&0\end{pmatrix}\).
Multiplication gives \(Py=(1,1,0)^\mathsf{T}\). Hence the squared projected length is \(\|Py\|^2=1^2+1^2+0^2=2\). Directly, \(y^\mathsf{T}Py=(2,0,3)(1,1,0)^\mathsf{T}=2\), confirming the quadratic-form identity.
The residual is \(y-Py=(1,-1,3)^\mathsf{T}\). Its inner product with \(u\) is \(1-1+0=0\), so it is perpendicular to the projection line. Its squared length is \(1+1+9=11\), while \(\|y\|^2=2^2+0^2+3^2=13\). The decomposition checks: \(2+11=13\).
Worked Example: A Projection Matrix and Its Quadratic Form
Take \(u=(1,2)^\mathsf{T}\), so \(u^\mathsf{T}u=5\). Projection onto its span is represented by \(P=uu^\mathsf{T}/5=\frac15\begin{pmatrix}1&2\\2&4\end{pmatrix}\). For \(y=(4,1)^\mathsf{T}\), the inner product \(u^\mathsf{T}y=6\), giving \(Py=(6/5)u=(6/5,12/5)^\mathsf{T}\).
The projected squared length is \((6/5)^2+(12/5)^2=180/25=36/5\). The quadratic form gives the same value: \(y^\mathsf{T}Py=(4,1)(6/5,12/5)^\mathsf{T}=24/5+12/5=36/5\). The residual is \((14/5,-7/5)^\mathsf{T}\), with squared length \(196/25+49/25=49/5\). Since \(\|y\|^2=17=85/5\), the projected and residual lengths sum to \(36/5+49/5=17\).
Orthogonal Subspaces Give Additive Sums of Squares
The one-projection identity extends to several subspaces. Suppose a vector is split into components lying in mutually orthogonal subspaces. The squared length of the whole vector is then the sum of the squared lengths of those components. Projection matrices express each component as a quadratic form.
Proof. Set \(v_i=P_i y\). For \(i\ne j\), symmetry and the assumed product condition give \(v_i^\mathsf{T}v_j=y^\mathsf{T}P_i^\mathsf{T}P_jy=y^\mathsf{T}P_iP_jy=0\). Thus the vectors \(v_i\) are pairwise orthogonal. Also, by the projection identity, \(\|v_i\|^2=y^\mathsf{T}P_i y\). Expanding the squared length of their sum, every cross-product is zero, so \(\|\sum_i v_i\|^2=\sum_i\|v_i\|^2=\sum_i y^\mathsf{T}P_i y\). If \(\sum_iP_i=I\), then \(\sum_i v_i=y\), proving the complete decomposition.
For the remaining case, write \(S=\sum_iP_i\). The matrices \(P_i\) are symmetric, so \(S\) is symmetric. The pairwise product conditions and idempotence imply \(S^2=\sum_iP_i^2+\sum_{i\ne j}P_iP_j=\sum_iP_i=S\). Consequently \(R=I-S\) is symmetric and idempotent, and \(P_iR=P_i-P_iS=0\) for every \(i\). The projection \(Ry\) is therefore orthogonal to each \(P_i y\). Since \(y=Sy+Ry=\sum_iP_i y+Ry\), the Pythagorean identity gives the claimed decomposition including \(y^\mathsf{T}Ry=\|Ry\|^2\). \(\square\)
Worked Example: Decomposing a Vector Into Three Orthogonal Components
In \(\mathbb{R}^3\), take \(u=(1,1,0)^\mathsf{T}\), \(v=(1,-1,2)^\mathsf{T}\), and \(w=(1,-1,-1)^\mathsf{T}\). Their pairwise inner products are \(u^\mathsf{T}v=1-1=0\), \(u^\mathsf{T}w=1-1=0\), and \(v^\mathsf{T}w=1+1-2=0\). Their squared lengths are \(2\), \(6\), and \(3\), respectively. For \(y=(3,1,2)^\mathsf{T}\), the projections onto these three lines are \((u^\mathsf{T}y)/(u^\mathsf{T}u)\,u=2u\), \((v^\mathsf{T}y)/(v^\mathsf{T}v)\,v=v\), and \((w^\mathsf{T}y)/(w^\mathsf{T}w)\,w=0\).
Thus \(y=2u+v+0w\). The three component squared lengths are \(4\|u\|^2=8\), \(\|v\|^2=6\), and \(0\). Their sum is \(14\), which equals \(\|y\|^2=3^2+1^2+2^2=14\). Because the three nonzero orthogonal directions span \(\mathbb{R}^3\), there is no leftover component.
From Projection Lengths to Total Variation
A total sum of squares is a squared length measured from a chosen reference vector. If \(b\) is that reference and \(z=y-b\) is the deviation vector, then the total squared deviation is \(\|z\|^2\). Whenever \(z\) is resolved into orthogonal components, this total is the sum of their squared lengths. For example, if \(P_1,\ldots,P_k\) project onto orthogonal spaces and \(R\) projects onto the remaining orthogonal space, then \(\|y-b\|^2=\sum_i (y-b)^\mathsf{T}P_i(y-b)+(y-b)^\mathsf{T}R(y-b)\).
The reference \(b\) must be stated: changing it changes the deviation vector and therefore the total. Likewise, an additive identity is justified by orthogonality, not simply by naming several pieces of a calculation “components.” In applications, projection spaces encode which directions of variation are being separated; the geometric identity is what guarantees that their squared lengths add without cross-terms.
Common Mistakes and Why the Geometry Matters
- Assuming every quadratic form is a squared length. The equality \(y^\mathsf{T}Py=\|Py\|^2\) uses both \(P^\mathsf{T}=P\) and \(P^2=P\). Without these, it is not generally true.
- Adding components that are not orthogonal. For arbitrary \(a\) and \(b\), \(\|a+b\|^2=\|a\|^2+\|b\|^2+2a^\mathsf{T}b\). The cross-term disappears only when \(a^\mathsf{T}b=0\).
- Assuming the displayed pieces exhaust the total. A collection of orthogonal projections partitions the entire vector only if their projection matrices sum to \(I\). Otherwise, the remaining projection contributes another nonnegative squared length.
- Mixing a reference point with a projection origin. The projection formula applies to the vector being projected. To decompose deviations from \(b\), apply the projections to \(y-b\), not automatically to \(y\).
These facts matter because they let a sums-of-squares calculation be checked geometrically: verify the projection conditions, verify orthogonality of the component spaces, and identify any leftover space. This establishes the algebraic decomposition without requiring a distributional assumption.
Check Your Understanding
Use the projection and orthogonality identities to answer the following.
- What two matrix conditions ensure that \(P\) is an orthogonal projection, and what does each condition contribute?
- If \(P\) is an orthogonal projection, explain why \(y^\mathsf{T}Py\) equals the squared length of \(Py\).
- For two orthogonal component vectors \(a\) and \(b\), why does the squared length of their sum equal the sum of their squared lengths?
- If mutually orthogonal projection matrices do not sum to \(I\), what additional component is needed for a complete decomposition?
- When decomposing squared deviations from a reference vector \(b\), which vector should be passed to each projection matrix?