Why Centering Changes the Distribution
For a normal sample, the centered residual sum of squares measures variation around the sample mean rather than around a fixed, known center. That distinction matters: estimating the center from the same observations imposes one linear constraint on the residuals, so the resulting sum of squares has one fewer degree of freedom than an uncentered sum of squared standard normal variables.
The exact distribution follows from geometry. The vector of observations has a multivariate normal distribution, and subtracting the sample mean projects that vector away from the direction in which all coordinates are equal. An orthogonal change of coordinates isolates this direction and leaves \(n-1\) independent standard normal coordinates to contribute to the residual sum of squares.
A chi-square random variable with \(k\) degrees of freedom, written \(\chi^2_k\), is the sum of squares of \(k\) independent \(N(0,1)\) random variables. In particular, \(k\) counts the independent standard normal coordinates being squared. The central result for \(R\) is as follows.
Derivation by Orthogonal Coordinates
Write the sample as the vector \(X=(X_1,\ldots,X_n)^{\mathsf T}\), and let \(\mathbf 1=(1,\ldots,1)^{\mathsf T}\). The vector \(u=\mathbf 1/\sqrt n\) has length one. The matrix \(P=I-uu^{\mathsf T}\) is the orthogonal projection onto the subspace perpendicular to \(u\). Since \(PX=X-\bar X\mathbf 1\), the residual sum of squares is the squared length of that projection.
To see exactly which random coordinates contribute, standardize the sample vector by setting \(Z=(X-\mu\mathbf 1)/\sigma\). Its coordinates are independent \(N(0,1)\) variables. Choose an orthogonal \(n\) by \(n\) matrix \(Q\) whose first column is \(u\); such a matrix exists by extending \(u\) to an orthonormal basis. Define \(Y=Q^{\mathsf T}Z\).
The same decomposition also explains the degrees of freedom without relying only on a matrix calculation: the residuals satisfy \(\sum_{i=1}^n(X_i-\bar X)=0\). Once any \(n-1\) residuals are specified, the final residual is determined. The orthogonal-coordinate argument makes this constraint precise for the distribution: exactly \(n-1\) independent standard normal coordinates remain after centering.
Density and Moments
For \(n\geq2\), the theorem gives the density of \(R\) by scaling the chi-square density. If \(k=n-1\), the density of a \(\chi^2_k\) variable \(W\) is \(w^{k/2-1}e^{-w/2}/(2^{k/2}\Gamma(k/2))\) for \(w>0\), where \(\Gamma\) is the gamma function. Applying the change of variable \(w=r/\sigma^2\) gives:
The expectation and variance follow from the sum-of-squares representation. If \(Z_0\sim N(0,1)\), then \(E[Z_0^2]=1\) and \(\operatorname{Var}(Z_0^2)=E[Z_0^4]-E[Z_0^2]^2=3-1=2\). The \(n-1\) squared coordinates in the representation are independent, so their expectations and variances add. Consequently,
These moments provide useful checks on calculations. In particular, the expected residual sum of squares is smaller than the expected uncentered sum of squared deviations from the true mean, which is \(n\sigma^2\). Centering uses the data to locate the center and removes one direction of variation from the sum.
Worked Applications
Worked Example: A Tail Probability with Three Observations
Suppose \(X_1,X_2,X_3\) are independent \(N(\mu,4)\) observations, where \(\mu\) is unspecified. Find \(P(R>8)\), with \(R=\sum_{i=1}^3(X_i-\bar X)^2\).
Here \(n=3\) and \(\sigma^2=4\), so the theorem gives \(R/4\sim\chi^2_2\). Therefore
Worked Example: Checking an Observed Residual Sum of Squares
Suppose five observed values are \(2,4,6,8,10\). Calculate their residual sum of squares. Then, under a model in which the five observations are independent \(N(\mu,4)\) variables, state the distribution of the corresponding random residual sum of squares.
The observed mean is
Worked Example: Expressing Residual Variation Through Contrasts
For four independent \(N(\mu,\sigma^2)\) observations, use orthogonal contrasts to verify the residual sum of squares for the data \((3,1,2,6)\), and identify the sampling distribution of the scaled result.
Three mutually orthogonal unit vectors perpendicular to \((1,1,1,1)^{\mathsf T}\) are
Common Mistake: Counting the Wrong Directions
A tempting but incorrect argument is to standardize each observation around the population mean and conclude that the centered residual sum of squares has \(n\) degrees of freedom. Indeed, the uncentered sum \(\sum_{i=1}^n(X_i-\mu)^2/\sigma^2\) is \(\chi^2_n\), because it is the sum of squares of \(n\) independent standard normal variables. But that is not the same sum as \(R/\sigma^2\): \(R\) centers at the random sample mean, not at \(\mu\).
The exact relationship is
Check Your Understanding
Use the normal-sample assumptions and the orthogonal-coordinate argument to answer these questions.
- For a sample of size \(n=8\) from \(N(\mu,\sigma^2)\), what is the distribution of \(R/\sigma^2\)?
- Why does centering at \(\bar X\) remove one degree of freedom?
- If \(n=3\) and \(\sigma^2=9\), express \(P(R\leq 9)\) as a probability involving a chi-square variable.
- Explain why \(\sum_{i=1}^n(X_i-\mu)^2/\sigma^2\) and \(R/\sigma^2\) have different degrees of freedom.
- For \(n=5\), what are \(E[R]\) and \(\operatorname{Var}(R)\) in terms of \(\sigma^2\)?