In a derivation I encountered the following problem: Let $\mathbf{U}$ be an orthogonal matrix and $\mathbf{D}$ be a diagonal matrix with pairwise different, strictly positive elements, both of dimension $n$. An orthogonal similarity transformation $\mathbf{U^T} \mathbf{D} \mathbf{U} = \mathbf{M}$ turns $\mathbf{D}$ into a matrix $\mathbf{M}$ which has diagonal elements that are identical to each other (but is not necessarily a diagonal matrix [actually there would be no solution for diagonal $\mathbf{M}$]).
How can I determine an orthogonal matrix $\mathbf{U}$ which fulfills this condition?
Is it always possible to find such a matrix $\mathbf{U}$, regardless of the dimension $n$ and regardless of the choice of diagonal elements in $\mathbf{D}$?
There is a related question, but it only concerns $2 \times 2$ matrices: Is there a similarity transformation rendering all diagonal elements of a matrix equal?
Any ideas on this one? Thank you!