4
$\begingroup$

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?

$\endgroup$
  • 2
    $\begingroup$ I expect to obtain A.PseudoInverse[A].y == y this will be true if A is not singular which is not in your case. $\endgroup$ – Nasser Jul 17 '18 at 2:32
  • $\begingroup$ Indeed, Det[A] == 0. $\endgroup$ – bbgodfrey Jul 17 '18 at 3:37
  • $\begingroup$ So, is it me or the wording in Wikipedia is confusing? $\endgroup$ – amrods Jul 17 '18 at 3:40
  • $\begingroup$ I think your conclusion A.pA.A== A (Wikipedia, pA=PseudoInverse[A]) => A.pA.y==y is dangerous. $\endgroup$ – Ulrich Neumann Jul 17 '18 at 6:51
5
$\begingroup$

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

Addendum

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).$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.