Tutorials › Linear Algebra › Finding Orthogonal Decomposition Components

Orthogonal Complements and Projections · Tutorial 663 of 1000

Finding Orthogonal Decomposition Components

Use inner products with an orthonormal basis to calculate and verify the subspace and orthogonal-complement components of a vector.

Intermediate 11 min read

What You'll Learn

  • Calculate subspace components using inner products with an orthonormal basis.
  • Obtain the orthogonal-complement component by subtracting the subspace component.
  • Prove why the formula works and why the decomposition is unique.
  • Check decompositions in \(\mathbb{R}^n\), a polynomial space, and a matrix space.
  • Identify and correct the error caused by using a non-normalized vector as if it were a unit vector.

Computing the Two Components

Suppose a vector \(\mathbf{x}\) is to be written as a sum of one vector in a subspace \(W\) and another vector orthogonal to every vector in \(W\). The orthogonal decomposition theorem guarantees that such a sum exists uniquely in a finite-dimensional inner product space. If an orthonormal basis of \(W\) is known, the two parts can be calculated directly: take inner products with the basis vectors to find the coefficients of the part in \(W\), then subtract it from \(\mathbf{x}\).

We work over \(\mathbb{R}\). Let \(V\) be a finite-dimensional real inner product space, with inner product \(\langle\cdot,\cdot\rangle\). A list \((\mathbf{q}_1,\dots,\mathbf{q}_k)\) is an orthonormal basis of \(W\) if it is a basis of \(W\), each \(\mathbf{q}_i\) has norm \(1\), and distinct vectors in the list are orthogonal. Here \(\|\mathbf{q}\|=\sqrt{\langle\mathbf{q},\mathbf{q}\rangle}\). The orthogonal complement of \(W\) in \(V\), denoted \(W^\perp\), is the set of vectors in \(V\) orthogonal to every vector in \(W\).

Component formula: If \(W\) is a subspace of a finite-dimensional real inner product space \(V\), and \((\mathbf{q}_1,\dots,\mathbf{q}_k)\) is an orthonormal basis of \(W\), then every \(\mathbf{x}\in V\) has the decomposition $$ \mathbf{x}=\mathbf{x}_W+\mathbf{x}_{W^\perp}, \qquad \mathbf{x}_W=\sum_{i=1}^{k}\langle\mathbf{x},\mathbf{q}_i\rangle\mathbf{q}_i, \qquad \mathbf{x}_{W^\perp}=\mathbf{x}-\mathbf{x}_W. $$ The first component belongs to \(W\), and the second belongs to \(W^\perp\). An empty basis, when \(W=\{\mathbf{0}\}\), gives an empty sum equal to \(\mathbf{0}\).

The coefficient of \(\mathbf{q}_i\) is the inner product \(\langle\mathbf{x},\mathbf{q}_i\rangle\), not an arbitrary scaling factor. Orthonormality is what makes the coefficients this simple. For a general basis, taking these inner products does not in general give the coefficients of the component in \(W\).

Why the Formula Gives the Components

The formula both constructs a decomposition and identifies its two parts uniquely. The proof uses only the basis property, orthonormality, and the definition of the orthogonal complement.

Theorem (Orthonormal-basis formula for orthogonal components): Let \(V\) be a finite-dimensional real inner product space, let \(W\) be a subspace of \(V\), and let \((\mathbf{q}_1,\dots,\mathbf{q}_k)\) be an orthonormal basis of \(W\). For every \(\mathbf{x}\in V\), the formula above gives the unique expression \(\mathbf{x}=\mathbf{w}+\mathbf{z}\) with \(\mathbf{w}\in W\) and \(\mathbf{z}\in W^\perp\).

