|q⟩ Bad Qubits

advanced · Physics · Measurement-Based Quantum Computation

Simulating MBQC Gates

This lesson turns the elementary gadget into something you can run. We simulate the one-bit teleportation circuit on a qubit simulator and watch a single-qubit gate appear on the ancilla as a consequence of measuring the input — the smallest complete MBQC computation.

The gadget as a circuit

The measurement-based Hadamard is a three-line circuit on two qubits:

  1. Input ψ|\psi\rangle sits on qubit 00.
  2. Ancilla qubit 11 is prepared in +|+\rangle by a Hadamard on 0|0\rangle.
  3. Entangle the edge with a controlled-ZZ, CZ01CZ_{01} — this is precisely the two-qubit cluster state construction.
  4. Measure qubit 00 in the XX basis.

A state-vector simulator measures only in the computational basis, so we realise the XX-basis measurement the standard way: apply a Hadamard to qubit 00 and then read it in the computational basis, since HH maps the XX basis {+,}\{|+\rangle, |-\rangle\} onto {0,1}\{|0\rangle, |1\rangle\}.

Tracing the simulated state

Before any measurement, after the entangling step and the rotating Hadamard on qubit 00, the joint state is (from the gadget identity of the previous lessons, with the final H0H_0 applied):

12(00Hψ  +  10XHψ).\tfrac{1}{\sqrt2}\Big(|0\rangle_0 \otimes H|\psi\rangle \;+\; |1\rangle_0 \otimes XH|\psi\rangle\Big).

Reading qubit 00 now gives outcome ss, and qubit 11 collapses to XsHψX^{s} H|\psi\rangle — the Hadamard, up to the byproduct XsX^{s}.

Choosing a deterministic instance

To get a clean, outcome-independent check without post-selecting on a measurement, choose the input to be an eigenstate that the byproduct fixes. Take ψ=0|\psi\rangle = |0\rangle. Then

H0=+,X+=+,H|0\rangle = |+\rangle, \qquad X|+\rangle = |+\rangle,

so both branches leave qubit 11 in +|+\rangle. The two outcomes are physically identical on the ancilla; tracing out the (still-entangled) measured qubit, the reduced state of qubit 11 is the pure state +|+\rangle, with reduced Bloch vector

(x,y,z)=(1,0,0).(x, y, z) = (1, 0, 0).

That is the signature of a successful Hadamard: the teleported logical qubit has been mapped from 0|0\rangle to +|+\rangle.

Why this is the whole story in miniature

Nothing in this circuit ever applied a gate to qubit 11. The Hadamard on the logical information arose entirely from entangling and then measuring qubit 00. Replace the plain XX-basis measurement with a tilted one at angle ξ\xi and the same circuit realises HRz(ξ)H R_z(\xi) instead; chain several edges and the gadgets compose into an arbitrary single-qubit unitary; add a cross-edge between two such chains and you get an entangling gate. Everything in the one-way model is this gadget, repeated and stitched together.

Try it

Build the Hadamard gadget for input 0|0\rangle: prepare the ancilla qubit 11 in +|+\rangle, entangle the edge with CZ01CZ_{01}, and rotate qubit 00 into the XX-measurement basis with a Hadamard. The grader reads the reduced Bloch vector of qubit 11, which must be (1,0,0)(1, 0, 0) — the teleported state H0=+H|0\rangle = |+\rangle.

Run your code to see the quantum state.

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