For every mxn-matrix A with real entries, there exist a unique nxm-matrix B, also with real entries, such that
$$ABA = A$$ $$BAB = B$$ $$AB = (AB)^T$$ $$BA = (BA)^T$$
B is called the pseudoinverse of A. There is also a complex version, but I am only interested in the real one. Now my questions :
- If A has rational entries, must B also have rational entries ?
- How can I calculate the pseudoinverse of a matrix with PARI/GP ?
- Is there a simple method to calculate the pseudoinverse by hand for small matrices ?
- Under which condition are the entries of the pseudoinverse integers ?
I know some special properties, for instance, that for invertible square matrices A, the pseudoinverse is simply $A^{-1}$ , or that the pseudoinverse of a zero-matrix is its transposition, but I have not much experience with general pseudoinverses.
Edit. The old answer is wrong. Here is a corrected one.
For your first question, since $A$ has rational entries, it has a rank decomposition $A=XY$ such that $X$ is a tall matrix with full column rank and rational elements and $Y$ is fat matrix with full row rank and rational elements. One may verify, using the four defining properties of Moore-Penrose pseudoinverse, that $G=Y^+X^+$ is identical to $A^+$. Indeed, $$ \begin{aligned} &AGA=X(YY^+)(X^+X)Y=XY=A,\\ &GAG=Y^+(X^+X)(YY^+)X^+=Y^+X^+=G,\\ &AG=XYY^+X^+=XX^+\text{ is Hermitian},\\ &GA=Y^+X^+XY=Y^+Y\text{ is Hermitian}.\\ \end{aligned} $$ Since $X^+=(X^TX)^{-1}X^T$ and $Y^+=Y^T(YY^T)^{-1}$, they have rational entries. In turn, so does $A^+$.
For your third question, if $A$ is at most $3\times3$, you may try the formula $$ A^+ = \lim_{\delta \searrow 0} (A^\top A + \delta I)^{-1} A^\top = \lim_{\delta \searrow 0} A^\top (A A^\top + \delta I)^{-1}. $$
For your last question, I'm not sure if there are any nice and general sufficient conditions.