From what I know, Moore-Penrose Pseudoinverse is a method to solve overdetermined system of equations. Let $\mathbb{A}$ denote Pseudoinverse of $A$. I have the following matrices and I need to solve $Ax = b$, to do so I compute $x$ as $\mathbb{A}b$.
A =[
4 2
-9 -3
2 2
36 6]
and
b=[
-53.5461
-44.9373
-51.7330
-125.2530
]
the command x=pinv(A)*b in Matlab generates
x =
-2.5988
-3.1051
while Ax equals
-16.6054
32.7045
-11.4079
-112.1873
and it is supposed to be close to b, but it is not at all. I would like to know what is wrong here. Thanks.
The values are correct.
Note that the system is overdetermined, which means there is no solution, and
A*(pinv(A)*b)is giving you the projection of $b$ on the subspace generated by the columns of $A$ ($AA^+$ is the matrix of the orthogonal projection on the linear span of the columns of $A$). There is no reason it should be close to $b$.Another way to see this: $x$ is exactly the vector of coefficients in the linear regression where the dependent variable is $b$ and the regressors are the columns of $A$. The difference between $Ax$ and $b$ is the vector of residuals.