Comparing the spectrum of the (non)centered matrices Suppose a symmetric matrix $A\in\mathbb{R}^{n\times n}$ is given. Let $J=I-\frac{1}{n}\cdot 1_n1_n^T\in\mathbb{R}^{n\times n}$ be the centering matrix, with $I$ being the identity matrix, and $1_n=[1 \dots 1]^T\in\mathbb{R}^n$.
Now, suppose $B=JAJ$, and $C=AJ$. How do the eigenvalues of $B$ and $C$ compare? I'm interested in the zero and non-zero spectrum behaviour.
With a simple $3\times 3$ example I obtain identical eigenvalues, but different eigenvectors. How could this be formalized mathematically?
 A: J is just the projector onto the subspace orthogonal to $1_n$. So, consider what A, B and C look like in an (orthonormal) basis in which $1_n$ is the first basis vector. In block form:
$$
A = \left[ \begin{array}{cc}
a & \vec{b}^T \\
\vec{b} & M
\end{array} \right], \quad
C = \left[ \begin{array}{cc}
0 & \vec{b}^T \\
0 & M
\end{array} \right], \quad
B = \left[ \begin{array}{cc}
0 & 0 \\
0 & M
\end{array} \right]
$$
As long as M doesn't have any zero eigenvalues then B and C have identical spectra. One sees this as follows. Because A is symmetric, M is symmetric. Let $\vec{v}_1,\ldots,\vec{v}_{n-1}$ be the eigenvectors of M, with corresponding eigenvalues $\lambda_1, \ldots, \lambda_{n-1}$.  Then C has the following n-1 right-eigenvectors (in block form):
$$
\left[ \begin{array}{c}
\lambda_j^{-1} \vec{b} \cdot \vec{v}_j \\
\vec{v}_j \end{array} \right] \quad j=1,\ldots,n-1
$$
with corresponding eigenvalues $\lambda_1, \ldots, \lambda_{n-1}$. The final right-eigenvector of C is
$$
\left[ \begin{array}{c}
1 \\
\vec{0}
\end{array} \right]
$$
with eigenvalue 0. (Here, $\vec{0}$ indicates the dimension n-1 zero vector.) Similarly, B has the right-eigenvectors
$$
\left[
\begin{array}{cc}
0 \\
\vec{v}_j
\end{array} \right] \quad j=1,\ldots,n-1
$$
with eigenvalues $\lambda_1,\ldots,\lambda_{n-1}$ and
$$
\left[ \begin{array}{c}
1 \\
\vec{0}
\end{array} \right]
$$
with eigenvalue 0. I'm not sure what happens when M has one or more zero eigenvalues.
A: Since $J^2 = J$, $B = J(AJ)$ and $C = (AJ)J$ have the same eigenvalues (see e.g. Are the eigenvalues of $AB$ equal to the eigenvalues of $BA$? (Citation needed!)).
