Reconstruction and Principal Component Analysis: Formulation and Fixed-Total Decomposition

ECE 57000 — September 14, 2026

David I. Inouye

Friday connected reconstruction to the decoder’s subspace

  • Center the data: \(X\) contains observations as rows.
  • Encode and decode: \(\boldsymbol{z}=E\boldsymbol{x}\), \(\widehat{\boldsymbol{x}}=D\boldsymbol{z}\).
  • Every reconstruction lies in the span of the columns of \(D\).

We want to minimize \(\|X-XE^TD^T\|_F^2\). Changing the basis changes coordinates, not the subspace.

Next: prove that an orthonormal decoder loses no reconstruction possibilities; then find its best encoder.

QR lets us choose an orthonormal decoder without changing reconstruction

Start with any encoder \(E_0\in\mathbb{R}^{k\times d}\) and decoder \(D_0\in\mathbb{R}^{d\times k}\), where \(k\le d\). Suppose \(D_0\) does not have orthonormal columns.

The thin QR decomposition writes \(D_0=WR\): \(W^TW=I_k\) and \(R\) is upper triangular. Here \(W\in\mathbb{R}^{d\times k}\) and \(R\in\mathbb{R}^{k\times k}\).

Can we choose \(D=W\) and a new \(E\) to keep every reconstruction the same?

\(\displaystyle D_0E_0\boldsymbol{x}\)

\(=\)

\(\displaystyle (WR)E_0\boldsymbol{x}\)

(QR of the original decoder)

\(\,\)

\(=\)

\(\displaystyle W(RE_0)\boldsymbol{x}\)

(Regroup the factors)

\(\,\)

\(=\)

\(\displaystyle DE\boldsymbol{x}\)

(Choose \(D=W\), \(E=RE_0\))

Same reconstruction for every input: an orthonormal decoder is without loss of generality. Next, fix \(D=W\) and find its best encoder.

Four steps lead to the PCA formulation

We may choose an orthonormal decoder without changing what we can reconstruct.

1. Define what a good reconstruction means — Established

Choose a representation size and measure reconstruction error.

2. Choose a convenient decoder basis — Established

An orthonormal basis can represent the same reconstruction subspace.

3. Find the best encoder for that decoder — Next

The closest point in the subspace determines the coordinates.

4. Formulate the subspace choice.

Combine these results into the PCA optimization problem.

In 2D, the perpendicular foot is the best reconstruction

Any unit \(\boldsymbol{u}\) works. Illustrate with \(\boldsymbol{u}=[1,0]^T\), so \(\boldsymbol{q}=z\boldsymbol{u}=[z,0]^T\).

The origin (0,0) is marked. An orange unit arrow u runs from the origin to (1,0). Candidate points qa=[1,0]^T, qb=p=[2,0]^T, and qc=[3,0]^T lie before, at, and after the perpendicular foot from x=[2,2]^T. Lines from x to all three candidates show that the perpendicular path is shortest.

\(\displaystyle \|\boldsymbol{x}-\boldsymbol{q}\|_2^2\)

\(=\)

\(\displaystyle (x_1-q_1)^2+(x_2-q_2)^2\)

(Squared distance)

\(\,\)

\(=\)

\(\displaystyle (2-z)^2+(2-0)^2\)

(Substitute coordinates)

\(\,\)

\(=\)

\(\displaystyle (2-z)^2+4\)

(Simplify)

Choose \(z=2\): the horizontal error is zero; the height remains.

In 3D, moving within the plane cannot remove the height

Fix \(D=W\) with two orthonormal columns spanning this plane. Which point should we reconstruct?

A 3D plane shown in an oblique view contains candidate q and perpendicular foot p. Input x lies above p. The fixed perpendicular residual x-p and the in-plane displacement p-q form a right triangle.

\[ \|\boldsymbol{x}-\boldsymbol{q}\|_2^2 =\underbrace{\|\boldsymbol{x}-\boldsymbol{p}\|_2^2}_{\text{fixed perpendicular error}} +\underbrace{\|\boldsymbol{p}-\boldsymbol{q}\|_2^2}_{\text{extra error within the plane}}. \]

Choose \(\boldsymbol{q}=\boldsymbol{p}\). Moving in either plane direction only adds error.

A dot product gives the length along a unit direction

Recall \(\boldsymbol{u}^T\boldsymbol{x}=\|\boldsymbol{u}\|_2\|\boldsymbol{x}\|_2\cos\theta\). Here \(\|\boldsymbol{u}\|_2=1\).

A 2D right triangle joins the origin, x=[2,2]^T, and its perpendicular foot [2,0]^T on the unit direction u=[1,0]^T. The hypotenuse has length square root of 8 and the adjacent side has length 2. An angle theta is marked at the origin.

\(\displaystyle a\)

\(=\)

