Skip to content
Glacius
StatisticsConcept reference

Principal components

For centered observations stored as rows, principal directions are the right singular vectors ordered by singular value.

On this page 9 sections
  1. Overview
  2. Understand the idea
  3. A closer look
  4. When the factor is supplied as V^T, use its rows
  5. PCA can turn correlated sensor readings into fewer coordinates for plotting or modeling
  6. Key takeaway
  7. Further questions
  8. Sources & further reading
  9. Concept connections

01Understand the idea#

Principal component analysis, or PCA, finds new perpendicular feature directions that capture as much variation in centered observations as possible, one direction at a time. It is useful when many measured features move together and you want a smaller set of coordinates.

Imagine a cloud of centered two-feature observations stretched along a diagonal. The first principal direction follows its longest spread. The second is perpendicular and describes the remaining spread. A direction is a unit vector shared by all observations; each observation will get its own coordinate along it.

Put observations in the rows of XcX_c and features in columns. In Xc=UΣVTX_c=U\Sigma V^T, the right singular vectors live in feature space, so they are the PCA directions. Larger singular values correspond to more variation along their paired directions. The factors are supplied in these tasks.

Put centered observations in the rows of XcX_c. In its SVD, principal directions are the columns of VV. They live in feature space and are ordered by descending singular values.

Xc=UΣVTX_c=U\Sigma V^T

With scales (5,2)(5,2) and VV rows (0.6,0.8);(0.8,0.6)(0.6,-0.8);(0.8,0.6), the first direction is column 1: (0.6,0.8)(0.6,0.8). The second is (0.8,0.6)(-0.8,0.6).

Two unit directions in feature space: v1=(0.6,0.8) and v2=(-0.8,0.6), perpendicular and each drawn at 70 pixels per unit from origin (160,112).Two unit directions in feature space: v1=(0.6,0.8) and v2=(-0.8,0.6), perpendicular and each drawn at 70 pixels per unit from origin (160,112).
Figure 1Two unit directions in feature space: v1=(0.6,0.8) and v2=(-0.8,0.6), perpendicular and each drawn at 70 pixels per unit from origin (160,112).
Link to this figure ↗Download SVGDownload PNG

Read the matrix name before choosing entries. If VV has rows (0.6,0.8)(0.6,-0.8) and (0.8,0.6)(0.8,0.6), its first column is (0.6,0.8)(0.6,0.8) and its second is (0.8,0.6)(-0.8,0.6). Both have squared length 1. Multiplying the first by its scale 5 gives a stretched vector, not a unit principal direction.

Check your reasoning

Centered sample rows. SVD scales (6,2)(6,2); VV rows (0.8,0.6)(0.8,-0.6); (0.6,0.8)(0.6,0.8). Direction 1 (keep signs)?

  1. A(0.8,0.6)(0.8,0.6)
  2. B(0.8,0.6)(0.8,-0.6)
  3. C(0.6,0.8)(-0.6,0.8)
Show answer and explanation
(0.8,0.6)(0.8,0.6)

Column 1: (0.8,0.6)(0.8,0.6).

02A closer look#

The singular scale describes spread along a direction; it does not multiply the unit direction. With distinct scales, reversing a direction’s sign changes its orientation but not its line. These tasks keep the supplied signs.

Check your reasoning

Centered sample rows. SVD scales (5,1)(5,1); VV rows (0.6,0.8)(-0.6,-0.8); (0.8,0.6)(0.8,-0.6). Claim: v1=(3,4)v_1=(-3,4). Repair.

  1. A(3,4)(-3,4)
  2. B(0.8,0.6)(-0.8,-0.6)
  3. C(0.6,0.8)(-0.6,0.8)
Show answer and explanation
(0.6,0.8)(-0.6,0.8)

Use unit column 1.

03When the factor is supplied as V^T, use its rows#

When the factor is supplied as VTV^T, use its rows. If VTV^T has rows (0.8,0.6);(0.6,0.8)(0.8,0.6);(-0.6,0.8), those rows are the two principal directions in order. Do not take its columns again.

Transposition swaps rows and columns. If the supplied object is VTV^T, each principal direction is already a row. Label it before extracting a vector. Direction 2 means the vector paired with the second singular value; it does not mean the second coordinate of direction 1.

Check your reasoning

Centered sample rows. SVD scales (4,1)(4,1); VTV^T rows (0.6,0.8)(0.6,-0.8); (0.8,0.6)(0.8,0.6). Direction 2 (keep signs)?

  1. A(0.8,0.6)(-0.8,0.6)
  2. B(0.8,0.6)(0.8,0.6)
  3. C(0.6,0.8)(0.6,-0.8)
Show answer and explanation
(0.8,0.6)(0.8,0.6)

Row 2: (0.8,0.6)(0.8,0.6).

04PCA can turn correlated sensor readings into fewer coordinates for plotting or modeling#

PCA can turn correlated sensor readings into fewer coordinates for plotting or modeling. It uses feature variation without target labels. A low-variance direction might still predict the target; a high-variance one may mostly reflect measurement units. Evaluate the reduced representation for its intended use.

Eight centered observations are stretched along direction (0.6,0.8). PC1 follows this spread; PC2 is perpendicular at (-0.8,0.6). Both original feature axes and the common origin are shown.
Each blue point is one observation. The same two principal directions provide new axes for the whole cloud; the next lesson computes an individual point’s scores.Original Glacius illustration; exact centered synthetic observations.
Key takeaway

With observations as rows, use columns of V or rows of V-transpose. Keep each direction unit length and follow the singular-value order.

  • Find principal directions from a supplied SVD of centered data.

Further questions

What if two singular values tie?
A tied principal subspace can have multiple valid orthonormal bases. The distinct scales in these tasks avoid that ambiguity.

Sources & further reading

  1. [1]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Principal components.” Math behind ML. /learn/s-pca