Skip to content
← All questions

Why does the PCA algorithm subtract the mean from the data before continuing?

The PCA algorithm subtracts the mean from the data to centralize it, meaning that the mean of all points should be zero. This step prepares the data for the variance-based step that follows, making the formula for the scatter matrix simpler.

Conditions

  • The data must first be represented as a matrix X.
  • The subtraction is by the mean X‾\overline{X}.
  • After this step, the video uses X‾=0\overline{X} = 0 in the scatter-matrix discussion.

Reasoning, step by step

  1. Represent the data as a matrix X.
  2. Subtract the mean X‾\overline{X} from the data: X -> X - X‾\overline{X}.
  3. Observe that the scatter plot shifts so that the cloud sits around the origin.
  4. Conclude that the mean of all points is now zero, which simplifies the subsequent scatter matrix calculation.

Example

The board writes X -> X - X‾\overline{X}, and the scatter plot is shifted so that the cloud sits around the origin instead of in the upper-right quadrant. The narration explains the purpose of this transformation: after subtracting the mean, the mean of all points is zero.

Common misconceptions

  • One might read S=∑ixiTxiS = \sum_i x_i^T x_i as the general formula without conditions. In this clip, the formula is presented after centralization, with X‾=0\overline{X} = 0 written alongside it.

Watch the explanation

Explore next

Answers are generated from source material and independently checked. Consult the original video or creator if something is unclear.