Suppose I want to put a qubit whose initial state is $|0\rangle$ to the final state $\frac{1}{\sqrt{3}}|0\rangle + \sqrt{\frac{2}{3}}|1\rangle$.

Well, in that case, the unitary matrix that performs such operation is given by: $$U = \frac{1}{\sqrt{3}}\begin{pmatrix}1&-\sqrt{2}\\ \sqrt{2} & 1 \end{pmatrix}$$ So the question is, how can I build a quantum circuit with the usual quantum gates (X, Y, Z, etc) which reproduces this behavior?

  • 2
    $\begingroup$ You can implement this using a U3 gate, see how to do this in this question $\endgroup$
    – met927
    Jan 20, 2020 at 14:27

1 Answer 1


You can use $Ry$ (y-rotation gate). Its general matrix is

$$ Ry(\theta) = \begin{pmatrix} \cos(\theta/2) & -\sin(\theta/2) \\ \sin(\theta/2) & \cos(\theta/2) \end{pmatrix} $$

Applying the gate on $|0\rangle$ state, you get a state

$$ |\psi\rangle = \cos(\theta/2)|0\rangle + \sin(\theta/2)|1\rangle $$

Hence $\cos(\theta/2) = \frac{1}{\sqrt{3}}$ and

$$ \theta = 2\arccos\Big(\frac{1}{\sqrt{3}}\Big) = 1.910633. $$

You can validate that such setting of $\theta$ gets your matrix $U$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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