# What is the outcome of this circuit?

What would be the outcome of this circuit?

The outcome is $$-i\left| 11 \right\rangle$$. Here is how I obtained it.

$$\left| 01 \right\rangle \xrightarrow{\text{X}} \left| 11 \right\rangle \xrightarrow{\text{Y}} -i\left| 10 \right\rangle \xrightarrow{\text{CNOT}} -i\left| 11 \right\rangle \xrightarrow{\text{SWAP}} -i\left| 11 \right\rangle$$

$$X$$ gate changes 0 to 1, and 1 to 0:

$$X \left| 0 \right\rangle = \left| 1 \right\rangle \qquad X \left| 1 \right\rangle = \left| 0 \right\rangle$$

$$Y$$ gate also changes 0 to 1, and 1 to 0, but also changes the phase of the qubit:

$$Y \left| 0 \right\rangle = i\left| 1 \right\rangle \qquad Y \left| 1 \right\rangle = -i\left| 0 \right\rangle$$

CNOT changes the second qubit if the first qubit is in $$\left| 1 \right\rangle$$ state and does nothing if the first qubit is in $$\left| 0 \right\rangle$$ state:

$$CNOT \left| 00 \right\rangle = \left| 00 \right\rangle \qquad CNOT \left| 01 \right\rangle = \left| 01 \right\rangle$$

$$CNOT \left| 10 \right\rangle = \left| 11 \right\rangle \qquad CNOT \left| 11 \right\rangle = \left| 10 \right\rangle$$

SWAP gate changes the qubits, first qubit's state becomes the state of the second qubit and vice versa:

$$SWAP \left| 00 \right\rangle = \left| 00 \right\rangle \qquad SWAP \left| 01 \right\rangle = \left| 10 \right\rangle$$

$$SWAP \left| 10 \right\rangle = \left| 01 \right\rangle \qquad SWAP \left| 11 \right\rangle = \left| 11 \right\rangle$$

• what would be the input of this circuit and why? – toaster_fan Jan 13 at 17:37
• The input is given in your example: in the picture after q[0] it is written | 0> and after q[1] it is written |1>. So, the input state is |0>|1> = |01> – Davit Khachatryan Jan 13 at 17:41
• and for that particular input state (|01>) the circuit produces -i|11> state – Davit Khachatryan Jan 13 at 17:45
• I just applied the gates to the input state by taking into account that X|0> = |1>, Y|1> = -i|0>, CNOT |1> |0> = |1> |1> and SWAP |11> = |11> – Davit Khachatryan Jan 13 at 17:51
• I have edited the answer, hope now it is more clear how I obtained the result :) – Davit Khachatryan Jan 13 at 18:08