Hint: I'll consider the same problem assuming, instead, that
\begin{align}
A\text{ is }3 \times 2 && B \text{ is } 2 \times 3 && AB = \begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 0 \\
\end{bmatrix}.
\end{align}
- Since $AB$ has rank $2$, and $A$ is $2 \times 3$, the rank of $A$ must also be $2$. In fact, the column space of $A$ must equal the column space of $AB$. So, $A$ has the form
$A=\begin{bmatrix}
* & * \\
* & * \\
0 & 0 \\
\end{bmatrix}$
for some undetermined $2 \times 2$ invertible matrix.
- For similar reasons, the null space of $B$ must equal that of $AB$. So, $B$ has the form
$B=\begin{bmatrix}
* & * & 0 \\
* & * & 0 \\
\end{bmatrix}$
for some undetermined invertible matrix.
- From the equation $AB = \begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 0 \\
\end{bmatrix}$, we see that the undetermined $2 \times 2$ matrices are inverses of one another. Given this, one checks that $BA = \begin{bmatrix}
1 & 0 \\
0 & 1 \\
\end{bmatrix}$
Remark: For the original unmodified problem, note that, since $AB$ is symmetric, it is diagonalizable (even orthogonally so). Moreover, its diagonal form turns out to be $9$ times projection onto two coordinates. Let $U$ be an invertible $3 \times 3$ matrix with $$UABU^{-1} = \begin{bmatrix}
9 & 0 & 0 \\
0 & 9 & 0 \\
0 & 0 & 0 \\
\end{bmatrix}.$$ Apply the above argument to $A_1 = UA$ and $B_2 = BU^{-1}$ in order to compute $B_2A_2 = BA$.