Quantum Computation & Cryptography · Lecture 8

Lecture 8
No-Cloning, Teleportation and Superdense Coding

Week 4  |  what quantum information cannot do, and what entanglement lets it do anyway; Lab 2 launches  |  reading: Watrous §3.3 and Ch. 4

Cartoon: a photocopier that refuses a qubitA stick figure feeds a sheet marked with a ket into a photocopier. The copier's output tray holds a sheet marked with a question mark. A speech bubble from the copier says: paper, yes. Qubits, no. paper, yes.qubits, no. |ψ>?
an unknown quantum state cannot be copied, but with a Bell pair and two bits it can be moved
In this lecture
  1. No-cloning
  2. Teleportation
  3. Superdense coding
  4. The CHSH game
  5. Try it in code
  6. Lab 2 launch
  7. Summary and exercises

Lectures 5 to 7 built multi-qubit states, gates and circuits. This lecture uses them for the first genuinely quantum information-processing tasks. By the end you should be able to explain why an unknown quantum state cannot be copied, carry out teleportation and superdense coding step by step, write the teleportation circuit with mid-circuit measurement and classical feed-forward in Qiskit, and explain why the CHSH game can be won 85% of the time with entanglement but only 75% without it.

1 — No-cloning

Copying is the most basic operation on classical data. A CNOT copies a classical bit into a fresh \(|0\rangle\): on basis states, cx(0, 1) sends \(|b\rangle_0|0\rangle_1\) to \(|b\rangle_0|b\rangle_1\). Does the same gate copy qubits?

example 8.1 — CNOT copies bits but not qubits

Apply cx(0, 1) to \(|0\rangle_1\otimes|+\rangle_0\), qubit 0 carrying the "original" and qubit 1 the blank. Compare the result with the two copies \(|+\rangle|+\rangle\) we wanted.

By linearity the CNOT copies each basis term separately:

$$\mathrm{CX}_{0\to1}\,\frac{|00\rangle+|01\rangle}{\sqrt2}=\frac{|00\rangle+|11\rangle}{\sqrt2}=|\Phi^+\rangle ,$$

whereas

$$|+\rangle|+\rangle=\tfrac12\big(|00\rangle+|01\rangle+|10\rangle+|11\rangle\big).$$

These are different states. Measuring both qubits of \(|+\rangle|+\rangle\) gives all four outcomes with probability \(\tfrac14\); measuring \(|\Phi^+\rangle\) never gives \(01\) or \(10\). Their overlap is \(|\langle{+}{+}|\Phi^+\rangle|^2=\tfrac12\). The CNOT copied the basis label in each branch of the superposition, which entangled the two qubits instead of producing two independent copies.

Example 8.1 is not a failure of one particular gate. No gate at all can do better.

theorem 8.1 — no-cloning (Wootters–Zurek, Dieks, 1982)

Let \(U\) be a unitary on two qubits and \(|e\rangle\) a fixed "blank" state. If \(U\big(|\psi\rangle|e\rangle\big)=|\psi\rangle|\psi\rangle\) and \(U\big(|\varphi\rangle|e\rangle\big)=|\varphi\rangle|\varphi\rangle\) for two states \(|\psi\rangle,|\varphi\rangle\), then \(\langle\psi|\varphi\rangle\) is 0 or 1: the two states are orthogonal or identical. In particular, no unitary copies every single-qubit state. The same holds if the copier is allowed extra work qubits in any fixed starting state.

Proof. HW4 asks you to prove this in two ways: once using linearity, and once using inner products.

What the theorem allows is just as important. A known orthonormal basis can be copied (CNOT does it), so classical information, which is information about which basis state you have, copies freely. What cannot be copied is an unknown superposition. The best possible universal copier makes two imperfect copies, each with fidelity \(\tfrac56\) to the original (Bužek and Hillery, 1996). A consequence: from a single copy of an unknown state you cannot learn its amplitudes, since otherwise you could prepare as many copies as you liked.

For which pairs of states could a single unitary (with a fixed blank state) copy both members of the pair? Tick every one.

Theorem 8.1: a copier for both states needs \(\langle\psi|\varphi\rangle\) to be 0 (orthogonal) or the two states to be the same. Compute each inner product.
The first two pairs are orthogonal (\(0.6\cdot0.8-0.8\cdot0.6=0\) for the second), so each is some orthonormal basis, and a basis can be copied. The other two overlaps have size \(\tfrac1{\sqrt2}\).
crypto connection — why an eavesdropper cannot keep a copy

