Project a vector onto subspace spanned by columns of a matrix

1.2k Views Asked by At

From this question we know that if $x\in\mathbb{R}^{n\times1}$ is a vector, then the (normalized) outer product matrix $$ \frac{x x^\top}{||x||^2}\, \in \mathbb{R}^{n\times n} $$ can operate on another vector $y\in\mathbb{R}^{n\times 1}$ and projects orthogonally onto the line spanned by $x$.

How does this generalize to a basis of vectors?

Suppose $X\in\mathbb{R}^{n\times m}$ is a matrix and let $[x_1 \, \cdots x_m]$ be its columns. I would like to find a matrix $A\in\mathbb{R}^{n\times n}$ such that it projects a vector $y\in\mathbb{R}^{n\times 1}$ onto the space spanned by the columns on $X$.

2

There are 2 best solutions below

3
On BEST ANSWER

I have chosen to rewrite my answer since my recollection of the formula was not quite satisfactionary. The formula I presented actually holds in general. If $A$ is a matrix, the matrix

$$P = A (A^\top A)^{-1} A^\top$$

is always the projection onto the column space of $A$. In the case where $A$ is orthogonal, this reduces to $AA^\top$. You can find a simple derivation under "Intuition" in this Wikipedia-article: https://en.wikipedia.org/wiki/Projection_matrix.

0
On

let consider a generic vector ${v}$. one can decompose this vector in the tangential and the orthogonal vector components as follows

$v=(v\cdot \hat{n})\hat{n}+(v\cdot\hat{t})\hat{t}$

moving the normal component to the LHS it has

$v\cdot(I-\hat{n}\hat{n})=(v\cdot\hat{t})\hat{t}$

where $I$ is the identity matrix. Therefore one can define the rejection and the projection operators

$P=I-\hat{n}\hat{n}$

$R=\hat{n}\hat{n}$