Setup
Given the linear model:
yy=Xbb+ee
We can partition the columns of X into X1 and X2 to get:
yy=X1bb1+X2bb2+ee
Solving the least squares problem with the partitioned representation of the model, we find the normal equations:
[X1′X1X2′X1X1′X2X2′X2][bb1bb2]=[X1′yyX2′yy]
Solving
Our normal equations form a system of (two) equations. Therefore, solve for bb1 and substitute into bb2 to find the solution.
Finding bb1:
X1′X1bb1+X1′X2bb2⟹bb1=X1′yy=(X1′X1)−1X1′(yy−X2bb2)
Substituting into the second normal equation and expanding:
X2′yy=(X2′X2)bb2+X2′X1bb1=(X2′X2)bb2+X2′X1(X1′X1)−1X1′(yy−X2bb2)=(X2′X2)bb2+X2′X1(X1′X1)−1X1′yy−X2′X1(X1′X1)−1X1′X2bb2
Continuing with algebra to isolate bb2:
X2′yy+X2′X1(X1′X1)−1X1′yyX2′(I+X1(X1′X1)−1X1′)yy=(X2′X2)bb2−X2′X1(X1′X1)−1X1′X2bb2=X2′(I−X1(X1′X1)−1X1′)X2bb2
Substitute in the residual maker matrices:
X2′M1yy=X2′M1X2bb2
Recalling that these residual makers are idempotent and symmetric:
(X2′M1′)(M1yy)(M1X2)′(M1yy)X~2′yy~=(X2′M1′)(M1X2)bb2=(M1X2)′(M1X2)bb2=X~2′X~2bb2
Finally,
bb2=(X~2′X~2)−1X~2′y~y~