# How to approximate $Rx$, $Ry$ and $Rz$ gates?

Quantum Inspire is a quantum computing platform provided by QuTech. It consists of two real quantum processors - Starmon-5 and Spin-2. Whereas it is possible to use rotation gates $$Rx$$, $$Ry$$ and $$Rz$$ on Spin-2 processor, Starmon-5 gate set consist only of:

• Pauli gates $$\text{X}$$, $$\text{Y}$$, $$\text{Z}$$ and $$\text{I}$$
• Hadamard gate $$\text{H}$$
• Phase gate ($$\text{S}$$) and $$\pi/8$$ ($$\text{T}$$) gate and their conjugate transpose gates
• rotation around axes $$x$$ and $$y$$ for angle $$\pm\frac{\pi}{2}$$ gates
• $$\text{CNOT}$$, $$\text{CZ}$$ and $$\text{SWAP}$$ gates

My question is how can I construct gates $$Rx$$, $$Ry$$ and $$Rz$$ with rotation angle $$\theta$$ from gate listed above.

EDIT:

Based on advice from JSdJ and the Nielsen and Chuang book, I found out that:

• $$HTH = Rx(\pi/4)$$ which together with the fact that $$T=Rz(\pi/4)$$ allows to build gate $$R_{\hat{n}}=Rz(\pi/4)Rx(\pi/4)= \text{exp}(-i\frac{\pi}{8}Z)\text{exp}(-i\frac{\pi}{8}X) = \\ \cos^2\frac{\pi}{8}I-i(\cos\frac{\pi}{8}(X+Z)+\sin\frac{\pi}{8}Y)\sin\frac{\pi}{8}$$ (note that $$Y=-iZX$$)
• this is a rotation around axis defined by vector $$\hat{n}=(\cos(\pi/8);\sin(\pi/8);\cos(\pi/8))$$. Rotation angle is given by equation $$\cos(\theta/2) =\cos^2(\pi/8)$$
• angle $$\theta$$ is $$2\arccos[\cos^2(\pi/8)] \approx 1.096$$ which is irrational multiple of $$2\pi$$
• since $$\theta$$ is irrational, repeated application of the gate $$R_{\hat{n}}$$ never leads to rotation by an angle which sum up to $$2\pi$$
• as a result we are able to reach any rotation by angle $$\alpha$$ around $$\hat{n}$$ axis by repeated application of $$R_{\hat{n}}$$, i.e. we can construct $$R_{\hat{n}}(\alpha)=R_{\hat{n}}^{n_1}$$, where $$n_1$$ is an integer
• also it is true that $$HR_{\hat{n}}(\alpha)H = R_{\hat{m}}(\alpha)$$ where $$\hat{m}$$ is axis defined by vector $$(\cos(\pi/8);-\sin(\pi/8);\cos(\pi/8))$$, so the same procedure allows to find rotation for $$\alpha$$ around axis $$\hat{m}$$
• it can also be proven that any arbitrary single qubit unitary matrix $$U$$ can be written (up to global phase) as $$U = R_{\hat{n}}(\beta_1)R_{\hat{m}}(\gamma_1)R_{\hat{n}}(\beta_2)R_{\hat{m}}(\gamma_2)\dots$$
• together this leads to conclusion that any $$U$$ (including $$Rx$$, $$Ry$$ and $$Rz$$ rotations) can be approximated by repeated application of $$R_{\hat{n}}$$ and Hadamards, i.e. $$U \approx R_{\hat{n}}^{n_1}HR_{\hat{n}}^{n_2}HR_{\hat{n}}^{n_3}HR_{\hat{n}}^{n_4}H \dots$$, where $$n_i$$ are integers

To sum up, only with $$T$$ and $$H$$ gates we can construct any rotation.

Only question is how to find integers $$n_i$$ for construction of arbitrary $$Rx$$, $$Ry$$ and $$Rz$$ rotation. Can anybody give me an example of such circuit, for exaple gate $$Ry(\pi/8)$$?