1
$\begingroup$

I am learning how to make Grover's algorithm but the last cx gate needs to be the opposite way around. It always makes the top qubit the control, so how do you turn it around?

$\endgroup$
4
$\begingroup$

If you click the CX gate itself, it will be surrounded by a dashed box with a pen symbol in the top right corner.

enter image description here

If you click this pen you can choose which qubit is the target and which is the control by drag-and-drop.

dd pi

| improve this answer | |
$\endgroup$
1
$\begingroup$

Just to add. If you do not have a possibility to switch control and target qubits, you can implement "upside down" CNOT with this circuit:

$$ (H \otimes H) CNOT (H \otimes H), $$

where $H$ is Hadamard gate and $CNOT$ is controlled NOT with control qubit upside and target qubit downside.

| improve this answer | |
$\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.