In BB84 (Lecture 20) Alice sends single qubits in states chosen from \(\{|0\rangle,|1\rangle\}\) or \(\{|+\rangle,|-\rangle\}\). An eavesdropper would like to copy each qubit, forward the original, and measure the copy later once the bases are announced. Theorem 8.1 forbids exactly this: \(|0\rangle\) and \(|+\rangle\) are neither orthogonal nor identical (\(\langle0|+\rangle=\tfrac{1}{\sqrt2}\)), so no device copies both. Any attempt to learn which state was sent must disturb some of the forwarded qubits, and that disturbance is what Alice and Bob detect. Classical key distribution has no such guarantee, because classical signals can always be copied.

2 — Teleportation

Alice holds a qubit in an unknown state \(|\psi\rangle=\alpha|0\rangle+\beta|1\rangle\) and wants Bob, far away, to have it. She cannot measure it and phone him the amplitudes (one measurement reveals one bit and destroys the rest), and she cannot copy it. If they share a Bell pair in advance, two classical bits are enough.

The teleportation circuitThree wires, q0 on top. q0 starts in |psi>, held by Alice. q1 (Alice) and q2 (Bob) start in |0>; an H on q1 and a CNOT from q1 to q2 make the Bell pair. Alice applies a CNOT from q0 to q1 and an H on q0, then measures q0 and q1, giving bits m0 and m1. Double lines carry m1 to an X gate and m0 to a Z gate on q2. Bob's qubit ends in |psi>. Dashed lines mark four stages.q0|psi>Aliceq1|0>Aliceq2|0>BobHHm0m1XZ|psi>1234startpair sharedrotatedmeasuredmake a Bell pairAliceBob corrects
Teleportation in Qiskit's drawing convention. Alice holds \(q_0\) (the state to send) and \(q_1\); Bob holds \(q_2\). The double lines are classical bits: \(m_1\) controls an \(X\) and \(m_0\) controls a \(Z\) on Bob's qubit.
definition 8.1 — the teleportation protocol
  1. Share. Prepare \(|\Phi^+\rangle\) on \(q_1,q_2\) (Lecture 6) and give \(q_1\) to Alice, \(q_2\) to Bob.
  2. Rotate. Alice applies cx(0, 1) and then \(H\) to \(q_0\).
  3. Measure and send. Alice measures \(q_0\) and \(q_1\), getting bits \(m_0,m_1\), and sends them to Bob over an ordinary channel.
  4. Correct. Bob applies \(X\) if \(m_1=1\) and then \(Z\) if \(m_0=1\). His qubit is now \(|\psi\rangle\).

Steps 2 and 3 together amount to measuring Alice's two qubits in the Bell basis, which is why the protocol is often described as "Alice makes a Bell measurement". The algebra below makes the whole protocol concrete. In this section we label each ket with its qubit and write the factors in the order \(q_0,q_1,q_2\) of the circuit diagram, which is easier to follow here than the right-to-left order.

Alice's outcomes are \(m_0=0\) and \(m_1=1\). By Definition 8.1, Bob applies to his qubit.

Step 4: \(X\) if \(m_1=1\), then \(Z\) if \(m_0=1\). Which bit controls which gate?
\(m_1=1\) calls for \(X\); \(m_0=0\) calls for no \(Z\). In the circuit diagram, \(m_1\) (from \(q_1\)) drives the \(X\) and \(m_0\) (from \(q_0\)) drives the \(Z\).
example 8.2 — teleporting a specific state, all four branches

Teleport \(|\psi\rangle=\tfrac15\big(3|0\rangle+4i|1\rangle\big)\). Find each of Alice's four measurement outcomes, its probability, and the state Bob holds before and after his correction.

Start. Alice's qubit times the shared pair:

$$\frac{1}{5\sqrt2}\big(3|0\rangle_0+4i|1\rangle_0\big)\big(|0\rangle_1|0\rangle_2+|1\rangle_1|1\rangle_2\big).$$

CNOT from \(q_0\) to \(q_1\). It flips \(q_1\) in the terms where \(q_0=1\):

$$\frac{1}{5\sqrt2}\Big(3|0\rangle_0\big(|00\rangle+|11\rangle\big)_{12}+4i|1\rangle_0\big(|10\rangle+|01\rangle\big)_{12}\Big).$$

\(H\) on \(q_0\). Replace \(|0\rangle_0\) by \(\tfrac{1}{\sqrt2}(|0\rangle+|1\rangle)_0\) and \(|1\rangle_0\) by \(\tfrac{1}{\sqrt2}(|0\rangle-|1\rangle)_0\):

