Determinants and Characteristic Polynomial of Matrices 
Let $A \in M_{mxn}(F)$ and $B \in M_{nxm}(F)$, show that
$$x^ndet|xI_m-AB| = x^mdet|x I-BA|.$$ Deduce that if n=m, then AB and BA have the same characteristic polynomial.

The second part should be easy to prove: if n=m, then $$x^ndet|xI-AB| = x^ndet|x I-BA| \implies det|xI-AB| = det|xI-BA|$$ which means the characteristic polynomial is the same since $det|xI-AB|$ or $det|xI-BA|$ gives the exact characteristic polynomial of AB and BA respectively.
For the first part, I am not sure how to proceed with the left side being determinant of mxm matrix while right side being determinant of nxn matrix.
 A: Consider the matrices
$\mathcal C$, $\mathcal D$ below,
compute $\mathcal C\mathcal D$ and $\mathcal D\mathcal C$
$$
\begin{aligned}
\mathcal C&=\begin{bmatrix} I_m & -A\\ & I_n\end{bmatrix}\ ,\\
\mathcal D&=\begin{bmatrix} xI_m & xA\\ B&xI_n\end{bmatrix}\ ,\\[3mm]
%
\mathcal C\mathcal D &=
\begin{bmatrix} I_m & -A\\ & I_n\end{bmatrix}
\begin{bmatrix} xI_m & xA\\ B&xI_n\end{bmatrix}
=
\begin{bmatrix} xI_m-AB & \\ *& xI_n\end{bmatrix}\ ,\\
%
\mathcal D\mathcal C &=
\begin{bmatrix} xI_m & xA\\ B&xI_n\end{bmatrix}
\begin{bmatrix} I_m & -A\\ & I_n\end{bmatrix}
=
\begin{bmatrix} xI_m & \\ * & xI_n-BA\end{bmatrix}\ ,
\end{aligned}
$$
(empty entries are zero block matrices, star entries do not matter any more,)
and use finally the multiplicativity of the determinant
$$
\det(\mathcal C\mathcal D)
=\det(\mathcal C)\det(\mathcal D)
=\det(\mathcal D)\det(\mathcal C)
=\det(\mathcal D\mathcal C)
\ ,
$$
and the relations
$$
\det\begin{bmatrix}S&\\*&T\end{bmatrix}=\det(S)\det(T)\ ,\qquad
\det(xI_m)=x^m\det(I_m)=x^m\ .
$$
