Determining multiplicity of 1 as an eigenvalue for a certain matrix By Matlab, I know that the eigenvalues of the matrix $B^{-1}A$ are 2.457, 0.542, and 1 (multiplicity 3) where $A$ and $B$ are defined as:
\begin{equation}
A=
\begin{pmatrix}
1 & 0 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 & 0 \\
0 & 0 & 2 & 1 & 1 \\
0 & 0 & 1 & 2 & 1 \\
0 & 0 & 1 & 1 & 2 \\
\end{pmatrix},
B=
\begin{pmatrix}
1 & 0 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 \\
0 & 0 & 0 & 2 & 1 \\
0 & 0 & 0 & 1 & 2 \\
\end{pmatrix}
\end{equation} 
Similarly, the eigenvalues of the matrix $B^{-1}A$ are 4.56, 0.43, and 1 (multiplicity 4) where $A$ and $B$ are defined as:
\begin{equation}
A=
\begin{pmatrix}
1 & 0 & 0 & 0 & 0 & 0\\
0 & 2 & 1 & 1 & 1 & 1 \\
0 & 1 & 2 & 1 & 1 & 1 \\
0 & 1 & 1 & 2 & 1 & 1\\
0 & 1 & 1 & 1 & 2 & 1\\
0 & 1 & 1 & 1 & 1 & 2\\
\end{pmatrix},
B=
\begin{pmatrix}
1 & 0 & 0 & 0 & 0 & 0\\
0 & 1 & 0 & 0 & 0 & 0\\
0 & 0 & 1 & 0 & 0 & 0\\
0 & 0 & 0 & 1 & 0 & 0\\
0 & 0 & 0 & 0 & 2 & 1\\
0 & 0 & 0 & 0 & 1 & 2\\
\end{pmatrix}
\end{equation} 
In general, given $n$, the matrices are defined as follows:
\begin{equation} 
A =
\begin{pmatrix}
I_{n-m_A} & 0 \\
0 & I_{m_A} + J_{m_A} \\
\end{pmatrix},
B =
\begin{pmatrix}
I_{n-m_B} & 0 \\
0 & I_{m_B} + J_{m_B} \\
\end{pmatrix},
\end{equation} 
where $m_A \ne m_B$ and they can be $1,...,n-1$ (so it can be that $m_A < m_B$). $J_m$ is a $m \times m$ matrix of ones. 
Is there any explanation to why the multiplicity of 1 as an eigenvalue is always $n-2$ where $n$ is the dimension of the matrices? 

Here's one.
Since $A$ and $B$ must always be invertible, the following conditions are equivalent:


*

*$1$ is an eigenvalue of $B^{-1}A$ for eigenvector $x$

*$B^{-1}Ax=x$

*$Ax = Bx$

*$(A-B)x=0$

*$x \in \ker(A-B)$
So the multiplicity of the eigenvalue $1$ of $B^{-1}A$ is equal to the dimension of $\ker(A-B)$.
Edit: As pointed out by Theo Bendit, it's worth showing that $B^{-1}A$ must be diagonalizable in order to rule out any issues of a discrepancy between algebraic and geometric multiplicity of the eigenvalue. One way to see that $B^{-1}A$ must be diagonalizable is to note that $A$ and $B$ are clearly symmetric and positive definite and then apply this result.
Let's now assume $m_A>m_B$; if the opposite is true, we can easily switch the roles of $A$ and $B$. If we examine $A-B$, we find that it has $n-m_A$ zero rows, followed by $m_A-m_B$ rows consisting of $n-m_A$ zeros and $m_A$ ones, followed by $m_B$ rows consisting of $n-m_A$ zeros, $m_A-m_B$ ones, and then $m_B$ zeros. Since $m_B$ and $m_A-m_B$ are both nonzero by assumption, $A-B$ has exactly two distinct nonzero rows, so has rank $2$; thus $\ker(A-B)$ has dimension $n-2$.
