A variation on the $AB$ vs $BA$ nonzero eigenvalues question.

Let $A\in\mathbb{R}^{m\times n}$ and $B\in\mathbb{R}^{n\times m}$, so that $AB\in\mathbb{R}^{m\times m}$ and $BA\in\mathbb{R}^{n\times n}$ both exist. Thanks to Sylvester's determinant identity, we know that $AB$ and $BA$ have the same nonzero eigenvalues. But here comes the actual question. Let

$$C = \begin{bmatrix} 0_m & I_m\\ AB & AB \end{bmatrix}$$

and

$$D = \begin{bmatrix} 0_n & I_n\\ BA & BA \end{bmatrix}.$$

Prove that $C$ and $D$ have the same nonzero eigenvalues.

For a block matrix $$M = \pmatrix{U & V\cr W & X\cr}$$ where $U$, $V$, $W$, $X$ are square matrices and $W$ and $X$ commute, $\det(M) = \det(UX - VW)$. In this case, for $\lambda \ne 0$ that says \eqalign{\det(C - \lambda I) & = \det(\lambda^2 I - (\lambda + 1) AB) =\lambda^{4m} \det(I - \lambda^{-2}(\lambda+1) AB)\cr \det(D - \lambda I) & = \det(\lambda^2 I - (\lambda + 1) BA) = \lambda^{4n} \det(I - \lambda^{-2}(\lambda+1) BA)\cr} but by Sylvester's determinant identity $\det(I - \lambda^{-2}(\lambda+1) AB) = \det(I - \lambda^{-2}(\lambda+1) BA)$.

Slightly more generally, the same method applies to eigenvalues other than $0$ and $\alpha$ of $\pmatrix{\alpha I & \beta I\cr AB & AB\cr}$ and $\pmatrix{\alpha I & \beta I\cr BA & BA\cr}$

Alternatively,

$$C \pmatrix{u\cr v\cr} = \lambda \pmatrix{u\cr v\cr}$$ with $\lambda \ne 0$ is equivalent to

\eqalign{v &= \lambda u\cr AB (u + v) &= \lambda v\cr} i.e. $v = \lambda u$ and $(1+\lambda) AB u = \lambda^2 u$. The condition for there to be a solution with $\lambda \ne 0$ and $u,v$ not both $0$ is that $1+\lambda \ne 0$ and $\lambda^2/(1+\lambda)$ is an eigenvalue of $AB$. But $AB$ and $BA$ have the same nonzero eigenvalues.

Assume that $m\geq n$. We know that $\det(xI-AB)=x^{m-n}\det(xI-BA)$.

Assume that $\lambda\not= -1$. One has $\det(C-\lambda I)=\det(\lambda^2I-(\lambda+1)AB)=(\lambda+1)^m\det(\dfrac{\lambda^2}{\lambda+1}I-AB)$ and, in the same way, $\det(D-\lambda I)=(\lambda+1)^n\det(\dfrac{\lambda^2}{\lambda+1}I-BA)$. Putting $x=\dfrac{\lambda^2}{\lambda+1}$, one obtains $\det(C-\lambda I)=(\lambda+1)^m(\dfrac{\lambda^2}{\lambda+1})^{m-n}\det(\dfrac{\lambda^2}{\lambda+1}I-BA)=\lambda^{2m-2n}(\lambda+1)^n\det(\dfrac{\lambda^2}{\lambda+1}I-BA)=$ $\lambda^{2m-2n}\det(D-\lambda I)$. By a continuity reasoning, we deduce that the previous equality is also valid when $\lambda=-1$, and we are done.