# What is the difference between the two entanglement circuits?

For a three qubits system to be in an entanglement(GHZ) state, the circuit can be built as per Qiskit,

Here, the control bit of the second X gate is on q0. what if the control bit is shifted to q1. This also leads to entanglement. what is the difference between the two different ways?

Further to my question, I did the same for 5 qubits, I get different results:

which one is correct?

The two circuits are equivalent.

import qiskit.quantum_info as qi
from qiskit.circuit import QuantumCircuit
qc1 = QuantumCircuit(3)
qc1.h(0)
qc1.cx(0,1)
qc1.cx(0,2)
op1 = qi.Operator(qc1)
print(qc1)
┌───┐
q_0: ┤ H ├──■────■──
└───┘┌─┴─┐  │
q_1: ─────┤ X ├──┼──
└───┘┌─┴─┐
q_2: ──────────┤ X ├
└───┘

qc2 = QuantumCircuit(3)
qc2.h(0)
qc2.cx(0,1)
qc2.cx(1,2)
op2 = qi.Operator(qc1)
print(qc2)

┌───┐
q_0: ┤ H ├──■───────
└───┘┌─┴─┐
q_1: ─────┤ X ├──■──
└───┘┌─┴─┐
q_2: ──────────┤ X ├
└───┘

print(op1 == op2)
True


To see this more explicitly, note the following idenity

Thus you have

Note that $$CNOT*CNOT = I$$, and when the control qubit is $$|0\rangle$$ nothing happened so you can remove it.

• I am reading all your answers to gain more insights and here you are! answering my question. Thank you!! Nov 25, 2021 at 6:52
• No problem! :) I hope they are helpful. Nov 25, 2021 at 7:38
• I tried 5 qubits entanglement and I used these two differing ways(above two) and I see that I see that the results are totally different. AM I doing something wrong? Nov 25, 2021 at 14:10
• It should be the same. You might have created the circuit wrong. But they should be the same to any number of qubits. Nov 26, 2021 at 4:33
• I have the two circuits as a follow-up question. COuld you look at it. Thank you. Nov 26, 2021 at 15:34