Back to the 2025 paper

Unit 2: Statistical Decision Theory

20257m

Given a dataset with two features: X = [[2, 0], [0, 1], [0, 2]]. Compute the covariance matrix, eigenvalues, and the principal components.

Worked SolutionAI Assisted

Data: X=[200102]X =\begin{bmatrix}2&0\\0&1\\0&2\end{bmatrix}, n=3n=3, d=2d=2

Step 1: Mean center. xˉ=[(2+0+0)/3,(0+1+2)/3]=[0.667,1]\bar x = [(2+0+0)/3, (0+1+2)/3]=[0.667,1]

Centered Xc=[1.333−1−0.6670−0.6671]X_c =\begin{bmatrix}1.333&-1\\-0.667&0\\-0.667&1\end{bmatrix}

Step 2: Covariance C=1n−1XcTXcC = \frac1{n-1} X_c^T X_c (unbiased; if 1/n1/n divide by 3, mention both).

XcTXc=[1.3332+0.6672+0.66721.333∗(−1)+(−0.667)∗0+(−0.667)∗1sym1+0+1]X_c^T X_c =\begin{bmatrix}1.333^2+0.667^2+0.667^2 &1.333*(-1)+(-0.667)*0+(-0.667)*1\\ sym &1+0+1\end{bmatrix}
=[2.667−2−22]= \begin{bmatrix}2.667 & -2\\ -2 &2\end{bmatrix}

Hence:

  • Unbiased (1/(n−1)=1/21/(n-1)=1/2): C=[1.333−1−11]C =\begin{bmatrix}1.333 & -1\\ -1 &1\end{bmatrix}
  • Biased (1/n1/n): Cbiased=[0.889−0.667−0.6670.667]C_{biased}=\begin{bmatrix}0.889 & -0.667\\ -0.667 &0.667\end{bmatrix} (scale by 2/32/3)

Step 3: Eigenvalues solve ∣C−λI∣=0|C-\lambda I|=0:

(1.333−λ)(1−λ)−1=0⇒λ2−2.333λ+0.333=0(1.333-\lambda)(1-\lambda)-1=0 \Rightarrow \lambda^2 -2.333\lambda+0.333=0
λ=2.333±5.444−1.3332=2.333±2.0282\lambda = \frac{2.333\pm\sqrt{5.444-1.333}}{2}= \frac{2.333\pm2.028}{2}
λ1≈2.18\lambda_1 \approx 2.18, λ2≈0.152\lambda_2 \approx 0.152 (Unbiased)
For biased version: λ1≈1.454\lambda_1\approx1.454, λ2≈0.102\lambda_2\approx0.102 (2/3 times).

Explained variance: 93.5%93.5\% by PC1, 6.5%6.5\% by PC2.

Step 4: Eigenvectors (PCs):
For λ1=2.18\lambda_1=2.18: (C−λI)v=0⇒−0.847v1−1v2=0⇒v∝[1,−0.847](C-\lambda I)v=0\Rightarrow -0.847 v_1 -1 v_2=0\Rightarrow v\propto[1,-0.847] normalized v1≈[0.763,−0.647]v_1\approx[0.763,-0.647]
For λ2=0.152\lambda_2=0.152: v2≈[0.647,0.763]v_2\approx[0.647,0.763] orthogonal.

Normalized PCs (unit): PC1≈[−0.76,0.65]PC1\approx [-0.76,0.65] direction of max variance (roughly along x−yx-y diagonal), PC2PC2 orthogonal.

Projection Z=XcVZ=X_c V gives reduced 1D representation capturing >93%>93\% variance. First PC is the principal component.

Similar questions

AI LearningWeb Platform

Coursify — Personal AI Course Generator

Struggling with a difficult subject or concept? Turn any engineering topic into a structured course with interactive lessons, quizzes, and research-backed explanations.