$$\frac{1}{10}\Big(3\big(|0\rangle+|1\rangle\big)_0\big(|00\rangle+|11\rangle\big)_{12}+4i\big(|0\rangle-|1\rangle\big)_0\big(|10\rangle+|01\rangle\big)_{12}\Big).$$

Regroup by Alice's two qubits. Multiply out and collect the terms with each value of \(|m_0m_1\rangle_{01}\); Bob's qubit \(q_2\) is the last factor in each term:

$$\begin{aligned}\frac{1}{10}\Big(&|00\rangle_{01}\big(3|0\rangle+4i|1\rangle\big)_2+|01\rangle_{01}\big(4i|0\rangle+3|1\rangle\big)_2\\[2pt] +\;&|10\rangle_{01}\big(3|0\rangle-4i|1\rangle\big)_2+|11\rangle_{01}\big({-4i}|0\rangle+3|1\rangle\big)_2\Big).\end{aligned}$$

Each bracket has length 5, so each term has squared length \((5/10)^2=\tfrac14\). By the partial-measurement rule (Rule 6.2), each outcome \(m_0m_1\) occurs with probability \(\tfrac14\), and leaves Bob with the normalised bracket:

\(m_0\,m_1\)Bob holdswhich isBob applies
0 0\(\tfrac15(3|0\rangle+4i|1\rangle)\)\(|\psi\rangle\)nothing
0 1\(\tfrac15(4i|0\rangle+3|1\rangle)\)\(X|\psi\rangle\)\(X\)
1 0\(\tfrac15(3|0\rangle-4i|1\rangle)\)\(Z|\psi\rangle\)\(Z\)
1 1\(\tfrac15(-4i|0\rangle+3|1\rangle)\)\(XZ|\psi\rangle\)\(X\), then \(Z\)

In every row the correction undoes the Pauli, since \(X^2=Z^2=I\) and \(Z\,X\,(XZ)=I\). Bob ends with \(|\psi\rangle\) exactly, global phase included.

Nothing in Example 8.2 used the particular numbers 3 and \(4i\): the same regrouping works for any \(\alpha,\beta\), which is HW4's teleportation problem.

theorem 8.2 — teleportation works

For every \(|\psi\rangle\), Alice's outcomes \(m_0m_1\) are uniformly random, each with probability \(\tfrac14\), and before his correction Bob holds \(X^{m_1}Z^{m_0}|\psi\rangle\). After applying \(X^{m_1}\) and then \(Z^{m_0}\) he holds \(|\psi\rangle\).

Alice teleports \(|\psi\rangle=\tfrac1{\sqrt5}\big(|0\rangle+2|1\rangle\big)\) and gets \(m_0m_1=11\). Before receiving her bits, Bob measures his qubit in the standard basis. Given this branch, what is the probability that he sees 0?

By Theorem 8.2 Bob holds \(X^{m_1}Z^{m_0}|\psi\rangle=XZ|\psi\rangle\). Apply \(Z\) first, then \(X\).
\(Z|\psi\rangle=\tfrac1{\sqrt5}(|0\rangle-2|1\rangle)\) and \(X\) swaps the amplitudes, giving \(\tfrac1{\sqrt5}(-2|0\rangle+|1\rangle)\): \(P(0)=\tfrac45\). Bob does not know which branch he is in, though; averaged over all four he sees \(\tfrac12\).

Three remarks keep teleportation in proportion.

Immediately after a successful teleportation, which statement is true?

Teleportation moves a state; it neither copies it nor sends it faster than the two classical bits.
The original is destroyed by Alice's measurement, the bits are pure noise on their own, and the Bell pair is consumed. Only bits plus pair together rebuild \(|\psi\rangle\) at Bob's end.

Teleportation, step by step

Choose the state to teleport with the sliders (\(\theta\) and \(\varphi\) as on the Bloch sphere), then step through the protocol. The bars show all eight amplitudes, labelled \(|q_0q_1q_2\rangle\) in circuit order. At the measurement step pick Alice's outcome yourself or draw it at random; the panel then shows Bob's qubit before and after his correction, and its overlap with \(|\psi\rangle\).

3 — Superdense coding

Can one qubit carry more than one classical bit? On its own, no: measuring a qubit yields one bit, and a theorem of Holevo (1973) shows that no cleverer decoding can extract more. With a shared Bell pair, one transmitted qubit carries two bits.

