# Help with PseudoInverse

I am trying to (pseudo)solve a linear system $Ax=y$. I have a matrix A, and 2 vectors x and y

A = {
{1, 1, 1, 0},
{1, 1, 0, 1},
{0, 1, 1, 0},
{0, 1, 0, 1}};
x = {pcv, pcf, pat, pnt};
y = {p11, p00, p10, p01};


Reading Wikipedia, I expect to obtain A.PseudoInverse[A].y == y. However I obtain

In[4]:= A.PseudoInverse[A].y

Out[4]= {p00/4 - p01/4 + p10/4 + (3 p11)/4, (3 p00)/4 + p01/4 - p10/4 + p11/4,
-(p00/4) + p01/4 + (3 p10)/4 + p11/4, p00/4 + (3 p01)/4 + p10/4 - p11/4}


What am I missing?

• I expect to obtain A.PseudoInverse[A].y == y this will be true if A is not singular which is not in your case. Jul 17, 2018 at 2:32
• Indeed, Det[A] == 0. Jul 17, 2018 at 3:37
• So, is it me or the wording in Wikipedia is confusing? Jul 17, 2018 at 3:40
• I think your conclusion A.pA.A== A (Wikipedia, pA=PseudoInverse[A]) => A.pA.y==y is dangerous. Jul 17, 2018 at 6:51

The Moore-Penrose pseudoinverse of A is a right inverse only if A is surjective. But your A is not surjective since Transpose[A] has a nontrivial kernel:

NullSpace[Transpose[A]]


{{1,-1,-1,1}}

But as generalized inverse, you have of course

A.PseudoInverse[A].A == A
PseudoInverse[A].A.PseudoInverse[A] == PseudoInverse[A]


True

True

Actually, this is true for each generalized inverses $$B$$ of $$A$$: If $$y$$ is not in the image of $$A$$, then $$A \, B \, y$$ cannot equal $$y$$ (the former lies in the image, the latter does not). But if $$y$$ is in the image of $$A$$, e.g., $$y = A\,x$$ then $$A \, B \, y = A\, B\, A\, x = A \, x = y$$. So we get:

$$A \, B\, y = y \quad \text{if and only if} \quad y \in \operatorname{ima}(A).$$