For example, the space spanned by the columns in
$$\mathbf{X} = \begin{bmatrix} 0 & 0 \\ 1 & 0 \\ 0 & 1 \end{bmatrix}$$
is the y-z plane. Further,
$$\mathbf{X'X} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \\ \end{bmatrix}$$
$$\mathbf{P = X(X'X)^{-1}X'} = \begin{bmatrix} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}$$
$$\mathbf{y} = \begin{bmatrix} 1 \\ 2 \\ 1 \end{bmatrix}$$
Then to project y onto the column space of X,
$$\mathbf{Py} = \begin{bmatrix} 0 \\ 2 \\ 1 \end{bmatrix}$$
I understand why this works. What I don't understand is how this works for linear regression - in the above example, each row represents a dimension in space I think (row 1 - x, row 2 - y, etc). In linear regression, the columns act as the dimensions. How does this transition work?
Thank you for any help!