Why Truncation Is a Choice
Principal component analysis orders directions by the variance they capture. Keeping only the first \(K\) directions compresses the representation, but necessarily leaves some variation unreconstructed. Choosing \(K\) is therefore a decision about acceptable loss: a smaller \(K\) is more compact, while a larger \(K\) preserves more of the original variation.
The eigenvalues make this tradeoff measurable. Their sum is the total variance, and the sum of the eigenvalues omitted after the first \(K\) is the squared reconstruction error for the corresponding principal subspace. This gives a direct way to compare candidate values of \(K\), rather than choosing by visual impression alone.
Reconstruction Error and Explained Variance
Let \(X\) be a centered \(p\)-dimensional random vector with finite second moments and covariance matrix \(\Sigma\). Write its eigenvalues in nonincreasing order, \(\lambda_1\geq\lambda_2\geq\cdots\geq\lambda_p\geq0\), with corresponding orthonormal eigenvectors \(v_1,\ldots,v_p\). For \(K\) between 0 and \(p\), the leading principal subspace is spanned by \(v_1,\ldots,v_K\). The orthogonal projection onto that subspace is denoted by \(P_K\). For \(K=0\), it is the zero projection; for \(K=p\), it is the identity.
The error is measured in squared units of the variables being analyzed. For example, when variables are measured in centimetres, a squared reconstruction error is expressed in squared centimetres under the relevant Euclidean metric. The explained-variance proportion has no units. It is also the fraction of total variance not left in the residual: the two quantities sum to one after the error is divided by total variance.
For sample PCA, the same comparison uses the eigenvalues of the chosen sample covariance matrix. The divisor used in that covariance convention scales all eigenvalues by the same factor, so it changes the error's numerical scale but not cumulative explained-variance proportions or comparisons based on those proportions. Use one covariance convention consistently when applying an absolute error tolerance.
Worked Example: Meeting a Cumulative-Variance Target
Suppose the ordered eigenvalues are \(9,4,1,1,1\). Find the smallest \(K\) that retains at least 90% of the total variance, and calculate the corresponding discarded-eigenvalue errors.
The total variance is \(9+4+1+1+1=16\). For \(K=1\), the discarded error is \(4+1+1+1=7\), so the retained proportion is \((16-7)/16=9/16=56.25\%\). For \(K=2\), the error is \(1+1+1=3\), giving \(13/16=81.25\%\). For \(K=3\), the error is \(1+1=2\), giving \(14/16=87.5\%\). For \(K=4\), the error is \(1\), giving \(15/16=93.75\%\).
Thus \(K=3\) does not reach 90%, while \(K=4\) does. The smallest acceptable choice is \(K=4\), with an absolute squared reconstruction error of 1 and a relative error of \(1/16=6.25\%\). The calculation also shows why a stated cutoff matters: the first two components capture most, but not 90%, of the total variance.
Why the Leading Components Minimize Error
The discarded-eigenvalue formula is useful because it is not merely an error calculation for one convenient subspace. Among all \(K\)-dimensional linear subspaces, the leading principal subspace has the smallest expected squared reconstruction error.
Proof. Since \(P\) is an orthogonal projection, \(I-P\) is also an orthogonal projection. Using \(E[XX^\mathsf{T}]=\Sigma\), the expected squared residual is
For each eigenvector define \(a_j=v_j^\mathsf{T}Pv_j=\|Pv_j\|^2\). Because \(P\) is an orthogonal projection, \(0\leq a_j\leq1\), and \(\sum_{j=1}^{p}a_j=\operatorname{tr}(P)=K\). In the eigenvector basis, \(\operatorname{tr}(P\Sigma)=\sum_{j=1}^{p}\lambda_j a_j\). We show this sum cannot exceed \(\sum_{j=1}^{K}\lambda_j\). For \(0<K<p\), let \(t=\sum_{j=1}^{K}(1-a_j)\). The identity \(\sum_j a_j=K\) implies \(t=\sum_{j=K+1}^{p}a_j\). Ordering the eigenvalues gives
Therefore \(\operatorname{tr}(P\Sigma)\leq\sum_{j=1}^{K}\lambda_j\), so the residual error is at least \(\operatorname{tr}(\Sigma)-\sum_{j=1}^{K}\lambda_j=\sum_{j=K+1}^{p}\lambda_j\). Projection onto the leading eigenvectors attains equality, because it captures exactly the first \(K\) eigenvalues. For \(K=0\) the only subspace is the zero subspace; for \(K=p\) the full space has zero error. This also covers the endpoints and completes the proof. \(\square\)
If eigenvalues tie at the cutoff, the minimizing subspace need not be unique. The minimum error remains the same: different choices within a tied eigenspace retain the same total variance.
Worked Example: Comparing a Component Budget
Consider eigenvalues \(6,5,4,3,2\), with total variance \(20\). A compact representation can retain at most two components. Compare the best allowable choice with retaining four components.
With \(K=2\), the discarded error is \(4+3+2=9\), so the retained variance is \(20-9=11\), or \(11/20=55\%\). With \(K=4\), the discarded error is \(2\), so the retained proportion is \(18/20=90\%\). Moving from two to four components reduces the error by \(9-2=7\), a relative-error reduction from \(9/20=45\%\) to \(2/20=10\%\).
If the constraint is “at most two components,” \(K=2\) is the best available choice, since adding a component cannot increase the error. If the goal is at least 80% explained variance, \(K=2\) is insufficient and \(K=4\) is the smallest qualifying value: \(K=3\) retains \((6+5+4)/20=75\%\). The variance criterion and the budget criterion answer different questions; neither supplies a universal choice independent of the goal.
How Error Changes as Components Are Added
Derivation. Subtracting the two tail sums cancels every term except \(\lambda_K\):
Likewise, subtracting the cumulative sums gives \(V_K-V_{K-1}=\lambda_K\). Since every eigenvalue is nonnegative, \(E_K\leq E_{K-1}\). Since the eigenvalues are ordered, the absolute reduction in error from successive components is nonincreasing. These facts describe the tradeoff precisely: an additional component never worsens squared reconstruction fidelity, but its variance contribution is no larger than that of the preceding component. \(\square\)
Worked Example: Applying an Absolute Error Tolerance
Suppose the eigenvalues are \(4,1,0.25\), and the required squared reconstruction error is at most \(0.5\). Determine the smallest acceptable \(K\), then examine what happens if every variable is converted to units ten times as large.
The total variance is \(4+1+0.25=5.25\). At \(K=1\), the discarded error is \(1+0.25=1.25\), which exceeds \(0.5\). At \(K=2\), it is \(0.25\), which meets the tolerance. Thus the smallest acceptable choice is \(K=2\); it retains \(5/5.25\), approximately \(95.24\%\), of the variance.
Multiplying every coordinate by 10 multiplies every covariance eigenvalue, and hence every squared error, by \(10^2=100\). The new eigenvalues are \(400,100,25\). At \(K=2\), the error is now \(25\), so it fails the same numerical tolerance of \(0.5\); \(K=3\), with zero error, is required. However, the cumulative proportions have not changed: at \(K=2\), the proportion is \(500/525=95.24\%\). This illustrates why an absolute tolerance must be meaningful in the units of the analysis, while a relative-variance target is unchanged by a common rescaling.
Choosing a Rule and Avoiding Common Mistakes
A practical choice begins by stating what “enough fidelity” means. One option is an absolute tolerance, requiring \(E_K\leq\varepsilon\) for a specified error budget \(\varepsilon\). Another is a relative tolerance, requiring \(E_K/\operatorname{tr}(\Sigma)\leq\delta\), equivalently cumulative explained variance of at least \(1-\delta\). In either case, because the error decreases with \(K\), choose the smallest \(K\) satisfying the requirement when compactness is also desired.
A third situation is a fixed component budget: choose the largest permissible \(K\) when the goal is to minimize reconstruction error subject to that budget. In practice, the acceptable target or budget depends on how the representation will be used. A variance-retention rule is a descriptive criterion, not a guarantee that the retained components preserve every feature important for a later scientific or predictive task.
- Mistake: treating a popular percentage as a theorem. A rule such as “retain 90%” is a chosen convention, not a mathematical fact that 90% is always sufficient. State the target and explain why it suits the application.
- Mistake: confusing explained variance with individual-variable accuracy. The discarded-eigenvalue sum is an expected squared error across the analyzed coordinates. It does not say that every observation, or every variable, has the same reconstruction error.
- Mistake: comparing absolute errors across different scales. A common change of units multiplies squared errors by the square of the conversion factor. Check that the units and covariance convention match before applying an absolute tolerance.
- Mistake: assuming more components can hurt reconstruction. Under the same metric and nested leading principal subspaces, adding a component reduces error by its nonnegative eigenvalue. The real tradeoff is lower compression in exchange for no worse reconstruction.
Check Your Understanding
Use the eigenvalue ordering and the stated criterion in each question.
- For eigenvalues \(8,3,1\), calculate the discarded-eigenvalue error and cumulative explained-variance proportion at \(K=2\).
- Why does an absolute squared-error tolerance need to specify the units or scale of the variables?
- If the eigenvalues at the cutoff are tied, must the minimizing \(K\)-dimensional subspace be unique? Does the minimum error change?
- For \(E_K=\sum_{j=K+1}^{p}\lambda_j\), what is the reduction in error from adding component \(K\)?
- Explain why a requirement of at least 80% explained variance and a fixed budget of two components may lead to different decisions.