Quantum Entanglement Explained: Build a GHZ State and Run It
· 7 min read · ZKSF team
Entanglement is the effect Einstein called spooky action at a distance, and it is the single feature that makes a quantum computer more than a very small classical one. This is a hands-on introduction: we build the simplest useful entangled state, the GHZ state, from three qubits, then run the exact circuit live and read a certified result. It is the hello-world of quantum computing, and the first one-click template in the ZKSF console.
What entanglement actually means
Two qubits are entangled when you cannot describe one without describing the other. Measure one and you instantly know something about its partner, no matter how far apart they are, because the pair only ever had one shared description to begin with. A Bell state is the two-qubit version of this. A GHZ state (named for Greenberger, Horne and Zeilinger) is the generalisation to three or more qubits: every qubit in the register is bound into a single, indivisible whole.
The state we are about to build is written as an equal mix of all-zeros and all-ones. In words: the three qubits are either 000 or 111, both at once, and nothing in between. The moment you measure, the whole register commits to one of those two answers together.
The circuit: one Hadamard, a chain of CNOTs
Building it takes two ingredients. A Hadamard gate on the first qubit puts it into an even superposition of 0 and 1. A CNOT (controlled-NOT) gate then flips a second qubit only when the first is 1, which threads the first qubit's indecision through to the next. Chain the CNOTs along the register and the superposition propagates to every qubit.
OPENQASM 2.0;
include "qelib1.inc";
qreg q[3];
creg c[3];
h q[0];
cx q[0],q[1];
cx q[1],q[2];
measure q -> c;Read the diagram left to right as time. The cyan box is the Hadamard that creates the superposition. The emerald dots and crosses are the CNOTs: a filled dot marks the control qubit, the circled cross marks the target it flips. The dials on the right are measurements. Extending the chain with more CNOTs entangles more qubits, which is exactly how you scale a GHZ state up.
Running it live: a certified GHZ state
We submitted this exact circuit to ZKSF at 1,000 shots. The router inspected the gates, saw they were all Clifford, and sent the job to the Stim stabilizer engine, which simulates such circuits exactly at any scale. The measured outcome:
counts: {"000": 531, "111": 469}
error_info: {"method": "stabilizer (Gottesman-Knill)",
"truncation_error": 0.0,
"shot_noise_only": true, "shots": 1000}A perfect GHZ state collapses to 000 or 111 with equal probability, so over 1,000 shots the ideal split is 500/500. The measured 531/469 is textbook shot noise, the ordinary statistical scatter of a fair coin. The result that matters is what is absent: not a single shot landed on 001, 010, or any other in-between string. The three qubits always agreed. Because the stabilizer method is exact, the run carries a public ZCC-v0.1 certificate that anyone can verify.
Why GHZ states matter
Entanglement is the resource behind every quantum advantage, and GHZ states are the workhorse example. They appear across the field:
- Quantum error correction, where entangled blocks of qubits protect a single logical qubit.
- Quantum sensing and metrology, where GHZ states measure fields more precisely than any classical probe.
- Quantum secret sharing and cryptographic protocols that distribute a secret across many parties.
- Foundational tests of quantum mechanics, since GHZ states rule out local hidden-variable theories with a single measurement.
Try it yourself
GHZ is the first of six ready-to-run templates in the console, made for people who want to see a real quantum circuit without writing OpenQASM from scratch. Open the app, choose GHZ / Bell state from the template menu, and run it. Then change the length of the CNOT chain to entangle four, five, or five thousand qubits, and watch the certificate hold. When you are ready for an algorithm, the Grover search template finds a marked item in one shot, and quantum teleportation moves this same entanglement to work.
Run your own 100-qubit circuit, with an error bar.
