Let $A_1, A_2$ and $B_1, B_2$ be real symmetric matrices. Suppose $x A_1 + y B_1$ is cospectral with $x A_2 + y B_2$ for all real numbers $x, y$. Is it true that there exists a fixed orthgonoal matrix $Q$ independent of $x, y$ such that $(x A_1 + y B_1) Q = Q (x A_2 + y B_2)$?
I want to generalize Theorem 2 in Johnson, Charles R, and Morris Newman. “A Note on Cospectral Graphs.” Journal of Combinatorial Theory, Series B 28, no. 1 (February 1, 1980): 96–103. https://doi.org/10.1016/0095-8956(80)90058-1.
In the proof of Theorem 2, it says such a matrix can be concluded by a continuity-compactness argument.