Proof. Define \(\mathbf{w}=\sum_{i=1}^{k}\langle\mathbf{x},\mathbf{q}_i\rangle\mathbf{q}_i\) and \(\mathbf{z}=\mathbf{x}-\mathbf{w}\). Because each \(\mathbf{q}_i\in W\) and \(W\) is a subspace, \(\mathbf{w}\in W\). By construction, \(\mathbf{x}=\mathbf{w}+\mathbf{z}\). For each \(j\) with \(1\le j\le k\), orthonormality gives \(\langle\mathbf{q}_i,\mathbf{q}_j\rangle=1\) when \(i=j\) and \(0\) otherwise. Therefore \(\langle\mathbf{z},\mathbf{q}_j\rangle=\langle\mathbf{x},\mathbf{q}_j\rangle-\sum_{i=1}^{k}\langle\mathbf{x},\mathbf{q}_i\rangle\langle\mathbf{q}_i,\mathbf{q}_j\rangle=0\). Every vector in \(W\) is a linear combination of the basis vectors, so \(\mathbf{z}\) is orthogonal to every vector in \(W\), and \(\mathbf{z}\in W^\perp\). For uniqueness, suppose also \(\mathbf{x}=\mathbf{w}'+\mathbf{z}'\) with \(\mathbf{w}'\in W\) and \(\mathbf{z}'\in W^\perp\). Then \(\mathbf{w}-\mathbf{w}'=\mathbf{z}'-\mathbf{z}\). The left side belongs to \(W\); the right side belongs to \(W^\perp\). A vector in both \(W\) and \(W^\perp\) must be zero, since it is orthogonal to itself and hence has squared norm zero. Thus \(\mathbf{w}=\mathbf{w}'\) and \(\mathbf{z}=\mathbf{z}'\). \(\square\)

This proof also explains a practical shortcut: once \(\mathbf{x}_W\) has been calculated, it is enough to subtract it from \(\mathbf{x}\) to obtain the other component. The subtraction is justified because the theorem shows that the result is orthogonal to \(W\), not merely because it is the leftover vector.

Worked Components in Three Settings

Worked Example: A Subspace of \(\mathbb{R}^3\)

Let \(W\subseteq\mathbb{R}^3\) have orthonormal basis \(\mathbf{q}_1=\frac{1}{\sqrt{2}}(1,1,0)^\top\) and \(\mathbf{q}_2=\frac{1}{\sqrt{6}}(1,-1,2)^\top\). Find the two components of \(\mathbf{x}=(2,0,1)^\top\).

The basis vectors have norm \(1\), since their squared norms are \(2/2=1\) and \(6/6=1\). Their inner product is \((1-1+0)/\sqrt{12}=0\). Thus the stated list is orthonormal. The coefficients are

$$ \langle\mathbf{x},\mathbf{q}_1\rangle =\frac{2+0+0}{\sqrt{2}}=\sqrt{2}, \qquad \langle\mathbf{x},\mathbf{q}_2\rangle =\frac{2+0+2}{\sqrt{6}}=\frac{4}{\sqrt{6}}. $$

Using the component formula gives

$$ \mathbf{x}_W =\sqrt{2}\,\mathbf{q}_1+\frac{4}{\sqrt{6}}\,\mathbf{q}_2 =(1,1,0)^\top+\frac{2}{3}(1,-1,2)^\top =\left(\frac{5}{3},\frac{1}{3},\frac{4}{3}\right)^\top. $$

Subtract to find the other component: \(\mathbf{x}_{W^\perp}=\mathbf{x}-\mathbf{x}_W=(\frac{1}{3},-\frac{1}{3},-\frac{1}{3})^\top\).

Check: The inner products with the basis of \(W\) are \(\langle\mathbf{x}_{W^\perp},\mathbf{q}_1\rangle=(\frac13-\frac13)/\sqrt2=0\) and \(\langle\mathbf{x}_{W^\perp},\mathbf{q}_2\rangle=(\frac13+\frac13-\frac23)/\sqrt6=0\). Also \(\mathbf{x}_W+\mathbf{x}_{W^\perp}=(2,0,1)^\top=\mathbf{x}\).

