Matrix equation with form of $AB=X$，$BA=Y$ where $A$, $B$ are unknown. Problem: Is there exist matrices $A, B$ that makes 
$AB= $$\bigl( \begin{smallmatrix} 7 & -1 \\ 9 & 3 \end{smallmatrix} \bigr)$, $ BA= $$\bigl( \begin{smallmatrix} 7 & -3 & 3\\ 3 & 1 &1\\ 3&-7&2  \end{smallmatrix} \bigr)$.
I want to use offset standard type to compute it, but it doesn't make sense.
Some advanced classmates solve it by some methods in the linear transformation, but I can't understand it clearly.
However, I guess that my teacher want us to solve it by some matrices method.
Thanks for your thinking.
 A: $\textbf{Proposition}.$ Let $U\in M_2,V\in M_3$ be given s.t. $spectrum(U)=\{\lambda,\mu\},spectrum(V)=\{\lambda,\mu,0\}$ where the complex $\lambda,\mu,0$ are distinct. Then the set $Z=\{A\in M_{2,3},B\in M_{3,2}\;;\;AB=U,BA=V\}$ is a non void algebraic set of dimension $2$ (two degrees of freedom).
$\textbf{Proof}.$ The fact that $Z\not= \emptyset$ is "well-known", cf. 
https://www.sciencedirect.com/science/article/pii/0024379568900475
Let $f:(X,Y)\in M_{2,3}\times M_{3,2}\rightarrow (XY-U,YX-V)\in M_{2,2}\times M_{3,3}$. Then $Df_X:H\in M_{2,3}\rightarrow (HY,YH),Df_Y:K\in M_{3,2}\rightarrow (XK,KX)$. It remains to show that, if $(X,Y)\in Z$, then the vector space $\{(H,K)\;;\; HY=0,YH=0,XK=0,KX=0\}$ has dimension $2$.
Clearly $rank(X)=rank(Y)=2$. Let $u$ be a one vector basis of $\ker(Y^T)$ (that is $u^TY=0$) and $v$ be  a one vector basis of $\ker(Y)$. Then $HY=0$ is equivalent to $H=[p,q]^T\otimes u^T$, cf.
https://en.wikipedia.org/wiki/Kronecker_product)
Moreover $YH=0$ is equivalent to $\{[p,q]^T,v\}$ are linearly dependent. Finally $H=\tau (v\otimes u^T)$ where $\tau$ is an arbitrary complex number. In the same way, we show a similar result for $K$ and we are done.
$\textbf{Remark.1}.$ Clearly, if $(A,B)$ is a solution, then $(1/\lambda A,\lambda B)$ is another one, that gives a degree of freedom; yet, there is another one...
EDIT. $\textbf{Remark.2}.$ Since the solutions depend on 2 parameters, you can choose (if you are not too unlucky), according to the @Michael Hoppe 's answer, $A=\begin{pmatrix}13&-9&6\\9&27&0\end{pmatrix}$; after, you obtain easily a unique solution for $B$.
That shows that you can obtain a particular solution of the problem by a purely linear process.
A: From $(AB)A=A(BA)$ you’ll get a system of six linear equations with the components of $A$ as unknowns.  Now try to solve it.
My CAS gives me — module typos — that any linear combination of
$$\begin{pmatrix}13&-9&6\\ 9&27&0\end{pmatrix}\text{ and }
\begin{pmatrix}41&-45&21\\ 56&0&27\end{pmatrix}$$
is a solution.
This was brute force, here’s a more elegant solution. As $AB$ and $BA$ have rank $2$ and rank of $A$ is at most $2$, the rank of $A(BA)$ and of $(AB)A$ is at most $2$, hence the rank of their difference is at most $4$. Therefore the kernel of $(AB)A-A(BA)$ is at least two-dimensional.
