{
  "id": "principal-component-analysis",
  "title": "Principal component analysis",
  "lang": "en",
  "source_lang": "en",
  "summary": "Principal component analysis transforms correlated variables into orthogonal components ordered by explained variance, enabling linear dimensionality reduction and data exploration.",
  "category": "mathematics",
  "subcategory": "probability-statistics",
  "type": "concept",
  "aliases": [
    "PCA",
    "principal components analysis"
  ],
  "generated_at": "2026-10-03",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/principal-component-analysis/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/principal-component-analysis/",
      "json": "https://aiwiki.page/zh/principal-component-analysis.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "Principal component analysis (PCA) is a method in statistics and linear algebra that represents multivariate data through mutually orthogonal directions of greatest variation. It transforms the original variables into linear combinations called principal components, ordered by the variance they explain. Retaining only the leading components provides dimensionality reduction. In machine learning, ordinary PCA is an unsupervised learning method because its directions are determined without target labels. (arxiv.org)"
    },
    {
      "heading": "Geometric interpretation and origins",
      "text": "PCA treats observations as points in a vector space. After subtracting the mean of each variable, the first principal direction is the axis along which projected observations have the largest variance. The second maximizes the remaining projected variance subject to being perpendicular to the first; subsequent directions follow the same rule. The resulting component scores are uncorrelated, although this does not generally make them statistically independent. (arxiv.org)\n\nAn equivalent interpretation is to find a lower-dimensional linear subspace minimizing the sum of squared perpendicular distances from the centered observations. Karl Pearson described this closest-fitting-lines-and-planes formulation in 1901. Unlike ordinary linear regression, which distinguishes a response from predictors, this geometric formulation treats the measured coordinates symmetrically, for the chosen scaling. (pca.narod.ru)\n\nFor illustration, an elongated cloud of two-dimensional points has a first principal direction along its long axis. Projection onto that axis preserves more variation than projection onto any other single direction; the perpendicular second direction describes its width. (arxiv.org)"
    },
    {
      "heading": "Mathematical formulation",
      "text": "Let \\(X\\) be an \\(n\\times p\\) centered data matrix, with observations in rows and variables in columns, where \\(n>1\\). Its sample covariance matrix is\n\n\\[S=\\frac{1}{n-1}X^{\\mathsf T}X.\\]\n\nBecause \\(S\\) is symmetric and positive semidefinite, it has orthonormal eigenvectors \\(v_j\\) and nonnegative eigenvalues ordered as \\(\\lambda_1\\geq\\cdots\\geq\\lambda_p\\). The first direction solves\n\n\\[\\max_{\\|v\\|_2=1}v^{\\mathsf T}Sv.\\]\n\nThe solution is an eigenvector associated with \\(\\lambda_1\\). Later directions solve the corresponding constrained problems with orthogonality to earlier directions. (arxiv.org)\n\nFor \\(V_k=[v_1,\\ldots,v_k]\\), the reduced coordinates, or scores, are \\(T_k=XV_k\\). Their sample covariance is diagonal, with entries \\(\\lambda_1,\\ldots,\\lambda_k\\). The reconstruction in centered coordinates is\n\n\\[\\widehat X_k=XV_kV_k^{\\mathsf T}.\\]\n\nRestoring the original column means returns the approximation to the original coordinate system. This projection minimizes squared reconstruction error among \\(k\\)-dimensional orthogonal projections. Thus variance maximization and a reconstruction-error loss function describe the same solution. (arxiv.org)"
    },
    {
      "heading": "Computation and interpretation",
      "text": "PCA can be computed directly using the singular value decomposition:\n\n\\[X=U\\Sigma V^{\\mathsf T}.\\]\n\nThe right singular vectors give the principal directions, while \\(U\\Sigma\\) gives their scores. If \\(\\sigma_j\\) is the corresponding singular value, then \\(\\lambda_j=\\sigma_j^2/(n-1)\\). Centered data have at most \\(\\min(n-1,p)\\) nonzero components. Singular value decomposition therefore connects PCA with low-rank matrix approximation and provides a computational route without explicitly constructing the covariance matrix. (arxiv.org)\n\nThe coefficients defining a component are often called loadings, although some conventions reserve that term for eigenvectors multiplied by square roots of eigenvalues. Scores describe observations; loadings describe how variables contribute. Reversing a direction’s sign reverses its scores but leaves the representation unchanged. Repeated eigenvalues permit different orthonormal bases for the same eigenspace, so individual directions within it are not uniquely determined. (arxiv.org)"
    },
    {
      "heading": "Scaling and component selection",
      "text": "Centering and scaling are distinct operations. Covariance-based PCA retains the variables’ original scales, so changing measurement units can change its directions. Standardizing nonconstant variables to unit variance instead yields correlation-based PCA. This prevents large numerical scales from automatically dominating, but also changes the question from absolute variation to variation relative to each variable’s spread. (arxiv.org)\n\nProvided total variance is positive, component \\(j\\) explains the fraction\n\n\\[r_j=\\frac{\\lambda_j}{\\sum_{\\ell=1}^{p}\\lambda_\\ell}.\\]\n\nCumulative explained variance measures how much variation the first \\(k\\) components retain. A scree plot displays the eigenvalues against component number, helping identify where their decline flattens. Neither a visual elbow nor a fixed variance threshold universally determines the appropriate dimension; selection depends on the analytical objective. (arxiv.org)\n\nFor predictive evaluation, means, scales, and directions are estimated from training data alone. The same fitted transformation is then applied to held-out observations. During cross-validation, preprocessing is fitted separately inside each training fold; otherwise information from evaluation observations can cause data leakage. (scikit-learn.org)"
    },
    {
      "heading": "Applications, limitations, and variants",
      "text": "PCA supports visualization, compression, noise reduction, and exploratory analysis of high-dimensional measurements, including gene-expression data. Unlike feature selection, it constructs combinations of variables rather than selecting a subset of original measurements. Its usefulness depends on whether dominant variation corresponds to the structure of interest. Large variance need not imply predictive relevance, and ordinary PCA does not optimize separation between target classes. (arxiv.org)\n\nPCA captures linear structure and can be influenced strongly by outliers. Its components describe statistical variation, not necessarily causal mechanisms. Related methods alter these assumptions: kernel PCA uses a kernel method to obtain nonlinear representations; sparse PCA encourages many coefficients to be zero; and probabilistic PCA introduces a latent-variable model with isotropic Gaussian noise. Incremental algorithms process batches, while randomized decompositions approximate leading components when a full decomposition would be expensive. (arxiv.org)"
    }
  ],
  "links": [
    "statistics",
    "linear-algebra",
    "variance",
    "dimensionality-reduction",
    "machine-learning",
    "unsupervised-learning",
    "vector-space",
    "linear-regression",
    "matrix",
    "covariance-matrix",
    "eigenvalues-and-eigenvectors",
    "loss-function",
    "singular-value-decomposition",
    "training-data",
    "cross-validation",
    "data-leakage",
    "feature-selection",
    "kernel-method"
  ],
  "sources": [
    {
      "title": "arxiv.org/pdf/1404.1100",
      "url": "https://arxiv.org/pdf/1404.1100"
    },
    {
      "title": "pca.narod.ru/pearson1901.pdf",
      "url": "https://pca.narod.ru/pearson1901.pdf"
    },
    {
      "title": "arxiv.org/pdf/1906.03148",
      "url": "https://arxiv.org/pdf/1906.03148"
    },
    {
      "title": "arxiv.org/pdf/physics/0208101",
      "url": "https://arxiv.org/pdf/physics/0208101"
    },
    {
      "title": "scikit-learn.org/stable/common_pitfalls.html",
      "url": "https://scikit-learn.org/stable/common_pitfalls.html?highlight=linearregression"
    }
  ],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}