Check characteristic polynomials of two block matrices for equality Let matrices $\mathbf{F}_1 \in \mathbb{R}^{n \times n}$, $\mathbf{G}_1 \in \mathbb{R}^{n\times n}$, $\mathbf{C}_1 \in \mathbb{R}^{n \times n}$, $\mathbf{D}_1 \in \mathbb{R}^{n \times n}$, $\mathbf{F}_2 \in \mathbb{R}^{n\times n}$, $\mathbf{G}_2 \in \mathbb{R}^{n\times n}$, $\mathbf{C}_2 \in \mathbb{R}^{n\times n}$ and $\mathbf{D}_2 \in \mathbb{R}^{n\times n}$ be building blocks of two larger matrices
\begin{equation}
    \mathbf{A} = \left[\begin{array}{ccc}
        \mathbf{F}_1             & \mathbf{0}   & \mathbf{G}_1\\
        \mathbf{G}_2\mathbf{C}_1 & \mathbf{F}_2 & \mathbf{G}_2\mathbf{D}_1\\
        \mathbf{D}_2\mathbf{C}_1 & \mathbf{C}_2 & \mathbf{D}_2\mathbf{D}_1
    \end{array}\right]
\end{equation}
and
\begin{equation}
    \mathbf{B} = \left[\begin{array}{ccc}
        \mathbf{F}_1 & \mathbf{G}_1\mathbf{C}_2  & \mathbf{G}_1\mathbf{D}_2\\
        \mathbf{0}   & \mathbf{F}_2              & \mathbf{G}_2\\
        \mathbf{C}_1 & \mathbf{D}_1\mathbf{C}_2  & \mathbf{D}_1\mathbf{D}_2
    \end{array}\right]
\end{equation}
Let $p_{\mathbf{A}(\lambda)} = \det(\lambda\mathbf{I} - \mathbf{A})$ and $p_{\mathbf{B}(\lambda)} = \det(\lambda\mathbf{I} - \mathbf{B})$ be characteristic polynomials of matrices $\mathbf{A}$ and $\mathbf{B}$, respectively. I would like to know whether the two characteristic polynomials are equal $p_{\mathbf{A}(\lambda)} = p_{\mathbf{B}(\lambda)}$.
For $n = 1$ the component matrices are scalars and $\mathbf{A},\mathbf{B} \in \mathbb{R}^{3\times 3}$. With this condition characteristic polynomials of two matrices are equal. This can be verified by the definition of the characteristic polynomial.
I don't know how to generalize this statement for $n > 1$. Any help would be appreciated.
 A: Let $\mathbf{X} \in \mathbb{R}^{3n\times 3n}$ and $\mathbf{Y} \in \mathbb{R}^{3n\times 3n}$.
According to Theorem 1.3.22 in the second edition of "Matrix Analysis" by Horn and Johnson characteristic polynomials of two matrix products are equal:
\begin{equation}
p_{\mathbf{X}\mathbf{Y}}(\lambda) = p_{\mathbf{Y}\mathbf{X}}(\lambda)
\end{equation}
I found the reference here.
This means if matrices $\mathbf{X}$ and $\mathbf{Y}$ exist for which $\mathbf{A} = \mathbf{X}\mathbf{Y}$ and $\mathbf{B} = \mathbf{Y}\mathbf{X}$ then characteristic polynomials of $\mathbf{A}$ and $\mathbf{B}$ are equal. These can be found by solving matrix equations:
\begin{equation}
\mathbf{X} = \left[\begin{array}{ccc}
\mathbf{I} & \mathbf{0} & \mathbf{0}\\
\mathbf{0} & \mathbf{F}_2 & \mathbf{G}_2\\
\mathbf{0} & \mathbf{C}_2 & \mathbf{D}_2
\end{array}\right]
\end{equation}
\begin{equation}
\mathbf{Y} = \left[\begin{array}{ccc}
\mathbf{F}_1 & \mathbf{0} & \mathbf{G}_1\\
\mathbf{0} & \mathbf{I} & \mathbf{0}\\
\mathbf{C}_1 & \mathbf{0} & \mathbf{D}_1
\end{array}\right]
\end{equation}
This proves that the statement can be generalized.