\(\displaystyle \text{hypotenuse}\,\frac{\text{adjacent}}{\text{hypotenuse}}\)

(\(a\) = adjacent length)

\(\,\)

\(=\)

\(\displaystyle \|\boldsymbol{x}\|_2\cos\theta\)

(Definition of cosine)

\(\,\)

\(=\)

\(\displaystyle \boldsymbol{u}^T\boldsymbol{x}\)

(Dot product; \(\|\boldsymbol{u}\|_2=1\))

The foot is \((\boldsymbol{u}^T\boldsymbol{x})\boldsymbol{u}\). This works in any dimension.

Coordinates along the basis directions locate the point in the plane

For a plane with orthonormal basis \(\boldsymbol{w}_1,\boldsymbol{w}_2\), read the two signed lengths:

\[ a_1=\boldsymbol{w}_1^T\boldsymbol{x},\qquad a_2=\boldsymbol{w}_2^T\boldsymbol{x}. \]

Combine the corresponding moves within the plane:

\[ \boldsymbol{p}=a_1\boldsymbol{w}_1+a_2\boldsymbol{w}_2 =\begin{bmatrix}\boldsymbol{w}_1&\boldsymbol{w}_2\end{bmatrix} \begin{bmatrix}a_1\\a_2\end{bmatrix}=W\boldsymbol{a}. \]

  • Perpendicular basis directions let us read each coordinate independently.
  • For \(k\) orthonormal directions, the same construction gives \(\boldsymbol{a}=W^T\boldsymbol{x}\) and \(\boldsymbol{p}=W\boldsymbol{a}\).

Next, verify the geometry algebraically: is \(\boldsymbol{x}-\boldsymbol{p}\) perpendicular to every decoder direction?

The residual is perpendicular to every decoder direction

Fix \(D=W\), with \(W^TW=I_k\). For one centered input, define:

\[ \boldsymbol{a}=W^T\boldsymbol{x},\qquad \boldsymbol{p}=W\boldsymbol{a},\qquad \boldsymbol{r}=\boldsymbol{x}-\boldsymbol{p}. \]

The point \(\boldsymbol{p}\) lies in the decoder’s subspace. Check its residual:

\(\displaystyle W^T\boldsymbol{r}\)

\(=\)

\(\displaystyle W^T(\boldsymbol{x}-W\boldsymbol{a})\)

(Substitute the residual)

\(\displaystyle \,\)

\(=\)

\(\displaystyle W^T\boldsymbol{x}-W^TW\boldsymbol{a}\)

(Distribute)

\(\displaystyle \,\)

\(=\)

\(\displaystyle \boldsymbol{a}-\boldsymbol{a}=\boldsymbol{0}\)

(\(\boldsymbol{a}=W^T\boldsymbol{x}\) and \(W^TW=I_k\))

Each entry is \(\boldsymbol{w}_j^T\boldsymbol{r}=0\): the residual is perpendicular to every basis direction.

Every reconstruction error has two perpendicular parts

For any coordinates \(\boldsymbol{z}\), the decoder returns \(W\boldsymbol{z}\). Insert the perpendicular foot \(\boldsymbol{p}=W\boldsymbol{a}\):

\(\displaystyle \boldsymbol{x}-W\boldsymbol{z}\)

\(=\)

\(\displaystyle (\boldsymbol{x}-\boldsymbol{p})+(\boldsymbol{p}-W\boldsymbol{z})\)

(Add and subtract the same point)

\(\displaystyle \,\)

\(=\)

\(\displaystyle \boldsymbol{r}+(W\boldsymbol{a}-W\boldsymbol{z})\)

(Substitute the two parts)

\(\displaystyle \,\)

\(=\)

\(\displaystyle \boldsymbol{r}+W(\boldsymbol{a}-\boldsymbol{z})\)

(Factor out the decoder)

  • \(\boldsymbol{r}\) is the fixed perpendicular part, outside the subspace.
  • \(W(\boldsymbol{a}-\boldsymbol{z})\) is the adjustable part, inside the subspace.

Changing \(\boldsymbol{z}\) moves only within the subspace, so it cannot cancel \(\boldsymbol{r}\).

The best coordinates remove all adjustable error

Orthonormal columns preserve coordinate lengths: \(\|W\boldsymbol{b}\|_2^2=\boldsymbol{b}^TW^TW\boldsymbol{b}=\|\boldsymbol{b}\|_2^2\).

\(\displaystyle \|\boldsymbol{x}-W\boldsymbol{z}\|_2^2\)

\(=\)

\(\displaystyle \|\boldsymbol{r}+W(\boldsymbol{a}-\boldsymbol{z})\|_2^2\)

(Use the error split)

\(\displaystyle \,\)

\(=\)

\(\displaystyle \|\boldsymbol{r}\|_2^2+\|W(\boldsymbol{a}-\boldsymbol{z})\|_2^2\)

