# A “unique” solution to an equation over the orthogonal matrices?

Set $$D=\text{diag}(-1,1,1,\dots ,1)$$ be an $$n \times n$$ real diagonal matrix (where $$D_{11}=-1$$ and $$D_{ii}=1$$ for $$i>1$$).

Let $$R,Q$$ be special orthogonal matrices, satisfying $$RDQ=D$$. Is it true that $$R=Q^{-1}$$?

I know that $$Q^TDR^T=D$$, so $$Q^TDR^T=RDQ \Rightarrow UDU=D$$, where $$U=R^TQ^T$$.

Is there a slick way to continue from here (to shows that $$U=\text{Id}$$? $$UDU=D$$ is equivalent to $$UD=DU^T$$, i.e. $$U_{ij}D_j=D_iU_{ji}$$.

If $$R=Q=\begin{pmatrix}0&-1\\1&0\end{pmatrix}$$ then $$RDQ=D$$ but $$R=-Q^{-1}\neq Q^{-1}.$$
$$RDQ=D$$ implies $$Q^{-1}=D^{-1}RD.$$ So the question is whether $$R=D^{-1}RD.$$ This is true if and only if $$R$$ is of the form $$\left(\begin{array}{c|c} \pm 1 & 0_{1\times (n-1)}\\ \hline 0_{(n-1)\times 1} & R' \end{array} \right)$$ (Here $$R'$$ must be orthogonal. It must be special orthogonal if and only if the top left entry is $$1.$$)