The Three-Way Bond: Building a GHZ Entangled State
Project Overview:
You have already seen two qubits get entangled in earlier projects, but entanglement is not limited to pairs. A GHZ state, named after physicists Greenberger, Horne, and Zeilinger, links three or more qubits together so tightly that measuring any one of them instantly determines the exact outcome of all the others, every single time, with zero exceptions. In this project you will build a genuine three-qubit GHZ state in Qiskit and prove, using real measurement statistics, that all three qubits always agree, despite starting out in a shared superposition where their individual outcomes were not decided in advance.
Materials Required:
A computer with internet access
A free Google account, to use Google Colab, no installation needed
Basic comfort reading Python
Background: What Makes This Different From Regular Entanglement
A simple two-qubit entangled pair already breaks classical intuition, but a GHZ state pushes this further by linking three or more particles into a single correlated system. Before measurement, none of the three qubits individually holds a value of 0 or 1, they exist together in a shared superposition of all three being 0 or all three being 1, with no other combination possible. The moment you measure even one qubit, the other two are forced into matching outcomes instantly, regardless of distance between them. This three-way version of entanglement is actually used in real experiments to test the limits of quantum mechanics even more strictly than simple two-qubit tests can.
Step by Step Instructions
Set up your notebook.
Go to Google Colab at colab.research.google.com and create a new notebook.
Install Qiskit.
Type the following into a code cell and run it:
pip install qiskit qiskit-aer
Build the three-qubit GHZ state.
from qiskit import QuantumCircuit
from qiskit_aer import AerSimulator
qc = QuantumCircuit(3, 3)
qc.h(0)
qc.cx(0, 1)
qc.cx(0, 2)
qc.barrier()
qc.measure([0, 1, 2], [0, 1, 2])
print(qc.draw())
Run the circuit many times.
simulator = AerSimulator()
result = simulator.run(qc, shots=1000).result()
counts = result.get_counts()
print(counts)
Check your results.
You should see only two possible outcomes across all 1000 shots, 000 and 111, roughly split about 50 50 between them. No other combination, like 010 or 101, should ever appear. This confirms all three qubits are always landing on the exact same value together, never disagreeing, even though which value they land on is completely random from run to run.
Compare this to what three independent, non-entangled qubits would look like.
qc_independent = QuantumCircuit(3, 3)
qc_independent.h(0)
qc_independent.h(1)
qc_independent.h(2)
qc_independent.measure([0, 1, 2], [0, 1, 2])
result2 = simulator.run(qc_independent, shots=1000).result()
counts2 = result2.get_counts()
print(counts2)
Compare the two outputs.
This second version should show all eight possible combinations, 000 through 111, spread roughly evenly, since each qubit is now behaving independently with no connection to the others. Seeing this spread next to your earlier GHZ result makes the contrast obvious, entanglement is not just randomness, it is correlated randomness.
Stretch step, extend to four qubits.
Add a fourth qubit and a third cx gate, qc.cx(0, 3), to link it into the same GHZ state, then rerun and confirm you now only ever see 0000 or 1111 across all your measurements, showing the effect scales cleanly beyond three qubits.
Congratulations, you just built and verified a genuine multi-particle entangled state, the same type of state used in real experiments testing the foundations of quantum mechanics and in proposed architectures for quantum networks linking multiple nodes together.
Fun Fact:
GHZ states have actually been created experimentally with over a dozen entangled particles in real labs, and physicists continue pushing that number higher as a benchmark for how well a quantum computer or quantum network can maintain fragile multi-particle entanglement without it collapsing due to noise.