The centering matrix subtracts the arithmetic mean from every component of a real vector. For a positive integer , let have every component equal to one and define
For , write . Then , so . The output lies in the subspace of vectors whose components sum to zero.
Its orthogonal projection properties follow directly. Set . Since , we have and hence
Thus is a symmetric idempotent matrix, the orthogonal projector onto . It kills constant vectors and leaves zero-sum vectors unchanged. Its kernel of a linear map is and its rank is ; for it is the zero matrix. The eigenvalues are zero on the constant direction and one on its orthogonal complement.
For an original example, has mean , giving . The centered sum of squares is
For these four observations, the usual sample variance is . Centering removes the mean; it does not itself divide by a standard deviation.
For a data matrix with observations in its rows, centers each column. When , its sample covariance matrix is . Also for any scalar , which proves invariance to adding the same offset to every observation. These identities make the centering matrix useful in least squares and principal component analysis.
A weighted centering matrix subtracts the same weighted mean from every component of a vector. Let satisfy and , where has every component equal to one. Define
Then and . The centered vector has zero weighted mean; its unweighted component sum need not vanish.
The projection properties follow directly from normalization:
Also , so its kernel of a linear map is , its range is and its rank is . It is an idempotent matrix. For unequal weights it is generally not symmetric: it projects onto the zero-weighted-mean subspace along the constant-vector direction, an oblique projection in ordinary Euclidean geometry.
For an original example, and give and . The weighted mean is zero, while the ordinary mean is . Euclidean orthogonal projection of onto the same line instead gives .
Figure 1.
Weighted centering and Euclidean orthogonal projection reach different points on the same zero-weighted-mean line
. Original two-coordinate example with and . The orange arrow subtracts from both components; the dashed arrow is perpendicular to the green line in the Euclidean metric. Details.
If every , put . Then , so this same map is orthogonal for the inner product . It is the residual-making map for minimizing over a fitted constant , the intercept-only case of weighted least squares.[ref] Zero weights preserve the algebraic projection but make this proposed inner product degenerate. When all weights equal , the construction reduces to the usual centering matrix.

Articles by others on the same topic (1)

A centering matrix is a specific type of matrix used in statistics and linear algebra, particularly in the context of data preprocessing. Its primary purpose is to center data around the mean, effectively transforming the data so that its mean is zero. This is often a useful step before performing various statistical analyses or applying certain machine learning algorithms.