Methods for identifying points at which matrices become degenerate I have two Hermitian matrices, $A$ and $B$ and I am interested in analyzing the spectrum of the matrix,
$$A - \mu B$$
where $\mu$ is some real number. In particular, I want to know precisely the values of $\mu$ where the lowest two eigenvalues of the $A-\mu B$ matrix become equal, i.e. where the eigenspace of the lowest eigenvalue becomes degenerate. Doing this numerically, I'm taking what I'm guessing is a rather inefficient approach. I diagonalize $A-\mu B$ for different values of $\mu$ (searching over some range), and then compute the difference between the lowest two eigenvalues. If that difference falls within some tolerance, then I save the value of $\mu$ and the value of the difference. Then when the routine is complete, I run a function that finds local minima in the array of these difference values, and voila, I have identified the $\mu$ values at which this degeneracy occurs.
I'm wondering if there are methods I could use that are more sophisticated, or analytical that I could employ? An additional aspect of the problem is that these two matrices, $A$ and $B$ are actually both projections into a particular subspace. I construct them by taking,
\begin{align}
A &= U^\dagger Z U\\
B &= U^\dagger Z^2 U
\end{align}
for some third matrix $Z$ and some set of eigenvectors $U$ that span the subspace. I haven't come up with a way to use this fact at all as part of my approach.
 A: Disclaimer: this is not a complete answer, just some thoughts about the problem.
I assume that $Z$ is an $n \times n$ hermitian matrix and $A$ and $B$ are $m \times m$ matrices (also hermitian, by definition). Also $n \geq m$ (we're projecting to subspace).
Let $\tilde U$ be the projection matrix onto the orthogonal complement of the subspace spanned by $U$. So $Q = (U \,|\, \tilde U)$ is a square unitary matrix.
Let $W = Z - \mu Z^2$. Then
$$
\begin{pmatrix}
A - \mu B & \ast\\
\ast & \ast
\end{pmatrix}
=
\begin{pmatrix}
U^\dagger W U & U^\dagger W \tilde U\\
\tilde U^\dagger W U & \tilde U^\dagger W \tilde U\\
\end{pmatrix}
=
\begin{pmatrix}
U^\dagger\\
\tilde U^\dagger
\end{pmatrix}
W
\begin{pmatrix}
U &
\tilde U
\end{pmatrix}
= Q^\dagger W Q.
$$
$A - \mu B$ is a principal submatrix of $Q^\dagger W Q$. Note that the eigenvalues of $Q^\dagger W Q$ are the same as the eigenvalues of $W$ and the latter are $\lambda_i = \zeta_i - \mu \zeta_i^2$ where $\zeta_i$ are the eigenvalues of $Z$.
Doing some numerical experiments with small $n$ and $m$ suggests that the problem might not have solutions at all in general. Here's a typical plot for random hermitian $10 \times 10$ matrix $Z$ and $4 \times 4$ matrices $A$ and $B$. Below is a plot of eigenvalues of $A - \mu B$ as functions of $\mu$. The eigenvalues eventualy become closer, but never touch each other. The exception is $m = n$ case when eigenvalues are linear in $\mu$ and do intersect (and interchange after the intersection, see the second image).


Though I do not have a proof I suggest that equality of eigenvalues is possible only for very special choice of $U$ and in general does not occur. I tried applying Cauchy's eigenvalue interlacing theorem at least for $m = n - 1$ case, but it requires studing when inequalities are strict (so it allows to conclude that the lower pair of eigenvalues is separated and thus cannot be equal).