Worked Example: A Polynomial Subspace

In \(P_2\), the real polynomials of degree at most \(2\), use the inner product \(\langle p,q\rangle=\int_{-1}^{1}p(t)q(t)\,dt\). Let \(W=\operatorname{span}\{1,t\}\) and \(\mathbf{x}(t)=t^2+t+1\). Find its components in \(W\) and \(W^\perp\).

An orthonormal basis of \(W\) is \(q_1(t)=1/\sqrt{2}\) and \(q_2(t)=\sqrt{3/2}\,t\). Indeed, \(\langle q_1,q_1\rangle=2/2=1\), \(\langle q_2,q_2\rangle=(3/2)(2/3)=1\), and \(\langle q_1,q_2\rangle=0\) because the integral of the odd function \(t\) over \([-1,1]\) is zero. The coefficients are

$$ \begin{aligned} \langle\mathbf{x},q_1\rangle &=\frac{1}{\sqrt{2}}\int_{-1}^{1}(t^2+t+1)\,dt =\frac{1}{\sqrt{2}}\left(\frac{2}{3}+0+2\right) =\frac{4\sqrt{2}}{3},\\ \langle\mathbf{x},q_2\rangle &=\sqrt{\frac{3}{2}}\int_{-1}^{1}(t^3+t^2+t)\,dt =\sqrt{\frac{3}{2}}\left(0+\frac{2}{3}+0\right) =\sqrt{\frac{2}{3}}. \end{aligned} $$

Therefore \(\mathbf{x}_W=(4\sqrt2/3)q_1+\sqrt{2/3}\,q_2=4/3+t\). Subtracting gives \(\mathbf{x}_{W^\perp}=t^2+t+1-(4/3+t)=t^2-1/3\).

Check: The remainder is orthogonal to both basis polynomials: \(\langle t^2-1/3,1\rangle=2/3-(1/3)2=0\), and \(\langle t^2-1/3,t\rangle=\int_{-1}^{1}(t^3-t/3)\,dt=0\), since the integrand is odd. Finally, \((4/3+t)+(t^2-1/3)=t^2+t+1\).

Worked Example: A Matrix Subspace

In the space of real \(2\times2\) matrices, use the Frobenius inner product \(\langle\mathbf{A},\mathbf{B}\rangle=\sum_{i=1}^{2}\sum_{j=1}^{2}a_{ij}b_{ij}\). Let \(W\) be spanned by \(\mathbf{Q}_1=\begin{bmatrix}1&0\\0&0\end{bmatrix}\) and \(\mathbf{Q}_2=\frac{1}{\sqrt2}\begin{bmatrix}0&1\\1&0\end{bmatrix}\). Find the components of \(\mathbf{X}=\begin{bmatrix}2&3\\1&4\end{bmatrix}\).

The two spanning matrices are orthonormal: \(\langle\mathbf{Q}_1,\mathbf{Q}_1\rangle=1\), \(\langle\mathbf{Q}_2,\mathbf{Q}_2\rangle=(1+1)/2=1\), and \(\langle\mathbf{Q}_1,\mathbf{Q}_2\rangle=0\). The coefficients are \(\langle\mathbf{X},\mathbf{Q}_1\rangle=2\) and \(\langle\mathbf{X},\mathbf{Q}_2\rangle=(3+1)/\sqrt2=2\sqrt2\). Hence

$$ \mathbf{X}_W =2\mathbf{Q}_1+2\sqrt2\,\mathbf{Q}_2 =\begin{bmatrix}2&2\\2&0\end{bmatrix}, \qquad \mathbf{X}_{W^\perp} =\mathbf{X}-\mathbf{X}_W =\begin{bmatrix}0&1\\-1&4\end{bmatrix}. $$

