Let $X_1$,$X_2$ be $n\times k$ real matrices with rank $k$. Let $S_1,S_2$ denote the column spaces of $X_1,X_2$ respectively. I am trying to show that the rank of $MX_1 $, with $M:=I_n-X_2(X_2'X_2)^{-1}X'_2$, equals the dimension of $S_1 \cap S_2^\perp$.
I know that the matrix above is the error arising from the projection of each column of $X_1$ on $S_2$, but don't know where to go from there. I notice that we have $X_2'MX_1=0$.
Any help on this is greatly appreciated.
I don't think what you're saying is true. Define $X_1,X_2 \in \mathbb{R}^{2 \times 1}$ by $$X_1=(1,0)^T$$ $$X_2=(1,1)^T$$ Then $S_1$ is the $x-$ axis, $S_2$ is the line $y=x$, and $S_2^{\perp}$ is the line $y=-x$. Notice $S_1 \cap S_2^{\perp}=\{(0,0)^T\}$ has dimension $0$. On the other hand, your $2\times 1$ matrix $MX_1=(0.5,-0.5)^T$ has rank $1$.