The Least-Squares Solution of a Linear System (With Collinearity)

When the columns of the design matrix XX are linearly dependent, XTXX^TX is singular and the standard least-squares formula does not apply. This lesson covers how to detect collinearity, how to characterize the entire family of least-squares solutions via the normal equations, and why the fitted values y^=Xβ\hat{\mathbf{y}}=X\boldsymbol\beta remain unique regardless of which solution is chosen.

Step 1 of 119%

Tutorial

When the Columns of $X$ Are Collinear

In the previous lesson, we computed the least-squares solution

β^=(XTX)1XTy\boldsymbol{\hat\beta} = (X^TX)^{-1}X^T\mathbf{y}

under the assumption that the columns of the design matrix XX were linearly independent.

When the columns of XX are linearly dependent, we say that XX exhibits collinearity. In that case, XTXX^TX is singular (det(XTX)=0\det(X^TX) = 0), so (XTX)1(X^TX)^{-1} does not exist and the formula above cannot be applied.

The normal equations

XTXβ=XTyX^TX\boldsymbol{\beta} = X^T\mathbf{y}

are still valid—any least-squares solution must satisfy them—but the system is now consistent with infinitely many solutions. There is an entire family of vectors β\boldsymbol\beta that minimize the residual sum of squares yXβ2\lVert\mathbf{y}-X\boldsymbol\beta\rVert^2.

To detect collinearity, we form XTXX^TX and check whether det(XTX)=0\det(X^TX) = 0. For instance, with

X=[130013],X = \begin{bmatrix} 1 & 3 \\ 0 & 0 \\ 1 & 3 \end{bmatrix},

column 2 is 33 times column 1, so the columns are linearly dependent. Computing

XTX=[26618],det(XTX)=3636=0,X^TX = \begin{bmatrix} 2 & 6 \\ 6 & 18 \end{bmatrix}, \qquad \det(X^TX) = 36 - 36 = 0,

confirms that XTXX^TX is singular.

navigate · Enter open · Esc close · ⌘K/Ctrl K toggle