In my problem, $A$ is a $m \times n$ matrix with $m \geq n$ and $\mathrm{rank}(A)= n$. Let $\Gamma$ be the $(m+n) \times n$ matrix defined by :
$$ \Gamma = \begin{bmatrix} A \\ \mathrm{I_{n}} \end{bmatrix} $$
For a given $\mathrm{f} \in \mathbb{R}^{m}$, I want to solve the linear system :
$$ \Gamma x = \begin{bmatrix} - \mathrm{f} \\ 0 \end{bmatrix} \in \mathbb{R}^{m+n} \tag{$\star$} $$
In MATLAB, I used the linsolve function :
x = linsolve(Gamma,b); % b=[-f;0];
and then, when I compute norm(Gamma*x-b); the result is not of the order of eps( $\sim 10^{-16}$). I find that linsolve fails to produce a "good" solution for my linear system in this case. I also tried x = linsolve( (A')*A, (A')*b); but the problem is the same. What am I missing here ? Why can't linsolve find a "better" solution to $(\star)$ ?
Here is a reproducible example :
m=10;
n=5;
A=rand(m,n);
Gamma=[A;eye(n)];
b=[ones(m,1);zeros(n,1)];
x=linsolve(Gamma,b);
norm(Gamma*x-b)