The [Moore-Penrose pseudoinverse](http://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_pseudoinverse) is probably what you're looking for. The *pseudoinverse solution* $A^+b$ is the smallest norm $x$ such that $\|Ax-b\|_2$ is minimized. It can be computed using QR decomposition (see [here](http://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_pseudoinverse#The_QR_method)), although you have to use reduced QR when $A$ does not have full column rank.