Using Python how can I implement a quantum circuit that returns $|01\rangle$ or $|10\rangle$ using only $CX$, $RX$ and $RY$ gates, starting with random parametric gates as parameters and optimizing it using gradient descent or other optimization algorithm?

  • 3
    $\begingroup$ Can you show what you have tried so far to answer this question? $\endgroup$
    – e-eight
    Sep 14 '20 at 18:28
  • $\begingroup$ I have used IBM Quantum Experience and have used an Rx gate (using pi/2 as theta) on qubit 1 $\endgroup$ Sep 24 '20 at 5:35

One potential combo is $ RY(\theta)$ on qubit 1, $CX$ from qubit 1 to qubit 2, then $RX(\pi)$ on qubit 2. This would be the following transformation:

$$ |0\rangle |0\rangle \mapsto (\cos \frac{\theta}{2} |0\rangle + \sin \frac{\theta}{2}|1\rangle)|0\rangle \mapsto \cos \frac{\theta}{2} |00 \rangle + \sin \frac{\theta}{2} |11\rangle \mapsto \cos \frac{\theta}{2} |01 \rangle + \sin \frac{\theta}{2} |10\rangle $$

This could be implemented in Python with QISKit/Q#/etc.

(Matrices for $RX$, $RY$: https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.rx / https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.ry)


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.