Superdense codingTwo wires: q0 is Alice's half and q1 is Bob's half of a Bell pair made by H on q0 and a CNOT. Alice applies X if her bit b0 is 1, then Z if her bit b1 is 1, and sends q0 to Bob, shown by a dashed arrow. Bob performs a Bell measurement on both qubits and reads b1 b0.q0|0>q1|0>Hshared in advanceXif b0=1Zif b1=1Alice encodesq0 sent to BobBellmeasurementb1 b0one qubit sent + one shared Bell pair = two classical bits delivered
Superdense coding. The Bell pair is shared in advance. To send bits \(b_1b_0\), Alice applies \(X^{b_0}\) and then \(Z^{b_1}\) to her half and sends it; Bob measures both qubits in the Bell basis.
proposition 8.3 — superdense encoding

Start from \(|\Phi^+\rangle\) made by h(0), cx(0, 1), with Alice holding \(q_0\). Applying \(Z^{b_1}X^{b_0}\) to \(q_0\) produces

$$00\mapsto|\Phi^+\rangle,\qquad 01\mapsto|\Psi^+\rangle,\qquad 10\mapsto|\Phi^-\rangle,\qquad 11\mapsto-|\Psi^-\rangle .$$

Write \(|\Phi^+\rangle=\tfrac{1}{\sqrt2}(|00\rangle+|11\rangle)\) with kets \(|q_1q_0\rangle\), so Alice's gates act on the right-hand digit. \(X\) on \(q_0\) flips that digit: \(\tfrac{1}{\sqrt2}(|01\rangle+|10\rangle)=|\Psi^+\rangle\). \(Z\) on \(q_0\) negates the terms where it is 1: from \(|\Phi^+\rangle\) it gives \(\tfrac{1}{\sqrt2}(|00\rangle-|11\rangle)=|\Phi^-\rangle\), and from \(|\Psi^+\rangle\) it gives \(\tfrac{1}{\sqrt2}(-|01\rangle+|10\rangle)=-|\Psi^-\rangle\).

The four Bell states form an orthonormal basis (Lecture 6), so a measurement in the Bell basis tells them apart with certainty, and Bob reads off both bits. HW4 asks you to give the decoding circuit. The two protocols are mirror images:

protocolusessendsdelivers
teleportation1 Bell pair2 classical bits1 qubit
superdense coding1 Bell pair1 qubit2 classical bits

In both, the shared entanglement is used up. Neither creates communication out of nothing: superdense coding still sends a physical qubit, and teleportation still needs the two bits.

Alice uses superdense coding to send Bob a 256-bit key. How many qubits does she physically send, and how many shared Bell pairs are used up?

Each round sends one qubit, carries two classical bits, and consumes one Bell pair.
\(256/2=128\) qubits, using 128 Bell pairs. The saving is only in what crosses the channel at the time; the other halves of the pairs had to reach Bob earlier.

4 — The CHSH game

Lecture 6 left a promise: Bell pairs do something no pre-arranged classical scheme can, but only when the two sides measure along different directions. The cleanest way to see it is as a game.

definition 8.2 — the CHSH game

A referee picks two independent uniformly random bits \(x\) and \(y\), sends \(x\) to Alice and \(y\) to Bob, and they reply with bits \(a\) and \(b\). They may agree on a strategy beforehand but cannot communicate once the game starts. They win if

$$a\oplus b=x\wedge y ,$$

that is, their answers must agree unless \(x=y=1\), in which case they must disagree.

The referee sends \(x=1\) to Alice and \(y=0\) to Bob, and Alice answers \(a=1\). To win, Bob must answer .

Compute \(x\wedge y\) first; then pick \(b\) with \(a\oplus b=x\wedge y\).
\(x\wedge y=1\wedge0=0\), so the answers must agree: \(b=1\). Only the question pair \(x=y=1\) asks for disagreement.
theorem 8.4 — the classical limit is 3/4

Every classical strategy, deterministic or randomised, wins with probability at most \(\tfrac34\), and \(\tfrac34\) is achieved by always answering \(a=b=0\).

Deterministic strategies. Alice's strategy is a pair of answers \(a_0,a_1\) (for \(x=0,1\)), and Bob's is \(b_0,b_1\). Winning all four questions would need

$$a_0\oplus b_0=0,\qquad a_0\oplus b_1=0,\qquad a_1\oplus b_0=0,\qquad a_1\oplus b_1=1 .$$

Adding all four equations mod 2, each of \(a_0,a_1,b_0,b_1\) appears twice, so the left side is 0, while the right side is 1. So at most three of the four question pairs are won, and the win probability is at most \(\tfrac34\). Enumerating all 16 deterministic strategies confirms that 8 of them win exactly \(\tfrac34\) and the other 8 win \(\tfrac14\).

Randomised strategies. A randomised strategy is a random choice of a deterministic one (shared randomness included). Its win probability is an average of the win probabilities of deterministic strategies, each at most \(\tfrac34\), so it is at most \(\tfrac34\) too.

