Can you solve for the identity matrix where A is non-invertible? If you have an $n\times m$ matrix $A$, and we assume that those dimensions are something like $3\times6$, is there a matrix $D$ such that $AD = I$?
 A: You can prove the following result:
Claim Let $A$ be a $2 \times n$ matrix. Then, there exists a $n \times 2$ matrix $B$ so that $AD=I_2$ if and only if $\mbox{Rank}(A)=2$.
More generally, for an $m \times n$ matrix $A$, there exists a $n \times m$ matrix $B$ so that $AD=I_m$ if and only if $\mbox{Rank}(A)=m$.
This can be proven by using the fact that the corresponding linear transformation $T :\mathbb R^n \to \mathbb R^2$ is onto and hence has a right inverse.
A more elementary solution, which also tells you how to find $D$, is the following:
The systems
$$Ax= \begin{bmatrix} 1 \\ 0 \end{bmatrix} \\
Ay= \begin{bmatrix} 0 \\ 1 \end{bmatrix} \\
$$
are consistent (why?). Let $D$ be the matrix with columns $x$ and $y$ respectively.
Then
$$
AD = \begin{bmatrix} 1 &0 \\ 0&1 \end{bmatrix} 
$$
A: There is no general answers. It is clearly impossible if $A=0$ for example. However that is possible for the example
$$A=\begin{pmatrix}
1 &0&0&0\\
0& 1&0&0
\end{pmatrix}$$
A: If $A$ is $n\times m$, with $n\lt m$, then you can find an $m\times n$ matrix $B$ such that $AB=I_n$, the $n\times n$ identity, if and only if $A$ has rank $n$. You cannot find a matrix $C$ such that $CA=I_m$, however.
If $A$ is $n\times m$ with $m\lt n$, then you can find an $m\times n$ matrix $B$ such that $BA=I_m$ if and only if $A$ has rank $m$; you cannot find a matrix $C$ such that $AC=I_n$, however.
If $A$ is square, $n\times n$, then you can find an $n\times n$ matrix $B$ such that $AB=I_n$ if and only if you can find an $n\times n$ matrix $C$ such that $CA=I_n$, if and only if $A$ has rank $n$; and in this case, $C=B$.
In summary, you can find an inverse on one side if and only if $A$ has full rank; and in that case, the side will be the one that gives you the "smaller" identity matrix.
A: If $AA^T$ is invertible, then $D=A^T(AA^T)^{-1}$. This is the Moore-Penrose inverse; see https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_inverse.
Below is a series of Python commands to find the pseudo-inverse of a 2 x 4 matrix.
>>> import numpy as np
>>> A = np.array([[2, 4, -6, -10], [4, 8, -8, -8]])
>>> A
array([[  2,   4,  -6, -10],
       [  4,   8,  -8,  -8]])
>>> np.linalg.pinv(A)
array([[-0.06060606,  0.06818182],
       [-0.12121212,  0.13636364],
       [ 0.02272727, -0.05681818],
       [-0.17424242,  0.10227273]])
C = np.linalg.pinv(A)
>>> C.dot(A)
array([[ 1.00000000e+00, -2.22044605e-16],
       [ 8.88178420e-16,  1.00000000e+00]])

Note that since $n < m$, we can only find a left-inverse. Rank-nullity quickly implies that no right-inverse exists.
