If $ k $ is a diagonal minor of a matrix $ A \in M_{m \times n}(\mathbb{C}) $ then $ k $ has the following form:
$$ M_{i_{1}, i_{2}, ..., i_{k}}^{i_{1}, i_{2}, ..., i_{k}}(A) = \begin{vmatrix} a_{i_{1}, i_{1}} & a_{i_{1}, i_{2}} & ... & a_{i_{1}, i_{k}}\\ a_{i_{2}, i_{1}} & a_{i_{2}, i_{2}} & ... & a_{i_{2}, i_{k}}\\ ... & ... & ... & ...\\ a_{i_{k}, i_{1}} & a_{i_{k}, i_{2}} & ... & a_{i_{k}, i_{k}} \end{vmatrix} ,$$
where $ 1 \leq i_{1} < i_{2} < ... < i_{k} \leq min(m, n) $.
Prove that for any matrix $ A \in M_{m \times n}(\mathbb{C}) $ and $ B \in M_{n \times m}(\mathbb{C}) $ and any natural number $ k $ with $ 1 \leq k \leq min(m, n) $, the sum of all $ k $ - diagonal minors of matrix $ AB $ is equal with the sum of all $ k $ - diagonal minors of matrix $ BA $.
Suppose that $m \leqslant n$. If needed ($m<n$), append rows of zeroes to $A$ and columns of zeroes to $B$ to change them into square $n\times n$ matrices $A'$ and $B'$. The only non-zero (diagonal) $k \times k$ minors of $A'B'$ are the same as the non-zero (diagonal) $k \times k$ minors of $AB$, hence the sum for $AB$ is the same as the sum for $A'B'$; similarly for $BA$ and $B'A'$.
The sums of diagonal minors are related (equal, modulo alternating signs) to the coefficients of the characteristic polynomial and for any square matrices $A'$ and $B'$, the products $A'B'$ and $B'A'$ have the same characteristic polynomial. Hence the sums of the diagonal $k \times k$ minors are the same.