# Decomposition of gate $R_{y}$ into specific basis

How can I decompose gate $$R_{y}(\theta)$$ into gate $$R_{x}(\alpha)$$ and gate $$R_{z}(\beta)$$. And how to perform it on Qiskit, is there any function to do it.

## 1 Answer

Qiskit supports translating to different continuous basis sets by specifying the basis_gates in the transpile method. So in your case you could just do

>>> from qiskit import QuantumCircuit, transpile
>>> from qiskit.circuit import Parameter
>>> circuit = QuantumCircuit(1)
>>> circuit.ry(Parameter('theta'), 0)
>>> rxrz_basis = transpile(circuit, basis_gates=['rx', 'rz'])
>>> rxrz_basis.draw()
┌─────────┐┌───────────────┐┌─────────┐┌────────┐
q_0: ┤ RX(π/2) ├┤ RZ(theta + π) ├┤ RX(π/2) ├┤ RZ(3π) ├
└─────────┘└───────────────┘└─────────┘└────────┘



So you see that $$R_Y(\theta) = R_X\left(\frac{\pi}{2}\right) R_Z(\theta + \pi) R_X\left(\frac{\pi}{2}\right) R_Z(\pi)$$ where I replaced the $$3\pi$$ by $$\pi$$ in the last RZ rotation since the operation is mod $$2\pi$$.