Suppose we are given the matrix $$ M=\begin{pmatrix} z & x-iy\\ x+iy & -z \end{pmatrix} $$ constrained by $x^2+y^2+z^2=1.$ Note that by the constraints, the eigenvalues of $M$ are given by $\pm1$. My question is, how do we find a unitary matrix $R$ such that $$ R^{\dagger}MR=\sigma_z:=\begin{pmatrix} 1 & 0\\ 0 & -1 \end{pmatrix}? $$ We know such an $R$ exists because $M$ and $\sigma_z$ are unitarily equivalent. This might be a duplicate from:
Find a matrix for a unitary transform between matrices or prove that there is none,
but I still don't know how to construct $R.$
The eigenvalues of $M$ are found by calculating the characteristic polynomial
$$ \det(M-\lambda I_2)=\det\begin{pmatrix}z-\lambda & x-yi \\ x+yi & -z-\lambda\end{pmatrix}=\lambda^2-(x^2+y^2+z^2). $$
Thus, $\lambda=\pm1$ since $x^2+y^2+z^2=1$. Now, what about the eigenvectors? For $\lambda=1$,
$$ \underbrace{\begin{pmatrix} z-1 & x-yi \\ x+yi &-z-1 \end{pmatrix}}_{M-\lambda I_2}\begin{pmatrix}u\\v\end{pmatrix}=\begin{pmatrix}0\\0\end{pmatrix} $$
yields the eigenvector $\begin{pmatrix} u \\ v\end{pmatrix}\!=\!\begin{pmatrix}1+z \\ x+yi\end{pmatrix}$ or $\begin{pmatrix}x-yi \\1-z\end{pmatrix}$of squared norm $2(1\pm z)$.
(A quick solution to $au+bv=0$ is $(u,v)=(-b,a)$ or $(b,-a)$.)
Similarly for $\lambda=-1$, we get $\begin{pmatrix}x-yi \\ -1-z\end{pmatrix}$ or $\begin{pmatrix}-1+z \\ x+yi\end{pmatrix}$ again of squared norms $2(1\pm z)$.
Therefore we get the unitary matrix
$$ Q \,=\, \frac{1}{\sqrt{2(1+z)}}\begin{pmatrix}1+z & x-yi \\ x+yi & -1-z\end{pmatrix} \,=\, \frac{1}{\sqrt{2(1-z)}}\begin{pmatrix} x-yi & -1+z \\ 1-z & x+yi\end{pmatrix} $$
which satisfies $MQ=Q\Lambda$ with $\Lambda=\mathrm{diag}(1,-1)=\sigma_z$. This is because $Q$'s columns are eigenvectors of $M$, the columns of $MQ$ are just $M$ applied to the columns of $Q$, and the columns of $Q\Lambda$ with $\Lambda$ diagonal are just the columns of $Q$ scaled by the diagonal elements of $\Lambda$. Thus the spectral decomposition $M=Q\Lambda Q^\dagger$ (where $Q^\dagger=Q^{-1}$ because $Q$ is unitary), which we may rewrite as $Q^\dagger MQ=\sigma_z$.