|q⟩ Bad Qubits

advanced · Programming · Capstone Projects

Capstone: Original Research Demo

The track ends as research does: with a question of your own, reduced to something you can actually run and check. This capstone walks one complete miniature project — posing a question, designing a circuit, building it, and self-verifying the result — as a template for the original demo you will design next.

The question

Can I prepare a maximally entangled four-qubit GHZ state with a linear-depth circuit, and confirm I succeeded without doing full state tomography?

The Greenberger–Horne–Zeilinger state generalizes the Bell pair to nn qubits:

∣GHZn⟩=12(∣0⟩⊗n+∣1⟩⊗n).|\mathrm{GHZ}_n\rangle = \frac{1}{\sqrt{2}}\bigl(|0\rangle^{\otimes n} + |1\rangle^{\otimes n}\bigr).

It is the canonical "all or nothing" entangled state — measuring any one qubit instantly fixes all the others — and a standard benchmark for how many qubits a device can entangle coherently (Monz et al. reached 14 trapped ions this way).

The design

A naive thought is to entangle qubit 00 with each of the others separately, but a cheaper, shallower construction chains the entanglement down a ladder:

∣GHZ4⟩=CX(2,3) CX(1,2) CX(0,1) H0 ∣0000⟩.|\mathrm{GHZ}_4\rangle = \texttt{CX}(2,3)\,\texttt{CX}(1,2)\,\texttt{CX}(0,1)\,H_0\,|0000\rangle.

The Hadamard seeds a superposition on qubit 00; each CNOT then copies the ∣1⟩|1\rangle branch one qubit further along, so the two global branches ∣0000⟩|0000\rangle and ∣1111⟩|1111\rangle grow together. The circuit has depth O(n)\mathcal{O}(n) and uses only n−1n - 1 two-qubit gates.

The verification

Full tomography of nn qubits costs exponentially many measurement settings — far too much for a quick check. Instead we use two cheap diagnostics, both implied by the GHZ structure:

  1. Populations. Measuring in the computational basis must give only 0n0^n and 1n1^n, each with probability 12\tfrac{1}{2}. Any weight in another bin signals a bit-flip error in the ladder.
  2. Coherence. The populations alone cannot distinguish the entangled GHZ from a classical mixture of ∣0000⟩|0000\rangle and ∣1111⟩|1111\rangle; the relative phase must be checked too (e.g. via parity oscillations in the XX basis). A genuine GHZ has both equal populations and a definite phase.

Here the grader checks the populations directly and confirms the amplitudes of ∣0000⟩|0000\rangle and ∣1111⟩|1111\rangle are real and equal to 1/21/\sqrt{2} — pinning down the coherent superposition, not a mixture.

Try it

Build the four-qubit GHZ ladder. The grader runs your self-verification: the populations of ∣0000⟩|0000\rangle and ∣1111⟩|1111\rangle each equal 12\tfrac{1}{2}, all other bins vanish, and the two surviving amplitudes are real and equal to 1/21/\sqrt{2}.

Run your code to see the quantum state.

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