Alice always answers \(a=1\) and Bob always answers \(b=0\), whatever the questions. What is their win probability?

Here \(a\oplus b=1\) on every round. For which of the four equally likely question pairs is \(x\wedge y=1\)?
They always disagree, which wins only when \(x=y=1\): probability \(\tfrac14\). This is one of the 8 deterministic strategies that win \(\tfrac14\).

Now give Alice and Bob a Bell pair \(|\Phi^+\rangle\). Each measures along a direction in the x–z plane of the Bloch sphere, chosen by their input. Measuring along the direction at angle \(a\) from the \(z\)-axis means rotating by \(R_y(-a)\) and then measuring in the standard basis; Lecture 6 showed that for \(|\Phi^+\rangle\) the two outcomes then agree with probability \(\cos^2\!\big(\tfrac{a-b}{2}\big)\).

On the question \(x=y=1\), Alice measures at angle \(\pi/2\) and Bob at \(-\pi/6\) (sharing \(|\Phi^+\rangle\)). What is the probability that they win this round?

For \(x=y=1\) they win by disagreeing, so the answer is \(1-\cos^2\!\big(\tfrac{a-b}{2}\big)=\sin^2\!\big(\tfrac{a-b}{2}\big)\).
\(a-b=2\pi/3\), so \(P(\text{win})=\sin^2(\pi/3)=\tfrac34\). Directions far apart make disagreement likely, which is what this question rewards.
Measurement directions for the optimal CHSH strategyA circle in the x-z plane of the Bloch sphere, z pointing up and x to the right. Alice's two directions are a0 = 0 (straight up, the z axis) and a1 = pi/2 (the x axis). Bob's are b0 = pi/4 and b1 = -pi/4, on either side of the z axis. Three of the four Alice-Bob pairs are pi/4 apart; the pair a1, b1 is 3 pi/4 apart. A table lists the agreement probability cos^2 of half the angle difference.xza0 = 0a1 = pi/2b0 = pi/4b1 = -pi/4angles from z, in the x-z planex yAliceBobwantP(want)0 0a0b0agree0.8540 1a0b1agree0.8541 0a1b0agree0.8541 1a1b1disagree0.854P(agree) = cos^2((a - b)/2)win rate = cos^2(pi/8) = 0.854best classical strategy: 0.750
The optimal quantum strategy. Alice measures at \(0\) or \(\pi/2\); Bob at \(\pi/4\) or \(-\pi/4\). Three question pairs put the two directions \(\pi/4\) apart, where agreement is likely; the pair \(x=y=1\) puts them \(3\pi/4\) apart, where disagreement is likely. Every question is won with probability \(\cos^2(\pi/8)\approx0.854\).
theorem 8.5 — the quantum strategy wins with probability cos²(π/8)

With the angles in the figure, the CHSH game is won with probability \(\cos^2(\pi/8)=\tfrac{2+\sqrt2}{4}\approx0.854\) for every question pair, hence overall.

For \((x,y)=(0,0),(0,1),(1,0)\) the angle differences are \(-\pi/4\), \(\pi/4\), \(\pi/4\), so the answers agree, which is what wins, with probability \(\cos^2(\pi/8)\). For \((1,1)\) the difference is \(\pi/2-(-\pi/4)=3\pi/4\); they must disagree, which happens with probability \(1-\cos^2(3\pi/8)=\sin^2(3\pi/8)=\cos^2(\pi/8)\). Finally, \(\cos^2(\pi/8)=\tfrac12(1+\cos\tfrac\pi4)=\tfrac{2+\sqrt2}{4}\).

Physicists usually state the same fact with correlators. Write the answers as \(\pm1\) instead of bits, and let \(E(x,y)=P(\text{agree})-P(\text{disagree})\) for questions \(x,y\). For the strategy above \(E=\cos(a-b)\). The CHSH quantity is

$$S=E(0,0)+E(0,1)+E(1,0)-E(1,1),$$

and the win probability is exactly \(\tfrac12+\tfrac S8\). The classical bound \(\tfrac34\) becomes \(|S|\le2\); the quantum strategy reaches \(S=4\cos\tfrac\pi4=2\sqrt2\approx2.828\). Tsirelson proved in 1980 that no quantum strategy does better: \(2\sqrt2\) is the quantum maximum, just as 2 is the classical one. Lab 2 measures \(S\) on real hardware.

An experiment estimates \(S=2.4\). What CHSH win probability does that correspond to?

