The principal components of a collection of points in a real p-space are a sequence of p direction vectors, where the *i*th vector is the direction of a line that best fits the data while being orthogonal to the first *i*-1 vectors. Here, a best-fitting line is defined as one that minimizes the average squared distance from the points to the line. These directions constitute an orthonormal basis in which different individual dimensions of the data are linearly uncorrelated. Principal component analysis (PCA) is the process of computing the principal components and using them to perform a change of basis on the data, sometimes using only the first few principal components and ignoring the rest.

PCA is used in exploratory data analysis and for making predictive models. It is commonly used for dimensionality reduction by projecting each data point onto only the first few principal components to obtain lower-dimensional data while preserving as much of the data's variation as possible. The first principal component can equivalently be defined as a direction that maximizes the variance of the projected data. The *i*th principal component can be taken as a direction orthogonal to the first *i*-1 principal components that maximizes the variance of the projected data.