Constructing a single qubit gate from S, H and Pauli gates

How can we construct a single qubit gate $$U = \mathrm{e}^{\frac{\mathrm{i}\pi}{4}}*\exp(−\frac{\mathrm{i}\pi}{4} Y)$$ from $$S$$, $$H$$ (Hadamard), and Pauli gates?

$$SHSHS3 = SHSHS^\dagger$$

I just don't know the process that led to this answer.

There may be a simpler way of doing this, but this certainly works.

First find the matrix representation of $$U$$ by multiplying out the terms. Remember that $$e^{i \theta Y} = \cos(\theta) I + i \sin(\theta)Y$$. The final result (thank you Sympy) is

$$U = \frac{1}{2} \begin{bmatrix} 1 + i & -1 - i \\ 1 + i & 1 + i \\ \end{bmatrix}$$

Now all single qubit transforms can be translated mechanically into the form $$e^{i\gamma} R_Z(\phi) R_X(\theta)R_Z(\lambda)$$. Qiskit provides a method to do that:

from qiskit.quantum_info import OneQubitEulerDecomposer

decomposer = OneQubitEulerDecomposer('ZXZ')
phi, theta, lam, gamma = decomposer.angles_and_phase(U)


You learn that $$\theta = \phi = \frac{\pi}{2}$$, $$\lambda = \frac{-\pi}{2}$$, and $$\gamma = \frac{\pi}4$$.

Now $$R_Z(\phi) = R_Z(\pi/2)$$ is just $$S$$, and $$R_Z(\lambda) = R_Z(-\pi/2)$$ is just $$S^\dagger$$. Any rotation around the X axis can be expressed as a rotation around the Z axis preceded and followed by an H. So $$R_X(\theta) = H R_Z(\theta) H = H S H$$

We have a leftover global phase $$\gamma$$ which we can ignore.

Putting the pieces together you get $$S HSH SSS$$.

I go about this in quite a different way (and get a different result). You're trying to make $$e^{-i\pi Y/4}=\frac{1}{\sqrt{2}}(I-iY).$$ Start by considering Hadamard: $$H=\frac{X+Z}{\sqrt{2}}.$$ We can use Pauli relations to write $$Z=-iXY$$. Hence, $$H=X\frac{I-iY}{\sqrt{2}}.$$ Thus, $$e^{i\pi Y/4}=XH$$. This is exactly what you want up to a global phase (and global phases don't matter).