Eigenvalues of $AB$ and $BA$

Let $A$ and $B$ be $m \times n$ and $n \times m$ real matrices.

I proved that if $\lambda$ is a nonzero eigenvalue of the $m \times m$ matrix $AB$ then it is also an eigenvalue of the $n \times n$ matrix $BA$. But I am having trouble finding an example showing that this need not be true if $\lambda=0$

Thank you in advance

Solutions Collecting From Web of "Eigenvalues of $AB$ and $BA$"

Just take any nonzero (column) vector $v \in \mathbb{R}^m$ and, for $n = 1$, define

$$A := v \in \mathbb{R}^m \equiv \mathbb{R}^{m \times 1}, \quad B := v^T \in \mathbb{R}^{1 \times m}.$$

Note that $v^Tv = |v|^2 \ne 0$, so $BA$ is an invertible matrix of order $1$. What can you say about the rank and order of $AB$?

An explanation, following the question in the comments:

First, $AB$ is of order $2$. But,

$$\operatorname{rank}AB \le \min\{ \operatorname{rank}A, \operatorname{rank}B \}.$$

Since $A$ and $B$ have one column/row (respectively), their rank is at most $1$, so $AB$ also has rank at most $1$. Since $AB \ne 0$, its rank is exactly $1$, although that part is not important.

So, $AB$ is a square matrix of order strictly bigger than the rank ($2 > 1$), i.e., it is not of a full rank. What is this telling you?

However, my intention was that you take some $v$ — any $v$ you want! — that is a nonzero vector. For example, try

$$v = e_1 = \begin{bmatrix} 1 \\ 0 \end{bmatrix}$$

and see what you get with $A$ and $B$ defined as above.