How can I build up an arbitrary quantum circuit given a certain unitary matrix operation?


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?


Posted 2020-01-20T14:15:06.057

Reputation: 127


You can implement this using a U3 gate, see how to do this in this question

– met927 – 2020-01-20T14:27:42.730



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

Martin Vesely

Posted 2020-01-20T14:15:06.057

Reputation: 7 763