9

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.

Peter
  • 86,576
  • For the fourth question: If $A^+\in\mathbb Z^{n\times m}$ (every entry of $A^+$ is an integer), then from the answer to first question being "yes" we have that $A=(A^+)^+\in\mathbb Q^{m\times n}$ (every entry of $A$ must be rational), which gives us a necessary condition for the entries of the pseudoinverse to be integers. Not sure if there's a nice condition that's both necessary and sufficient. – xFioraMstr18 Sep 06 '22 at 07:11

3 Answers3

4

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.

user1551
  • 149,263
  • Why can "every matrix $A$ over the rationals can be written as a matrix product of the form $PDQ$, where $P$ and $Q$ are products of elementary matrices with rational entries and $D$ is a rectangular diagonal matrix over the rationals"? Do you have a reference? – xFioraMstr18 Sep 06 '22 at 03:43
  • Why does $A^+=Q^{-1}D^+P^{-1}$? The naive "identity" $(EF)^+=F^+E^+$ does not always hold (Wikipedia). And if $P,Q$ were unitary like in SVD, then we could directly verify the Hermitianness axioms (Axioms 3 and 4) in the axiomatic definition of the pseudoinverse. But that's not necessarily the case here. – xFioraMstr18 Sep 06 '22 at 10:04
  • @xFioraMstr18 Let $A=\begin{pmatrix}1&1\0&0\end{pmatrix},P=\begin{pmatrix}1&0\0&1\end{pmatrix}=I, D=\begin{pmatrix}1&0\0&0\end{pmatrix},Q=\begin{pmatrix}1&1\0&1\end{pmatrix}.$ Then $P,Q$ are invertible and $A=PDQ$, and we see $"A^+"A=Q^{-1}D^+P^{-1}PDQ=Q^{-1}D^+DQ=\begin{pmatrix}1&1\0&0\end{pmatrix}$ is not Hermitian (so $"A^+"$ is not the pseudoinverse). – xFioraMstr18 Sep 06 '22 at 10:28
  • 1
    @xFioraMstr18 Seems like you are right, but my mother is now under quarantine. I have to take care of her and will review my answer later. – user1551 Sep 07 '22 at 06:54
  • 1
    @xFioraMstr18 The answer is fixed now. Thanks for catching my mistake. – user1551 Sep 14 '22 at 11:38
2

Regarding the first question: Let $\mathbb F$ be a field (not necessarily $\mathbb R$ or $\mathbb C$), and let $m,n$ be nonnegative integers. Given an involutory field automorphism $a:\mathbb F\to\mathbb F$ (think complex conjugation), we can define a sort of "conjugate transpose" $\mathbb F^{m\times n}\to\mathbb F^{n\times m}$ via $A\mapsto A^*:=\left(a(A_{j,i})\right)_{i\in n,j\in m}$. This "conjugate transpose" lets us define what it means for a matrix $X\in\mathbb F^{n\times m}$ to be a pseudoinverse of $A.$ It can then be shown that every $A\in\mathbb F^{m\times n}$ has at most one pseudoinverse $X\in\mathbb F^{n\times m}$ (the usual proof carries over). The topic of existence is more delicate; it can be shown that an arbitrary $A\in\mathbb F^{m\times n}$ has a pseudoinverse belonging to $\mathbb F^{n\times m}$ if and only if we have the equalities $\text{rank}(A^*A)=\text{rank }A=\text{rank}(AA^*)$ [Bot13].

Now, consider the case where we have two fields $\mathbb E,\mathbb F$, and an involutory field automorphism $a:\mathbb F\to\mathbb F,$ where $\mathbb E\subseteq\mathbb F$ and $a|_{\mathbb E}:\mathbb E\to\mathbb E$ has range $\text{range}(a|_{\mathbb E})\subseteq\mathbb E.$ It is not difficult to see that $a|_{\mathbb E}$ will be an involutory field automorphism on $\mathbb E$, so, given two nonnegative integers $m,n$, we can apply the above theory to $\mathbb E^{m\times n}:$ Any $A\in\mathbb E^{m\times n}$ has a pseudoinverse belonging to $\mathbb E^{n\times m}$ iff $\text{rank}_{\mathbb E}(A^*A)=\text{rank}_{\mathbb E}A=\text{rank}_{\mathbb E}(AA^*).$ This string of equalities is in turn equivalent to $\text{rank}_{\mathbb F}(A^*A)=\text{rank}_{\mathbb F}A=\text{rank}_{\mathbb F}(AA^*)$ (rank does not change under field extension). This second string of equalities is equivalent to $A$ having a pseudoinverse belonging to $\mathbb F^{n\times m}$. Thus, $A$ has a pseudoinverse belonging to $\mathbb F^{n\times m}$ iff $A$ has a pseudoinverse belonging to $\mathbb E^{n\times m}$. (One direction is almost obvious, from the set inclusion $\mathbb E^{n\times m}\subseteq \mathbb F^{n\times m}$, but the converse might have been not obvious.)

