Prove that there exists a matrix $M$ such that $(AM)^2 = AM$ 
Prove that
  $$\forall A \in\mathbb{M}_n(\mathbb{K}), \exists M\in GL_n(\mathbb{K}): (AM)^2 = AM$$

The case where $A$ is invertible is simple, but the other case is not. 
 A: Let $a_1,\ldots,a_n$ be the columns of $A$, and let $a_{i_1}, a_{i_2},\ldots, a_{i_k}$ be a maximal linearly independent subset (i.e. a basis for the column space of $A$ using the columns of $A$). Then let $M$ be any invertible matrix that sends each $a_{i_j}$ to the $j$th basis vector. This makes $AM$ act as the identity on the column space of $A$, so we get $AMA=A$, which is what we're after.
A: Let us reformulate the question. Given a linear $f : \mathbb K^n \to \mathbb K^n$, find a linear automorphism $\phi : \mathbb K^n \to \mathbb K^n$ such that $(f \phi)^2 = f \phi$.
Choose a basis $\mathcal B  = \{b_1,\ldots,b_n\}$ of $\mathbb K^n$ such that $\{b_{k+1},\ldots,b_n\}$ is a basis of $\ker(f)$ for some $k \ge 0$. Then $\mathcal C' = \{c_1 = f(b_1),\ldots, c_k = f(b_k)\}$ is a basis of $\text{im}(f)$ (this is well-known). Add vectors $c_i$ for $i > k$ to obtain a basis $\mathcal C = \{c_1,\ldots, c_n\}$ of $\mathbb K^n$. Define an automorphism $\phi$ on $\mathbb K^n$ by $\phi(c_i) = b_i$. Then $p = f \phi$ has the property $p(c_i) = c_i$ for $i \le k$ and $p(c_i) = 0$ for $i > k$. Thus $p^2 = p$.
A: If $\operatorname{rank} A = r < n$ then, up to a basis change, 
$
A=
\begin{pmatrix}
B & \star \\
\star & \star
\end{pmatrix}
$
where the $r\times r$ matrix $B$ is invertible. Then, $A^+ = \begin{pmatrix}B^{-1}&0 \\ 0 & 0\end{pmatrix}$.
We can observe that 
$AA^+A=A$. Post-multiplying this equation by $A^+$ you have $AA^+AA^+=AA^+$.