Check: The inner products of the remainder with \(\mathbf{Q}_1\) and \(\mathbf{Q}_2\) are \(0\) and \((1-1)/\sqrt2=0\), respectively. Adding the displayed matrices gives \(\mathbf{X}\).

A Consequence: The Components Meet at Right Angles

Since \(\mathbf{x}_W\in W\) and \(\mathbf{x}_{W^\perp}\in W^\perp\), the two components are orthogonal. The norm of the original vector therefore splits into the sum of the squared norms of its components.

Theorem (Pythagorean identity for the components): Under the hypotheses of the orthonormal-basis formula, \(\|\mathbf{x}\|^2=\|\mathbf{x}_W\|^2+\|\mathbf{x}_{W^\perp}\|^2\).

Proof. Write \(\mathbf{x}=\mathbf{x}_W+\mathbf{x}_{W^\perp}\). Expanding the squared norm using the inner product gives \(\|\mathbf{x}\|^2=\langle\mathbf{x}_W,\mathbf{x}_W\rangle+\langle\mathbf{x}_W,\mathbf{x}_{W^\perp}\rangle+\langle\mathbf{x}_{W^\perp},\mathbf{x}_W\rangle+\langle\mathbf{x}_{W^\perp},\mathbf{x}_{W^\perp}\rangle\). The middle terms are zero because the components are orthogonal. The first and last terms are their squared norms, proving the identity. \(\square\)

For an orthonormal basis of \(W\), the squared norm of the component in \(W\) can also be read from its coefficients: \(\|\mathbf{x}_W\|^2=\sum_{i=1}^{k}\langle\mathbf{x},\mathbf{q}_i\rangle^2\). To verify this, expand \(\langle\mathbf{x}_W,\mathbf{x}_W\rangle\); every cross term with distinct basis vectors vanishes, and each diagonal term is the square of its coefficient. This gives a useful numerical check alongside verifying that the remainder is orthogonal.

Common Pitfall: Forgetting to Normalize

For \(\mathbf{x}=(2,0)^\top\) and \(W=\operatorname{span}\{(1,1)^\top\}\), a tempting but incorrect calculation is to use \((1,1)^\top\) directly as though it were a unit basis vector. That gives the claimed component \(2(1,1)^\top=(2,2)^\top\), using the inner product \((2,0)\cdot(1,1)=2\). But the remainder would be \((0,-2)^\top\), and \((0,-2)\cdot(1,1)=-2\ne0\). So this is not an orthogonal decomposition.

The unit vector in the direction of \((1,1)^\top\) is \(\mathbf{q}=(1,1)^\top/\sqrt2\). Its coefficient is \(\mathbf{x}\cdot\mathbf{q}=\sqrt2\), so the correct component is \(\sqrt2\,\mathbf{q}=(1,1)^\top\), and the orthogonal-complement component is \((1,-1)^\top\). The check \((1,-1)\cdot(1,1)=0\) confirms the correction. The formula requires an orthonormal basis, not merely a basis of the subspace.

Check Your Understanding

For each proposed decomposition, identify the component in the subspace and verify that the other component is orthogonal to it.

  1. In \(\mathbb{R}^2\), let \(W\) have orthonormal basis \(\frac{1}{\sqrt2}(1,1)^\top\), and take \(\mathbf{x}=(3,1)^\top\). Find both components.
  2. In \(P_2\) with \(\langle p,q\rangle=\int_{-1}^{1}p(t)q(t)\,dt\), decompose \(t^2\) relative to \(W=\operatorname{span}\{1,t\}\).
  3. For the matrix inner product in the worked example, find the two components of \(\begin{bmatrix}1&2\\2&0\end{bmatrix}\) relative to the same \(W\).
  4. Explain why subtracting the component in \(W\) produces a vector in \(W^\perp\), using the orthonormal-basis formula.
  5. State which part of the formula fails if the vectors spanning \(W\) are not normalized or are not mutually orthogonal.

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon