Suppose I have a real-symmetric matrix $X$. The spectral theorem guarantees that $X = O^T D O$ for some orthogonal matrix $O$ and diagonal matrix $D$. However, I would like to be able to diagonalize $X$ by a special-orthogonal matrix $\tilde{O}$ with determinant $1$. Is this possible in general?
The best I can come up with is that this is always possible in vector spaces of odd dimension. If $\dim(V) = 2k+1$, then, in the case that $\det(O) = -1$, I can write $\tilde{O} = -O$, and this is a special orthogonal matrix since $$\det(\tilde{O}) = (-1)^{2k+1}\det(O) = (-1)^{2k+2} = 1,$$ and furthermore, we have: $X = (-O)^T D (-O) = \tilde{O}^T D \tilde{O}$. This argument breaks down for even dimensional vector spaces since then you would need to introduce complex numbers and go to special-unitaries rather than special-orthogonals.
In a similar question, it was mentioned that you can express $X$ in a different basis so that the determinant of the orthogonal diagonalizing matrix switches from $-1$ to $+1$. However, it seems like this would only work if such a basis transformation is itself described by a special-orthogonal matrix, and it seems like this isn't the case in general. Moreover, I would like to not have to modify $X$ at all, except potentially via conjugation by a special-orthogonal matrix.