Transformation matrix for a 3d->2d projection

182 Views Asked by At

We know $\mathbf{\hat{y}} = X\mathbf{w}$ and $A$ is the subspace in which $\mathbf{\hat{y}}$ lies (so the columns of the $X$ matrix define the subspace $A$).

$\mathbf{\hat{y}}$ (2-dimensional vector) is a projection of $\mathbf{y}$ (3-dimensional vector) onto $A$ (see image). The transformation of $\mathbf{y}$ to $\mathbf{\hat{y}}$ is $\mathbf{\hat{y}} = B\mathbf{y}$. So what is the matrix $B$, in terms of $X$?

enter image description here

1

There are 1 best solutions below

1
On

I figured it out.

Basically, since $\mathbf{\hat{y}}$ is a projection of $\mathbf{y}$, then $\mathbf{y}-\mathbf{\hat{y}}$, which is $\mathbf{y}-X\mathbf{w}$, is orthogonal to the subspace defined by the columns of $X$. So: $$X^T(\mathbf{y}-X\mathbf{w})=0$$ $$X^TX\mathbf{w}=X^T\mathbf{y}$$ $$\mathbf{w}=(X^TX)^{-1}X^T\mathbf{y}$$ And: $$\mathbf{\hat{y}}=X\mathbf{w}=X(X^TX)^{-1}X^T\mathbf{y}$$ Therefore $B=X(X^TX)^{-1}X^T$.