3
$\begingroup$

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.

$\endgroup$
6
$\begingroup$

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$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.