(Pythagoras: the parts are perpendicular)

\(\displaystyle \,\)

\(=\)

\(\displaystyle \|\boldsymbol{r}\|_2^2+\|\boldsymbol{a}-\boldsymbol{z}\|_2^2\)

(Orthonormal columns)

The first term is fixed. The second is nonnegative and becomes zero only at \(\boldsymbol{z}=\boldsymbol{a}=W^T\boldsymbol{x}\).

Therefore \(\widehat{\boldsymbol{x}}=WW^T\boldsymbol{x}\) is the unique closest reconstruction. Write \(P=WW^T\).

One orthonormal basis supplies both encoder and decoder

We chose the decoder \(D=W\) without loss of generality; minimizing error gives \(E=W^T\).

For the batch of centered observations:

\[ Z=XW,\qquad \widehat X=ZW^T=XWW^T. \]

Role Choice Property
Encoder \(E=W^T\in\mathbb{R}^{k\times d}\) Orthonormal rows: \(EE^T=I_k\).
Decoder \(D=W\in\mathbb{R}^{d\times k}\) Orthonormal columns: \(D^TD=I_k\).

Together, these choices attain the best reconstruction error allowed by general \(E,D\).

What remains to choose is the subspace: which \(k\) directions should \(W\) contain?

Four steps lead to the PCA formulation

For a fixed orthonormal decoder, its transpose gives the best encoder. Which subspace should we choose?

1. Define what a good reconstruction means — Established

Choose a representation size and measure reconstruction error.

2. Choose a convenient decoder basis — Established

An orthonormal basis can represent the same reconstruction subspace.

3. Find the best encoder for that decoder — Established

The closest point in the subspace determines the coordinates.

4. Formulate the subspace choice — Next

Combine these results into the PCA optimization problem.

Build the objective from requirements and choices

We want \(k\) linear features that reconstruct centered measurements well. Which parts are requirements, and which are convenient parameter choices?

Explain the roles of \(k\), squared error, and \(W^TW=I_k\). Would low reconstruction error alone establish biological usefulness?

\(k\) limits representation size; squared error defines “well.” An orthonormal basis is sufficient for an optimum, but biological usefulness needs more evidence.

PCA chooses the best linear reconstruction subspace

For centered data \(X\) and a chosen dimension \(1\le k<d\), PCA solves:

\[ \min_{W\in\mathbb{R}^{d\times k}}\|X-XWW^T\|_F^2 \quad\text{subject to}\quad W^TW=I_k. \]

  • Objective: choose the subspace that minimizes total squared reconstruction error.
  • Constraint: \(W^TW=I_k\) means the columns of \(W\) are orthonormal.
  • One matrix to choose: we may use decoder \(D=W\) without loss of generality; its optimal encoder is \(E=W^T\).

\[ \underbrace{W^TW=I_k}_{\text{identity in coordinate space}}, \qquad \underbrace{WW^T\ne I_d}_{\text{projection in the original space, since }k<d}. \]

Three steps connect the PCA problem to its solution

We have formulated PCA using one orthonormal basis \(W\). Now we will solve that problem.

1. Rewrite the objective — Next

Least reconstruction error means most retained squared length.

2. Find the optimal directions

Use the SVD to prove that the leading right singular vectors are optimal.

3. Interpret the solution

Read reconstruction error and coordinate variance from the singular values.

Minimizing reconstruction error means keeping the most squared length

Let \(\widehat{\boldsymbol{x}}_i=WW^T\boldsymbol{x}_i\). The reconstruction and residual are perpendicular.

\(\displaystyle \|X\|_F^2\)

\(=\)

\(\displaystyle \sum_i\|\boldsymbol{x}_i\|_2^2\)

(Sum squared row lengths)

\(\,\)

\(=\)

\(\displaystyle \sum_i\bigl(\|\widehat{\boldsymbol{x}}_i\|_2^2+\|\boldsymbol{x}_i-\widehat{\boldsymbol{x}}_i\|_2^2\bigr)\)

(Pythagoras for each observation)

\(\,\)

\(=\)

\(\displaystyle \sum_i\bigl(\|W^T\boldsymbol{x}_i\|_2^2+\|\boldsymbol{x}_i-\widehat{\boldsymbol{x}}_i\|_2^2\bigr)\)

(\(W^TW=I_k\): decoding preserves length)

\(\,\)

\(=\)

\(\displaystyle \|XW\|_F^2+\|X-XWW^T\|_F^2\)

(Collect the rows into matrices)

\[ \underbrace{\|X-XWW^T\|_F^2}_{\text{error to minimize}} =\underbrace{\|X\|_F^2}_{\text{fixed total}} -\underbrace{\|XW\|_F^2}_{\text{retained amount to maximize}}. \]

Only \(W\) changes. The same centered data \(X\) give the same total squared length for every choice.