Use \(P(\text{win})=\tfrac12+\tfrac S8\). Check: \(S=2\) should give \(\tfrac34\).
\(\tfrac12+\tfrac{2.4}{8}=0.8\): above the classical \(0.75\), below the quantum maximum \(\approx0.854\).
idea — what this does and does not show

The game rules out every model in which the answers are fixed in advance, possibly at random, by information the two sides share ("local hidden variables"). It does not let Alice send Bob a message: each of their answers on its own is a fair coin whatever the other's question was. Experiments with the loopholes closed (2015, Delft, Vienna and Boulder) observed \(S>2\); the 2022 Nobel Prize in Physics recognised the experimental work that led to them. For cryptography the point is that a value of \(S\) near \(2\sqrt2\) certifies entanglement using only the observed statistics, which is the engine of the E91 protocol (Lecture 20).

Play the CHSH game

Pick a strategy and play rounds. Classical strategies are the 16 deterministic ones, given as Alice's answers \((a_0,a_1)\) and Bob's \((b_0,b_1)\); the quantum strategy uses \(|\Phi^+\rangle\) and the four angles below. The bars show the win rate for each question pair; the dashed lines mark \(\tfrac34\) and \(\cos^2(\pi/8)\).

5 — Try it in code

tool — teleportation as a dynamic circuit (qiskit 2.5, qiskit-aer 0.17)
import numpy as np
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
from qiskit_aer import AerSimulator

theta = 2 * np.arccos(3 / 5)                  # R_y(theta)|0> = (3|0> + 4|1>)/5
q = QuantumRegister(3, "q")                   # q0 = |psi>, q1 = Alice's half, q2 = Bob's half
m = ClassicalRegister(2, "m")                 # Alice's two bits
check = ClassicalRegister(1, "check")         # Bob's final test
qc = QuantumCircuit(q, m, check)

qc.ry(theta, 0); qc.s(0)                      # |psi> = (3|0> + 4i|1>)/5 on q0
qc.h(1); qc.cx(1, 2)                          # Bell pair on q1, q2
qc.barrier()
qc.cx(0, 1); qc.h(0)                          # Alice's Bell-basis rotation
qc.measure(0, m[0]); qc.measure(1, m[1])      # mid-circuit measurements
with qc.if_test((m[1], 1)):                   # feed-forward: Bob corrects
    qc.x(2)
with qc.if_test((m[0], 1)):
    qc.z(2)
qc.barrier()
qc.sdg(2); qc.ry(-theta, 2)                   # undo the preparation on Bob's qubit
qc.measure(2, check[0])                       # reads 0 every time iff Bob holds |psi>

counts = AerSimulator(seed_simulator=3).run(qc, shots=4000).result().get_counts()
print(dict(sorted(counts.items())))           # keys are "check m1m0"
{'0 00': 975, '0 01': 1000, '0 10': 1020, '0 11': 1005}

The check bit is 0 in all 4000 shots, so Bob held exactly \(|\psi\rangle\), while Alice's two bits are spread evenly over the four values, as Theorem 8.2 says. Measuring Bob's qubit directly would only test \(|\alpha|^2\) and would miss a forgotten \(Z\) correction; undoing the preparation first tests the phase too. if_test makes a dynamic circuit: later gates depend on earlier measurement results. The basic StatevectorSampler does not run these, so we use the Aer simulator (pip install qiskit-aer); IBM hardware runs them natively.

tool — deferred measurement: the same protocol without classical bits
import numpy as np
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector, partial_trace, state_fidelity

psi = Statevector([3 / 5, 4j / 5])            # the state to teleport, on q0
qc = QuantumCircuit(3)
qc.h(1); qc.cx(1, 2)                          # Bell pair on q1, q2
qc.cx(0, 1); qc.h(0)                          # Alice's rotation
qc.cx(1, 2); qc.cz(0, 2)                      # corrections controlled by qubits instead of bits

start = Statevector.from_label("00").tensor(psi)   # |q2 q1> = |00>, q0 = |psi>
bob = partial_trace(start.evolve(qc), [0, 1])      # Bob's qubit on its own (Lecture 18)
print("fidelity of Bob's qubit with |psi>:", round(state_fidelity(bob, psi), 10))
fidelity of Bob's qubit with |psi>: 1.0

A measurement followed by a classically controlled gate can always be replaced by the corresponding quantum-controlled gate, with the measurement moved to the end (the principle of deferred measurement). That turns the protocol into a plain unitary circuit that Statevector can simulate. partial_trace extracts Bob's qubit as a density matrix, a preview of Lecture 18.

tool — superdense encoding and the CHSH value
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector

