|q⟩ Bad Qubits

beginner · Programming · Entanglement & Bell States

GHZ: Three-Qubit Entanglement

The GHZ state — named after Greenberger, Horne, and Zeilinger — is the simplest genuinely three-party entangled state. Written out, it is

GHZ=12(000+111).|\text{GHZ}\rangle = \frac{1}{\sqrt{2}}\bigl(|000\rangle + |111\rangle\bigr).

All three qubits are entangled together: measure any one of them and you instantly know the outcome of the other two, even though each qubit on its own is maximally mixed.

Building it step by step

Start from 000|000\rangle and apply three gates:

  1. Hadamard on qubit 0. This creates the superposition 12(0+1)00=12(000+100)\tfrac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \otimes |0\rangle \otimes |0\rangle = \tfrac{1}{\sqrt{2}}(|000\rangle + |100\rangle).

  2. CNOT from qubit 0 to qubit 1. The control is now in superposition, so the CNOT fires on the 1|1\rangle branch only, giving 12(000+110)\tfrac{1}{\sqrt{2}}(|000\rangle + |110\rangle).

  3. CNOT from qubit 0 to qubit 2. The same logic flips qubit 2 in the 1|1\rangle branch, producing 12(000+111)\tfrac{1}{\sqrt{2}}(|000\rangle + |111\rangle).

Putting all three operations together:

CNOT02  CNOT01  (HII)  000=12(000+111).\text{CNOT}_{0\to2}\;\text{CNOT}_{0\to1}\;(H \otimes I \otimes I)\;|000\rangle = \frac{1}{\sqrt{2}}\bigl(|000\rangle + |111\rangle\bigr).

Why GHZ matters

The GHZ state violates local-realistic inequalities in a sharper way than any two-qubit Bell state: a single simultaneous measurement of all three qubits produces a contradiction with classical hidden variables without any statistical averaging. It also forms the backbone of multi-party quantum secret sharing and quantum error correction protocols.

Try it

Build the GHZ state. The grader checks the full state vector: amplitude 12\tfrac{1}{\sqrt{2}} on 000|000\rangle and 111|111\rangle and zero amplitude everywhere else.

Run your code to see the quantum state.

After running, open the State tab: you should see only two non-zero amplitudes, each 0.707\approx 0.707, corresponding to the all-zeros and all-ones basis states.

Sign in on the full site to ask questions and join the discussion.