# How to do the following projection in Matlab?

I have 2 vectors $u$ and $v$ given in $\mathbb R^4$, e.g. $u = (-1,-2,3,4)$ and $v=(1,-2,-3,5)$
I also have $Ax=b$ which is an under-determined system; meaning, if $A$ is $m\times n$, then $m\le n$.

We define a 2 dimensional plane as follows $K=\{x\in \mathbb R^4:\, u^Tx = 1,\,v^Tx = 1\}$.

I need to find the projection of some point $z = (1,2,2,1)$ on $K$ plane by formulating a least-norm problem.

I know that I can use $x=A'(AA')^{-1}\setminus b$ this formula to solve the least-norm problem.

Thanks

-
If $m > n$ then your system is overdtermined, not underdetermined (assuming $A$ has full rank). Also, note that Matlab's backslash operator automatically computes least squares solutions to overdetermined systems. – littleO Nov 27 '12 at 7:44
i meant m<n, mistake – ASROMA Nov 27 '12 at 8:30

Let $x = \text{proj}_K(z) - z$. Then $x$ is the vector of least norm such that $z + x$ belongs to $K$. You can now find a least norm solution to the system of two equations that must be satisfied by $x$.

-

Note that $K$ is equivalent to the solutions $x$ of $Ax=\begin{bmatrix}1\\1\end{bmatrix}$, where $A=\begin{bmatrix}u^T\\v^T\end{bmatrix}$.

$x$ can then be calculated in MATLAB with

x=A/b


This will be the projection onto the plane, with $b$ defined as $b=[1,1]^T$.

-
How does this solution use $z$? – littleO Nov 27 '12 at 9:24
@littleO It is not a full solution. It simplifies (depending on the OP's level) the set which the projection lies on. The projection must lie in the affine space $x_p+\mathcal{N}(A)$, where $x_p$ is a particular solution of the linear system. At this point, you introduce $z$ to find the projection. – Daryl Nov 27 '12 at 9:33