MATLAB: Is there an algorithm to get value of a matrix where the multiplication of this with its pseudo inverse is a Singular matrix

algorithmlinear algebramatrixnumerical methodspinvpseudo inverse matrixsvd

I have a Singular matrix Z. Now I need to find such a matrix X where XX†=Z. Here X† is the pseudo inverse of matrix X and multiplication of X and X† is Z.

Best Answer

(I'm not sure why I bothered to answer this, since it has nothing to do with MATLAB.)
In general, no. That is not possible to do. So my guess is you are confused.
Given a general singular matrix, for example:
Z = magic(4)
Z =
16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1
rank(Z)
ans =
3
So we see that it is indeed singular. But can we do the construction that you ask for? NO!
Now, consider some general matrix X. You want us to find a matrix X, such that the product of X and the pseudo-inverse of X is Z?
Build the pseudo-inverse from the SVD.
[U,S,V] = svd(X,'econ');
Here, U,S,V have the property that
U*S*V' == X
The pseudo-inverse of X is given by inverting the non-zero singular values of X, so only inverting the non-zero diagonal elements of S that are larger a tolerance. Don't invert the zeros. Then just reconstruct the pseudo-inverse as
Xinv = V*Sinv*U'
But if we now multiply X with the constructed pseudo-inverse Xinv, we will get
X*Xinv = U*S*V'*V*Sinv*U'
Remember that V is orthogonal. So V'*V is the identity matrix. Therefore we can write the product X*Xinv as
X*Xinv = U*S*S'*U' = U*D*U'
And S is a diagonal matrix, as is Sinv. The only difference is that Sinv has inverted diagonal elements in it. So D=S*S' is also diagonal, with all elements on the diagonal that are exactly 1, followed by some zero elements. (The product of a singular value, or any number, with its inverse is 1.) You should recognize the above, U*D*U' as an eigenvalue decomposition when U is orthogonal, and D diagonal.
Essentially, we see that the product of any matrix X with its pseudo-inverse (as computed using SVD) will have all unit or zero eigenvalues.
So, unless your original matrix Z has only eigenvalues that are 0 or 1, then the problem has no solution. For the example I started with,
eig(Z)
ans =
34
8.9443
-8.9443
2.0576e-15
That clearly is not true since while one of the eigenvalues is effectively zero, the rest are not 1, so Z has no such decomposition.