If we have a diagonal matrix D which verify
$D = A^*MA = B^*MB$
where $^*$ denotes the conjugate transpose,
with A, B and M being unitary matrices
Plus, B is symetric, M is real, and none of these matrices are equal to I.
Do we have $A = B$ ?
If we have a diagonal matrix D which verify
$D = A^*MA = B^*MB$
where $^*$ denotes the conjugate transpose,
with A, B and M being unitary matrices
Plus, B is symetric, M is real, and none of these matrices are equal to I.
Do we have $A = B$ ?
This is not true in general.
Let me first do a parallel with the spectral Theorem. This Theorem says that for a hermitian matrix $P$ there exists a unitary matrix $U$ and a diagonal matrix $D$ such that $P=UDU^*$. Now if we switch two diagonal elements in $D$, we just need to switch the corresponding columns of $U$ to get a pair $\tilde D,\tilde U$ of matrix that also satisfies $P=\tilde U\tilde D \tilde U^*$. Note also that if $v$ is an eigenvectors of $M$ then it is also the case of $-v$. Based on this observation you can already guess that the equality $A=B$ is not always true. For a counter example, just choose $D=\operatorname{diag}(a,a,b),a,b\in\Bbb R$ and any unitary matrix $A$ now set $B$ to be $A$ where you switch the first two columns or multiply a column by $-1$.
Nevertheless, since $A$ and $B$ are unitary, they have linearly independent columns $A(1),\ldots,A(n)$ and $B(1),\ldots,B(n)$ satisfying $MA(i)=d_{i,i}A(i)$ and $MB(i)=d_{i,i}B(i)$ for every $i$. It follows that the columns of $A$ are normed eigenvectors of $M$ and the same holds for $B$ (note that a matrix of dimension $n$ cannot have more than $n$ linearly independant eigenvectors).
It follows that $$A=B\Delta \Pi$$ where $\Pi$ is a permutation matrix (to replace the columns in the good order) and $\Delta $ is a diagonal matrix with only $1$ and $-1$ on its diagonal (because if $v$ is a normed eigenvector of $M$, the this is also the case of $-v$).
Finally note that if all diagonal elements of $D$ are distinct, then $A(i),B(i)$ are both normed eigenvectors belonging to an eigenvalue of multiplicity one and thus $A(i)= B(i)$ or $A(i) = -B(i)$, i.e. $A=B\Delta$ where $\Delta$ is a diagonal matrix with $1$ and $-1$ on its diagonal.