# How to create a unitary gate using normalized complex numbers in qiskit?

If I have a normalized $$(\alpha,\beta)$$ as $$(0.24506+0.9633i,0.0046238+0.10943i)$$ for a qubit $$\left| \psi \right> = (\alpha_1 + i\alpha_2 ) \left|0\right> + (\beta_1 + i\beta_2 )\left|1\right>$$, how can I generate angles for a unitary gate by using above data and can I run this on qiskit?

Here is my attempt.

First, let's create the statevector:

from qiskit.quantum_info.states import Statevector
alpha = complex(0.24506488, 0.9633)
beta = complex(0.0046248, 0.10943)
sv = Statevector([alpha,beta])


$$\begin{bmatrix} 0.24506 + 0.9633i & 0.00462 + 0.10943i \\ \end{bmatrix}$$

Then, we can initialize a circuit in that state and transpile it to a rotation-only basis:

from qiskit import QuantumCircuit, transpile

qc = QuantumCircuit(1)
qc.initialize(sv, [0])
transpile(qc, basis_gates=['rx', 'ry', 'rz']).draw()


• Thank you for responding ,When I try to run a state vector or qasm simulator I am getting error. Mar 9 at 16:58
• sounds like an independent question. What's the error? Mar 13 at 19:53