Now, let us specialize to the case where $\mathbb F=\mathbb C$, $a=(\bar z)_{z\in\mathbb C}$ is complex conjugation, and $\mathbb E$ is any subfield of $\mathbb C$ such that $a|_{\mathbb E}:\mathbb E\to\mathbb E$. (Examples: $\mathbb C$ itself; the algebraic numbers $\mathbb A$; or any subfield of $\mathbb R$, such as $\mathbb R$ itself, $\mathbb Q$, or $\mathbb Q(\sqrt2)$.) We know that every $A\in\mathbb E^{m\times n}\subseteq\mathbb C^{m\times n}$ has a pseudoinverse, which we denote $A^+$, belonging to $\mathbb C^{n\times m}.$ Thus, from the above paragraph, $A$ has a pseudoinverse in $\mathbb E^{n\times m}\subseteq\mathbb C^{n\times m}$, and so from uniqueness in $\mathbb C^{n\times m}$ we have $A^+\in\mathbb E^{n\times m}$. Thus, the answer is yes.

In fact, for any $A\in\mathbb Z^{m\times n}$, the least common denominator of the image of $A^+$, $$\ell:=\min\{d\in\mathbb Z_{\ge1}:\forall i\in m~\forall j\in n\quad d(A^+)_{i,j}\in\mathbb Z\}$$ will divide (in $\mathbb Z$) $(\text{vol}A)^2$, where we define the volume $$\text{vol}~A:=\sqrt{\sum_{I,J}\det(A|_{I\times J})^2},$$ where the summation ranges over all cardinality-$r$ subsets $I,J\subseteq A$, where $r=\text{rank}~A$ [BhR02 p.81 Theorem 6.7, BouVre20]. (If $A$ is square and invertible, then $\text{vol}~A=|\det A|$.) In fact, based on a few examples I computed (with noninvertible integer-valued matrices whose nonzero entries are relatively prime), it seems we "often" have $\ell=(\text{vol}~A)^2$. For instance, in the example $[1;2]^+=5^{-1}[1,2]$ we have $\ell=5$.

Regarding the fourth question: We also have a necessary and sufficient condition when the entries of $A$ itself are integers: if $A\in\mathbb Z^{m\times n}$, then $A^+\in\mathbb Z^{n\times m}$ iff $\text{vol}~A=1$ [BhR02 Theorem 6.7]. As for arbitrary $A\in\mathbb Q^{m\times n}$, I'm unsure.

[BhR02] Bhaskara Rao, K. (2002). Theory of generalized inverses over commutative rings. CRC Press.
[Bot13] Botha, J. D. (2013). Matrices over finite fields. In: Hogben, L. (ed.). Handbook of Linear Algebra (2nd ed.). CRC Press. Section 31.5.
[BouVre20] Bouman, N. J., and de Vreede, N. (2020). A practical approach to the secure computation of the Moore–Penrose pseudoinverse over the rationals. In International Conference on Applied Cryptography and Network Security (pp. 398-417). Springer, Cham.

  • (The material describing arbitrary fields is rather inessential; the main point here is the equivalence with $\text{rank}(A^A)=\text{rank }A=\text{rank}(AA^)$.) – xFioraMstr18 Sep 06 '22 at 12:54
  • And actually this definition of pseudoinverse carries over from the setting of an arbitrary field to the setting of an arbitrary unital ring [BhR02 Section 3.1]. – xFioraMstr18 Sep 06 '22 at 14:41
  • @xFioraMstr18 some care is needed, however; we might want to assume the underlying ring has invariant basis number (e.g. if the underlying ring is commutative and nonzero) and assume all submodules of a module are free (e.g. if the underlying ring is a principal-ideal domain), so that we can define the rank of a matrix (cf. Hungerford's Algebra, Section VII.2). All in all, everything (the definition and proofs) seem to work for an arbitrary principal-ideal domain. – xFioraMstr18 Sep 06 '22 at 15:26
  • @xFioraMstr18 the result doesn't hold for arbitrary principal-ideal domains even; consider the case where the two principal-ideal domains are $\mathbb Z$ and $\mathbb C$. – xFioraMstr18 Sep 07 '22 at 01:17
  • @xFioraMstr18 It seems the result in [Bot13] fails to hold for arbitrary principal-ideal domains. The proof that he references relies on
    1. rank factorization, which no longer holds once we ditch a field for a PID ("Over a commutative ring $R$ if every [finite?] matrix has a rank factorization show that $R$ is a field" [BhR02 Exercise 3.3(b)]),

    2. the fact that over a field, any full-rank finite square matrix will be invertible (not generally true for PIDs).

    – xFioraMstr18 Sep 07 '22 at 02:00
0

This is not a proper definition of the pseudoinverse. There are two common definitions, the first concerning matrices where the Singular Value Decomposition is used, and the more general (which I prefer) in Hilbert spaces where we consider the minimum of $\left\|Ax-y \right\|$ over $X$ and then we define as $A^{+}y$ the minimizing $x$ with the minimum norm. All the condition you use are obtained as propositions by this definition of the pseudoinverse!