for bits in ["00", "01", "10", "11"]:          # the two bits b1 b0 Alice wants to send
    qc = QuantumCircuit(2)                      # q0 = Alice's half, q1 = Bob's half
    qc.h(0); qc.cx(0, 1)                        # shared |Phi+>
    if bits[1] == "1": qc.x(0)                  # b0 -> X on Alice's qubit
    if bits[0] == "1": qc.z(0)                  # b1 -> Z on Alice's qubit
    print(bits, Statevector.from_instruction(qc).data.real.round(3) + 0.0)
00 [0.707 0.    0.    0.707]
01 [0.    0.707 0.707 0.   ]
10 [ 0.707  0.     0.    -0.707]
11 [ 0.    -0.707  0.707  0.   ]
import numpy as np
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector

def E(a, b):
    """correlator <A B> for |Phi+> measured along Bloch angles a (Alice, q1) and b (Bob, q0)"""
    qc = QuantumCircuit(2)
    qc.h(0); qc.cx(0, 1)                          # |Phi+>
    qc.ry(-a, 1); qc.ry(-b, 0)                    # rotate each measurement axis onto z
    p = Statevector.from_instruction(qc).probabilities_dict()
    return p.get("00", 0) + p.get("11", 0) - p.get("01", 0) - p.get("10", 0)

a0, a1, b0, b1 = 0, np.pi / 2, np.pi / 4, -np.pi / 4
S = E(a0, b0) + E(a0, b1) + E(a1, b0) - E(a1, b1)
print("S =", round(S, 4), "  2*sqrt(2) =", round(2 * np.sqrt(2), 4), "  win rate =", round(0.5 + S / 8, 4))
S = 2.8284   2*sqrt(2) = 2.8284   win rate = 0.8536

The four encoded states are \(|\Phi^+\rangle,|\Psi^+\rangle,|\Phi^-\rangle,-|\Psi^-\rangle\) (amplitudes in the order 00, 01, 10, 11), as in Proposition 8.3. The + 0.0 turns any printed -0. into 0..

6 — Lab 2 launch: entanglement you can measure

lab 2 — Bell states, CHSH and teleportation (due in 10 days)

Goal. Verify entanglement experimentally, and use mid-circuit measurement.

  1. Bell states. Prepare all four and check them by measuring both qubits in the Z basis and in the X basis. Compare the agreement rates with the table in Lecture 6.
  2. CHSH. Estimate the four correlators \(E(x,y)\) at the angles of Theorem 8.5 from sampled counts, and compute \(S\) with a standard error. Each \(\hat E\) is \(2\hat p-1\) for an agreement frequency \(\hat p\), so \(\mathrm{Var}(\hat E)=4p(1-p)/N\), and the four estimates are independent, so their variances add.
  3. Miscalibration. Add an \(R_y(\varepsilon)\) "tilt" to Bob's qubit before measurement, as if his measurement axis were misaligned, and plot \(S\) against \(\varepsilon\). For which \(\varepsilon\) does the violation disappear? (Genuine noise is Lecture 19's topic.)
  4. Teleportation. Build the dynamic circuit of Section 5 and teleport \(R_y(\theta)|0\rangle\) for three values of \(\theta\). Check the result on the simulator by undoing the preparation, as in the code above.
  5. Hardware. Run the CHSH experiment on an IBM backend. Do you violate \(S\le2\), and by how many standard errors?

Hardware budget: at most 30 seconds of machine time. Batch the four CHSH circuits into one job, and debug on the simulator first.

7 — Summary and exercises

summary

Next time: Block II begins with the query model and the first algorithms that beat classical ones: Deutsch–Jozsa and Bernstein–Vazirani. HW4 is due at the start of Week 5; Lab 2 in ten days.

