A GHZ quantum circuit is a quantum computing system that includes 3 entangled qubits.
A Greenberger–Horne–Zeilinger state (GHZ state) is a certain type of entangled quantum state that involves at least three subsystems.
Demo in IBM Quantum Composer.
| def ghz(): | |
| """ | |
| Create a GHZ (entangled 3-qubit system) quantum circuit. | |
| """ | |
| qc = QuantumCircuit(3) | |
| qc.h(0) | |
| qc.cx(0, 1) | |
| qc.cx(0, 2) | |
| qc.measure_all() | |
| job = qiskit.execute(qc, qiskit.BasicAer.get_backend('qasm_simulator'), shots=1000) | |
| print(job.result().get_counts()) |
| {'000': 481, '111': 519} |

Hi. Are the 3-qubit GHZ and the 3-qubit cluster states exactly the same? If not, what is the difference?
Because from what I know, to generate a 3-qubit cluster state, we perform a Hadamard to all the 3 initial qubits (q0, q1, and q2). Why for the GHZ state we need to perform the Hadamard only on the first qubit?
Thank you.
Great question. They actually are different. A GHZ only uses an H on the first qubit and then CNOT (controlled inverse) for the other two qubits, which ties them all together in an entangled state. At this point, any change to the first qubit will be reflected on the other two entangled qubits.
If the qubits, instead, each had their own H gate, they would not be entangled. Changes on any one of the qubits would not effect the others.
I think the correct way to create a 3-qubit GHZ state would be as follows :
qc.h(0)
qc.cx(0, 1)
qc.cx(1, 2)
Great comment. In fact, both configurations are valid GHZ circuits.
The difference between the two GHZ state configurations lies in the order of the CNOT gates applied and which qubits serve as control and target. However, both methods result in the same final state.
Both sequences of CNOT gates achieve the ghz entanglement. Thank you.