Rotation which diagonalizes the Hamiltonian I stumbled upon the following question:

Given the Hamiltonian of a spin-$1/2$ particle
$$\hat{H}=\epsilon\begin{pmatrix} 0 & -e^{i\pi/4}\\ 
 -e^{-i\pi/4} & 0 \end{pmatrix} = \frac{2\epsilon}{\hbar} \vec{S} \cdot \frac{\hat{y}-\hat{x}}{\sqrt{2}}$$
what is the rotation transformation that diagonalizes $\hat{H}$? Find the angle of rotation $\theta$ and the axis of rotation $\hat{n}$.

Finding the matrix which diagonalizes $\hat{H}$ is not particularly difficult. For instance,
$$U=\frac{1}{\sqrt{2}}\begin{pmatrix}
1 & -\frac{1+i}{\sqrt{2}}\\ 
\frac{1-i}{\sqrt{2}} & 1
\end{pmatrix}$$
does the job. However it is then claimed that this matrix corresponds to a transformation through an angle $\theta=\pi/2$ about $\hat{n}=(\hat{x}+\hat{y})/\sqrt{2}$. But I'm not quite sure how this can be immediately inferred from the entries of $U$. Moreover, I don't think that $U$ can be decomposed into a sum of $\sigma_x$ and $\sigma_y$ Pauli matrices. I thought about directly calculating $\mathcal{D(\hat{n},\theta})=\exp\left[-\frac{i}{\hbar}\vec{S}\cdot \left(\frac{\hat{x}+\hat{y}}{\sqrt{2}}\right)\right]$ (rotation operator) to check if it coincides with $U$ in the relevant basis, but it seems too exhausting. Perhaps I miss something trivial?
 A: Just use the standard exponentiation of Pauli matrices, knowing that $\vec S =\hbar \vec \sigma /2$ for the doublet representation,  which halves the rotation angles,
$$
e^{-i{\pi\over 4}\vec \sigma \cdot { (\hat x + \hat y) \over \sqrt{2}} } = 
 \cos (\pi /4) -i \vec{\sigma}\cdot \frac{(\hat x +\hat y)}  {\sqrt{2}} ~ \sin (\pi/4)\\ =
 \frac{1}{\sqrt{2}}  (I -i(\sigma_x+\sigma_y)/\sqrt{2})=U.
$$
It is analogous to Euler's formula.
I gather you have done the diagonalization algebra utilizing the properties of Pauli matrices: hardly any calculation!

*

*It might help your intuition to consider the two orthogonal unit vectors $\hat y \pm \hat x$ and to rotate the second by a right angle around the first: it will take you along $\hat z$, so a diagonal $\sigma_z$. Conversely, knowing $\sigma_z$ is the only diagonal Pauli matrix, how do you rotate $\hat y  - \hat x$ to $\hat z$? Obviously by a π/2 rotation around their cross product as an axis! Draw the figure.

A: REFERENCE :  My answer on How does the Hamiltonian changes after rotating the coordinate frame.
$\boldsymbol{=\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!=}$
Note : In the following for the unit vectors along the coordinate axes $\hat{x},\hat{y},\hat{z}$ I use the symbols $\mathbf{i},\mathbf{j},\mathbf{k}$ respectively.
$\boldsymbol{=\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!==\!=\!=\!=}$
The Hamiltonian is the following hermitian traceless matrix
\begin{equation}
H\boldsymbol{=}\alpha\left(\sigma_{y}\boldsymbol{-}\mathrm \sigma_{x}\right)\,,\quad \alpha\boldsymbol{=}\dfrac{\sqrt{2}\epsilon}{\hbar}
\tag{01}\label{01}
\end{equation}
From the bijection between hermitian traceless matrices and real 3-vectors (discussed in paragraph ''The reasoning'' of aforementioned REFERENCE) the representative real 3-vector of this Hamiltonian is
\begin{equation}
\mathbf{h}\boldsymbol{=}\alpha\left(\mathbf{j}\boldsymbol{-}\mathbf{i}\right)
\tag{02}\label{02}
\end{equation}
as shown in Figure-01.

