An example of matrices such that "AB=E, but not of BA" [closed]

One of my classmates ask me a question, but I could not find an anti-example: I want to find an example of matrices such that "AB=E, but not of BA"

where, A and B are matrices (both square and not are ok) on the complex field and E is the identity matrix.


This cannot happen with square matrices. If $AB=\operatorname{Id}$, then both $A$ and $B$ are invertible, and $B=A^{-1}$. But then $BA = A^{-1}A = \operatorname{Id}$.

On the other hand consider $A = \left(1 \quad 0 \right)$ and $B = \begin{pmatrix} 1 \\ 1 \end{pmatrix}$. Then $AB = (1)$ and $BA = \begin{pmatrix}1 & 0 \\ 1 & 0 \end{pmatrix}$.