exercises 8
  1. A would-be cloner \(U\) satisfies \(U|0\rangle|0\rangle=|0\rangle|0\rangle\) and \(U|1\rangle|0\rangle=|1\rangle|1\rangle\). Compute \(U\big(|{+i}\rangle|0\rangle\big)\) and its overlap \(|\langle{+i},{+i}|\cdot\rangle|^2\) with two true copies.
  2. Can a unitary copy both \(|0\rangle\) and \(|1\rangle\)? Both \(|+\rangle\) and \(|-\rangle\)? Both \(|0\rangle\) and \(|+\rangle\)? Justify each answer with Theorem 8.1, and give a circuit where one exists.
  3. In Example 8.2, suppose Bob mistakenly applies \(Z\) before \(X\) in the \(m_0m_1=11\) branch. What state does he end with, and is it physically different from \(|\psi\rangle\)?
  4. Show that \(\tfrac12\) is the probability that Bob measures 0 before receiving Alice's bits, for every \(|\psi\rangle=\alpha|0\rangle+\beta|1\rangle\), not just the one in Example 8.2.
  5. Which deterministic CHSH strategies win with probability \(\tfrac34\)? Find all those with \(a_0=0\) and \(b_0=0\).
  6. For the quantum CHSH strategy, Alice keeps \(a_0=0,a_1=\pi/2\) and Bob uses \(b_0=\beta,b_1=-\beta\). Find the win probability as a function of \(\beta\) and show it is largest at \(\beta=\pi/4\).
  1. By linearity, \(U\big(\tfrac{1}{\sqrt2}(|0\rangle+i|1\rangle)|0\rangle\big)=\tfrac{1}{\sqrt2}\big(|00\rangle+i|11\rangle\big)\). Two copies would be \(|{+i}\rangle|{+i}\rangle=\tfrac12\big(|00\rangle+i|01\rangle+i|10\rangle-|11\rangle\big)\). The inner product is \(\tfrac{1}{2\sqrt2}\big(1+\overline{(-1)}\cdot i\big)=\tfrac{1-i}{2\sqrt2}\), whose squared modulus is \(\tfrac14\).
  2. \(|0\rangle,|1\rangle\): orthogonal, so allowed; cx(0, 1) does it. \(|+\rangle,|-\rangle\): orthogonal, so allowed; apply \(H\) to qubit 0 (turning \(|\pm\rangle\) into \(|0\rangle,|1\rangle\)), then cx(0, 1), then \(H\) to both qubits, which turns \(|00\rangle,|11\rangle\) into \(|{+}{+}\rangle,|{-}{-}\rangle\). \(|0\rangle,|+\rangle\): \(\langle0|+\rangle=\tfrac{1}{\sqrt2}\) is neither 0 nor 1, so no unitary copies both.
  3. He holds \(XZ|\psi\rangle\) and applies \(Z\) then \(X\), giving \(XZXZ|\psi\rangle\). Since \(ZX=-XZ\), \(XZXZ=-XXZZ=-I\), so he ends with \(-|\psi\rangle\). That differs from \(|\psi\rangle\) by a global phase only, so it is the same physical state; the order of the two corrections does not matter.
  4. Bob holds \(X^{m_1}Z^{m_0}|\psi\rangle\) with probability \(\tfrac14\) each. \(|\psi\rangle\) and \(Z|\psi\rangle\) give 0 with probability \(|\alpha|^2\); \(X|\psi\rangle\) and \(XZ|\psi\rangle\) give 0 with probability \(|\beta|^2\). The average is \(\tfrac14(2|\alpha|^2+2|\beta|^2)=\tfrac12\).
  5. A deterministic strategy wins \(\tfrac34\) exactly when it loses exactly one of the four question pairs. With \(a_0=b_0=0\), the pair \((0,0)\) is won. The remaining conditions are \(b_1=0\) (for \((0,1)\)), \(a_1=0\) (for \((1,0)\)) and \(a_1\ne b_1\) (for \((1,1)\)); exactly one may fail. \((a_1,b_1)=(0,0)\) fails only \((1,1)\); \((1,0)\) fails only \((1,0)\); \((0,1)\) fails only \((0,1)\); \((1,1)\) fails \((1,0)\), \((0,1)\) and \((1,1)\). So the three strategies \((a_0a_1,b_0b_1)=(00,00),(01,00),(00,01)\) win \(\tfrac34\).
  6. The angle differences are \(-\beta\), \(\beta\), \(\tfrac\pi2-\beta\) and \(\tfrac\pi2+\beta\). The win probability is $$\begin{aligned}&\tfrac14\Big(2\cos^2\tfrac\beta2+\cos^2\big(\tfrac\pi4-\tfrac\beta2\big)+\sin^2\big(\tfrac\pi4+\tfrac\beta2\big)\Big)\\[4pt] &\quad=\tfrac12+\tfrac14\big(\cos\beta+\sin\beta\big),\end{aligned}$$ using \(\cos^2u=\tfrac12(1+\cos2u)\) and \(\sin^2u=\tfrac12(1-\cos2u)\). Since \(\cos\beta+\sin\beta=\sqrt2\sin(\beta+\tfrac\pi4)\), the maximum is at \(\beta=\pi/4\), where the win probability is \(\tfrac12+\tfrac{\sqrt2}{4}=\cos^2(\pi/8)\).

Reading and sources

all numbers and figures in these notes are computed in python (verify_L08.py) and follow the page theme