Which matrices in $\operatorname{SL}_2(\mathbb R)$ have orthogonal squares? This is a self answered question, which I post here since, it turned out to be quite nice, and wasn't trivial for me. Of course, I would be happy to see other approaches.
Question:

Characterize all the matrices $X \in \operatorname{SL}_2(\mathbb R)$, with distinct singular values whose square $X^2 \in \operatorname{SO}(2)$.

(If the singular values are equal, then $X$ itself already lies in $ \operatorname{SO}(2)$).
I guess that a natural way to do that is through the SVD form of $X$.
Edit:
It turns out that $X^2 \in \operatorname{SO}(2) \iff X^2=-Id$. I find this quite surprising. I would be happy to see other proofs which start with the assumption $X^2 \in \operatorname{SO}(2)$ and deduce $X^2=-Id$.
 A: Well, perhaps surprisingly, the answer does not depend on the singular values of $X$ at all (except on them being different from each other).
Claim:

Let $X=U\Sigma V^T \in \operatorname{SL}_2,U,V \in \operatorname{SO}(2)$, $\Sigma$ positive-definite. Suppose that the singular values of $X$ are distinct. Then the following are equivalent:


*

*$X^2 \in \operatorname{SO}(2)$

*$V^T U \in \{R_1,R_2\}$, where $R_1:=\begin{pmatrix} 0 & -1 \\\ 1 & 0\end{pmatrix}$ and $R_2:=\begin{pmatrix} 0 & 1 \\\ -1 & 0\end{pmatrix}$.

*$X^2=-Id$.

This means that we can choose $V \in \operatorname{SO}(2)$ as we want to, and then given $V$, $U$ has only two options, $VR_1$ or $VR_2$. (so we essentially have two distinct copies of $\operatorname{SO}(2)$).
Proof:
$X^2=U\Sigma V^T U\Sigma V^T=U\Sigma Q\Sigma V^T$ where $Q=V^T U \in \operatorname{SO}(2)$. Thus
$$
X^2 \in \operatorname{SO}(2) \iff A:=\Sigma Q\Sigma \in \operatorname{SO}(2) \iff
$$
$$A^TA=\Sigma Q^T \Sigma^2 Q\Sigma = Id \iff Q^T \Sigma^2 Q=\Sigma^{-2} \iff (Q^T \Sigma Q)^2=(\Sigma^{-1})^2 \iff Q^T \Sigma Q=\Sigma^{-1},$$
where the last equivalence followed from the uniqueness of the symmetric positive-definite square root.
Thus we showed that $X^2 \in \operatorname{SO}(2) \iff  Q^T \Sigma Q=\Sigma^{-1}$.
Note that if $\Sigma=\operatorname{diag}(\sigma_1,\sigma_2)$, then $\Sigma^{-1}=\operatorname{diag}(\sigma_1^{-1},\sigma_2^{-1})=\operatorname{diag}(\sigma_2,\sigma_1)$, so $\Sigma^{-1}$ is obtained from $\Sigma$ by switching the diagonal entries. (here we used the fact $\sigma_1 \sigma_2=1$ i.e. $X \in \operatorname{SL}_2$).
Define $P=
\begin{pmatrix} 0 & 1 \\\ 1 & 0\end{pmatrix}. $
Direct calculation shows that
$\Sigma^{-1}=P\Sigma P=P^T\Sigma P$. Combining this with $Q^T \Sigma Q=\Sigma^{-1}$, we obtain
$$
X^2 \in \operatorname{SO}(2) \iff P^T\Sigma P=Q^T \Sigma Q \iff (QP^T) \Sigma =\Sigma (QP^T) \iff QP^T \in \operatorname{O}^{-}(2) \, \, \text{ is diagonal.}
$$
(Since a matrix which commutes with a diagonal matrix with distinct entries must be diagonal. Here we use the fact that the singular values of $X$ are distinct).
Since the only diagonal orthogonal matrices in $\operatorname{O}^{-}(2) $ are $\begin{pmatrix} 1 & 0 \\\ 0 & -1\end{pmatrix}, \begin{pmatrix} -1 & 0 \\\ 0 & 1\end{pmatrix}$, we deduce that $QP^T$ must be equal to one of those matrices, which implies that
$Q=R_1:=\begin{pmatrix} 0 & -1 \\\ 1 & 0\end{pmatrix}$ or $Q=R_2:=\begin{pmatrix} 0 & 1 \\\ -1 & 0\end{pmatrix}$.
So, we proved that $X^2 \in \operatorname{SO}(2) \iff V^TU=R_i$ for $i \in \{1,2\}$.

Edit:
We finally prove that $X^2 \in \operatorname{SO}(2) \iff X^2=-Id$.
We proved that $X^2 \in \operatorname{SO}(2) \iff \iff Q^T \Sigma Q=\Sigma^{-1} \iff  \Sigma Q \Sigma=Q \iff X^2=UQV^T$ where in the last assertion we have used the fact that $X^2=U\Sigma Q\Sigma V^T$.
Using $Q=V^TU$ we got
$X^2 \in \operatorname{SO}(2) \iff X^2=UV^TUV^T$.
Since $Q=R_i$, we have $U=VR_i$, so $X^2=UV^TUV^T$ becomes
$$
X^2=(VR_i)V^T(VR_i)V^T=VR_i^2V^T=-Id, 
$$
since $R_i^2=-Id$.
