# Nearest non-negative solution for $Av=b$

Let $A$ be a $n\times m$ matrix. Let us define the system $$Av=b$$ $$v\geq 0$$

I want to find a solution $v$ of this system that is the closest (euclidean norm) to $v_0$, a given $n$-dimensional vector.

What is the simplest way to solve this ?

Thanks.

• What does $v \ge 0$ mean? Is $v^*$ conjugate transpose? – GFauxPas Apr 2 '15 at 13:36
• The elements of the vector are all non-negative. I removed the star. – quantguy Apr 2 '15 at 13:40
• You want to solve the problem $\min_v\|v_0-v\|_2$ such that $Av=b$ and $v\geq 0$. If the "way how to solve this" means a tool, Matlab has the function lsqlin to do exactly this. Otherwise, these kinds of problems are solved using trust region and interior point methods. – Algebraic Pavel Apr 2 '15 at 13:43
• Thanks. I will give it a try. – quantguy Apr 2 '15 at 13:45
• Here's the full model:\begin{array}{ll}\text{minimize} & \|v-v_0\|_2^2 \\ \text{subject to} & Av=b \\ & v \geq 0\end{array}This is actually a very standard quadratic program. Certainly Algebraic Pavel is right, but in fact any quadratic programming engine can handle this readily. – Michael Grant Apr 2 '15 at 18:51