If the Hamiltonian $H'$ of equation \eqref{01} must be transformed to a diagonal one $H'$ then we must have
\begin{equation}
H'\boldsymbol{=}c\,\sigma_{z} \,,\quad c\in \mathbb{R}
\tag{03}\label{03}
\end{equation}
Above expression is justified because not only  $\sigma_{z}$ is a diagonal hermitian matrix but moreover is traceless ($H'$ must be traceless since trace is invariant under similarity transformations).
To the transformed diagonal hermitian traceless matrix $H'$ there corresponds the representative real 3-vector
\begin{equation}
\mathbf{h'}\boldsymbol{=}c\,\mathbf{k}
\tag{04}\label{04} 
\end{equation}
If the transformation must be a rotation then the vector $\mathbf{h'}$ of equation \eqref{04} will be the image of the vector $\mathbf{h}$ of equation \eqref{02} so
\begin{equation}
\Vert\mathbf{h'}\Vert\boldsymbol{=}\Vert\mathbf{h}\Vert \quad \boldsymbol{\Longrightarrow} \quad c\boldsymbol{=}\sqrt{2}\,\alpha
\tag{05}\label{05} 
\end{equation}
that is
\begin{align}
H'&\boldsymbol{=}\sqrt{2}\,\alpha\,\sigma_{z}
\tag{06a}\label{06a}\\
\mathbf{h'} &\boldsymbol{=}\sqrt{2}\,\alpha\,\mathbf{k}
\tag{06b}\label{06b} 
\end{align}
as shown in Figure-01.
The most simple rotation that brings the vector $\mathbf{h}$ on vector  $\mathbf{h'}$ is around  a unit vector $\mathbf{n}$ through an angle $\theta$ given by
\begin{align}
\mathbf{n}&\boldsymbol{=}\dfrac{\mathbf{i}\boldsymbol{+}\mathbf{j}}{\sqrt{2}}
\tag{07a}\label{07a}\\
\theta &\boldsymbol{=}\dfrac{\pi}{2}
\tag{07b}\label{07b}  
\end{align}
shown in Figure-01. This rotation is represented by the following special unitary matrix $SU(2)$
\begin{equation}
\boxed{\:\:U_{\mathbf{n} ,\theta}\boldsymbol{=} \cos\frac{\theta}{2}\boldsymbol{-}i(\mathbf{n}   \boldsymbol{\cdot}  \boldsymbol{\sigma})\sin\frac{\theta}{2}\boldsymbol{=}\dfrac{\sqrt{2}}{2}\left(I\boldsymbol{-}i\,\dfrac{\sigma_x\boldsymbol{+}\sigma_y}{\sqrt{2}}\right)\vphantom{\dfrac{\dfrac{a}{b}}{\dfrac{a}{b}}}\:\:}
\tag{08}\label{08}
\end{equation}
It could be verified easily, using the properties of Pauli matrices, that $U_{\mathbf{n} ,\theta}$ diagonalizes the Hamiltonian $H$, that is
\begin{equation}
U_{\mathbf{n} ,\theta}\,H\,U^{*}_{\mathbf{n} ,\theta}\boldsymbol{=}H'
\tag{09}\label{09} 
\end{equation}
or explicitly
\begin{equation}
\dfrac{\sqrt{2}}{2}\left(I\boldsymbol{-}i\,\dfrac{\sigma_x\boldsymbol{+}\sigma_y}{\sqrt{2}}\right)\,\left(\sigma_y\boldsymbol{-}\sigma_x\vphantom{\dfrac{\sigma_x\boldsymbol{+}\sigma_y}{\sqrt{2}}} \right)\,\dfrac{\sqrt{2}}{2}\left(I\boldsymbol{+}i\,\dfrac{\sigma_x\boldsymbol{+}\sigma_y}{\sqrt{2}}\right)\boldsymbol{=}\sqrt{2}\,\sigma_z
\tag{10}\label{10} 
\end{equation}
Note that as there exist infinitely many rotations that bring the vector $\mathbf{h}\boldsymbol{=}\alpha\left(\mathbf{j}\boldsymbol{-}\mathbf{i}\right)$ of equation \eqref{02} to the vector $\mathbf{h'}\boldsymbol{=}\sqrt{2}\,\alpha\,\mathbf{k}$ of equation \eqref{06b}, so there are  infinitely many unitary matrices like that of equation \eqref{08} which  diagonalize the Hamiltonian $H\boldsymbol{=}\alpha\left(\sigma_{y}\boldsymbol{-}\mathrm \sigma_{x}\right)$ of equation \eqref{01}. For example, a rotation around a unit vector $\mathbf{m}$ through an angle $\phi$ given by
\begin{align}
\mathbf{m}&\boldsymbol{=}\dfrac{\boldsymbol{-}\mathbf{i}\boldsymbol{+}\mathbf{j}\boldsymbol{+}\sqrt{2}\mathbf{k}}{2}
\tag{11a}\label{11a}\\
\phi &\boldsymbol{=}\pi
\tag{11b}\label{11b}  
\end{align}
as shown in Figure-02 diagonalizes the Hamiltonian. The corresponging special unitary matrix is
\begin{equation}
\boxed{\:\:U_{\mathbf{m} ,\phi}= \cos\frac{\phi}{2}-i(\mathbf{m}  \boldsymbol{\cdot}  \boldsymbol{\sigma})\sin\frac{\phi}{2}=\dfrac{i}{2}\left(  \sigma_x-\sigma_y-\sqrt{2}\sigma_z \right)\vphantom{\dfrac{\dfrac{a}{b}}{\dfrac{a}{b}}}\:\: }
\tag{12}\label{12}
\end{equation}
Again, it could be verified easily, using the properties of Pauli matrices, that $U_{\mathbf{m} ,\phi}$ diagonalizes the Hamiltonian $H$, that is
\begin{equation}
U_{\mathbf{m} ,\phi}\,H\,U^{*}_{\mathbf{m} ,\phi}\boldsymbol{=}H'
\tag{13}\label{13} 
\end{equation}
or explicitly
\begin{equation}
\left[\dfrac{i}{2}\left(\sigma_x-\sigma_y-\sqrt{2}\sigma_z \right)\right]\,\left(\sigma_y\boldsymbol{-}\sigma_x\vphantom{\dfrac{\sigma_x\boldsymbol{+}\sigma_y}{\sqrt{2}}} \right)\,\left[\boldsymbol{-}\dfrac{i}{2}\left(\sigma_x-\sigma_y-\sqrt{2}\sigma_z \right)\right]\boldsymbol{=}\sqrt{2}\,\sigma_z
\tag{14}\label{14} 
\end{equation}

