In part 3 of this series, we talked briefly about an important term in quantum computing called entanglement, which we said could be gotten when a CNOT gate acts on superposed qubits. We will expand on this in this article and, as usual, buttress our explanation with worked examples. Most of them come from (Rieffel, E. G. & Polak, W. H., 2014), and we will check every answer with cirq code.

As with all articles in this series, a working knowledge of high/secondary school math is needed to understand quantum mechanics. Also, if you want to understand the checks we write using cirq and/or qiskit, Python programming or related language's knowledge is needed. The tensor product and the CNOT gate, both treated in part 3 , will be used heavily here.

In 1935, Albert Einstein, Boris Podolsky and Nathan Rosen published a paper asking whether quantum mechanics gives a complete description of reality (Einstein, A. et al., 1935). Their argument, now called the EPR paradox, rested on pairs of particles whose properties are tied together so tightly that measuring one seems to settle the other at once, however far apart they are. To them, this suggested that something was missing from the theory. Einstein later called the effect "spooky action at a distance" in a letter to Max Born (Born, M. (Ed.)., 1971).

The same year, Erwin Schrödinger gave the phenomenon its name, Verschränkung in German and entanglement in English. He went further than Einstein and described it as "the characteristic trait of quantum mechanics" (Schrödinger, E., 1935). Almost thirty years later, John Bell showed that the question could be settled by experiment (Bell, J. S., 1964). The experiments came, and in 2022 Alain Aspect, John Clauser and Anton Zeilinger received the Nobel Prize in Physics for experiments with entangled photons that confirmed the predictions of quantum mechanics (The Royal Swedish Academy of Sciences., 2022).

That is the story. Now, we will see what entanglement actually is, using the math we already have.

Suppose we have two qubits, each prepared on its own:

∣u⟩=α0∣0⟩+α1∣1⟩,∣v⟩=β0∣0⟩+β1∣1⟩\ket{u}=\alpha_0\ket{0}+\alpha_1\ket{1},\qquad \ket{v}=\beta_0\ket{0}+\beta_1\ket{1}

Recall from part 3 that the state of both qubits together is their tensor product, ∣u⟩⊗∣v⟩\ket{u}\otimes\ket{v}. To expand it, we multiply every term in the first bracket by every term in the second, exactly as we would expand (p+q)(r+s)=pr+ps+qr+qs(p+q)(r+s)=pr+ps+qr+qs in school algebra:

∣u⟩⊗∣v⟩=(α0∣0⟩+α1∣1⟩)⊗(β0∣0⟩+β1∣1⟩)=α0∣0⟩⊗β0∣0⟩+α0∣0⟩⊗β1∣1⟩+α1∣1⟩⊗β0∣0⟩+α1∣1⟩⊗β1∣1⟩\begin{align*} \ket{u}\otimes\ket{v} &=(\alpha_0\ket{0}+\alpha_1\ket{1})\otimes(\beta_0\ket{0}+\beta_1\ket{1})\\ &=\alpha_0\ket{0}\otimes\beta_0\ket{0}+\alpha_0\ket{0}\otimes\beta_1\ket{1}+\alpha_1\ket{1}\otimes\beta_0\ket{0}+\alpha_1\ket{1}\otimes\beta_1\ket{1} \end{align*}

Two more rules tidy this up. Plain numbers can be moved to the front of a tensor product, and ∣x⟩⊗∣y⟩\ket{x}\otimes\ket{y} is written in short as ∣xy⟩\ket{xy}. So, α0∣0⟩⊗β0∣0⟩=α0β0∣00⟩\alpha_0\ket{0}\otimes\beta_0\ket{0}=\alpha_0\beta_0\ket{00}, and the same for the other three terms:

∣u⟩⊗∣v⟩=α0β0∣00⟩+α0β1∣01⟩+α1β0∣10⟩+α1β1∣11⟩\ket{u}\otimes\ket{v} =\alpha_0\beta_0\ket{00}+\alpha_0\beta_1\ket{01}+\alpha_1\beta_0\ket{10}+\alpha_1\beta_1\ket{11}

Keep this expansion in mind; everything in the next section comes from it. A state of this kind is called a product state (or separable state). Each qubit has a state of its own, and whatever we do to one leaves the other untouched. If we measure the first qubit, the result tells us nothing about the second.

A general two-qubit state has four amplitudes, one for each basis state:

∣ψ⟩=a∣00⟩+b∣01⟩+c∣10⟩+d∣11⟩\ket{\psi}=a\ket{00}+b\ket{01}+c\ket{10}+d\ket{11}

Here, aa, bb, cc and dd are numbers (amplitudes), not states. The question is: can every such state be written as ∣u⟩⊗∣v⟩\ket{u}\otimes\ket{v} for some single-qubit states ∣u⟩\ket{u} and ∣v⟩\ket{v}? No, and that is the whole point of this article. A state that cannot be written as a product of single-qubit states is called entangled (Nielsen, M. A. & Chuang, I. L., 2010).

To decide which states are products, we compare the general state with the expansion of ∣u⟩⊗∣v⟩\ket{u}\otimes\ket{v} from the previous section, one basis state at a time. Two states are equal only when the amplitude of every basis state matches:

Basis state Amplitude in ∣ψ⟩\ket{\psi} Amplitude in ∣u⟩⊗∣v⟩\ket{u}\otimes\ket{v}
∣00⟩\ket{00} aa α0β0\alpha_0\beta_0
∣01⟩\ket{01} bb α0β1\alpha_0\beta_1
∣10⟩\ket{10} cc α1β0\alpha_1\beta_0
∣11⟩\ket{11} dd α1β1\alpha_1\beta_1

So, if ∣ψ⟩\ket{\psi} is a product state, then:

a=α0β0,b=α0β1,c=α1β0,d=α1β1a=\alpha_0\beta_0,\qquad b=\alpha_0\beta_1,\qquad c=\alpha_1\beta_0,\qquad d=\alpha_1\beta_1

Now, multiply the first amplitude by the last, and the two middle ones together:

ad=(α0β0)(α1β1)=α0α1β0β1bc=(α0β1)(α1β0)=α0α1β0β1\begin{align*} ad&=(\alpha_0\beta_0)(\alpha_1\beta_1)=\alpha_0\alpha_1\beta_0\beta_1\\ bc&=(\alpha_0\beta_1)(\alpha_1\beta_0)=\alpha_0\alpha_1\beta_0\beta_1 \end{align*}

The order in which numbers are multiplied does not matter, so both lines end in the same product of the same four numbers! Therefore, every product state satisfies:

ad−bc=0ad-bc=0

The reverse is also true: if ad−bc=0ad-bc=0, the state can be split into two single-qubit states. Let us prove it, because the proof shows how to find the two states. Suppose ad=bcad=bc.

If a≠0a\neq0, we may divide by aa, which gives d=bcad=\frac{bc}{a}. Now, try the product (∣0⟩+ca∣1⟩)⊗(a∣0⟩+b∣1⟩)\left(\ket{0}+\frac{c}{a}\ket{1}\right)\otimes\left(a\ket{0}+b\ket{1}\right) and expand it with the same rule as before:

(∣0⟩+ca∣1⟩)⊗(a∣0⟩+b∣1⟩)=a∣00⟩+b∣01⟩+ca⋅a∣10⟩+ca⋅b∣11⟩=a∣00⟩+b∣01⟩+c∣10⟩+bca∣11⟩=a∣00⟩+b∣01⟩+c∣10⟩+d∣11⟩\begin{align*} \left(\ket{0}+\frac{c}{a}\ket{1}\right)\otimes\left(a\ket{0}+b\ket{1}\right) &=a\ket{00}+b\ket{01}+\frac{c}{a}\cdot a\ket{10}+\frac{c}{a}\cdot b\ket{11}\\ &=a\ket{00}+b\ket{01}+c\ket{10}+\frac{bc}{a}\ket{11}\\ &=a\ket{00}+b\ket{01}+c\ket{10}+d\ket{11} \end{align*}

That is exactly ∣ψ⟩\ket{\psi}, written as a product. The two factors are not normalized, but this does not matter: multiplying the first factor by any number kk and dividing the second by the same kk leaves the product unchanged, so kk can always be chosen to give both factors length 11.

If a=0a=0, then ad−bc=0ad-bc=0 becomes −bc=0-bc=0, so b=0b=0 or c=0c=0. When b=0b=0, the state is c∣10⟩+d∣11⟩=∣1⟩⊗(c∣0⟩+d∣1⟩)c\ket{10}+d\ket{11}=\ket{1}\otimes(c\ket{0}+d\ket{1}). Otherwise c=0c=0, and the state is b∣01⟩+d∣11⟩=(b∣0⟩+d∣1⟩)⊗∣1⟩b\ket{01}+d\ket{11}=(b\ket{0}+d\ket{1})\otimes\ket{1}. Both are products.

In every case, ad−bc=0ad-bc=0 gives a product state. Together with the first half, this gives us a simple test for two qubits:

A two-qubit state a∣00⟩+b∣01⟩+c∣10⟩+d∣11⟩a\ket{00}+b\ket{01}+c\ket{10}+d\ket{11} is entangled if and only if ad−bc≠0ad-bc\neq0.

If you have done some linear algebra, you may recognize ad−bcad-bc as the determinant of the matrix [abcd]\begin{bmatrix}a&b\\c&d\end{bmatrix}. Let us try the test on two states, step by step.

First, ∣+⟩∣+⟩\ket{+}\ket{+}, where both qubits are in an equal superposition. Recall that:

∣+⟩=12∣0⟩+12∣1⟩\ket{+}=\frac{1}{\sqrt{2}}\ket{0}+\frac{1}{\sqrt{2}}\ket{1}

So, both qubits have α0=α1=β0=β1=12\alpha_0=\alpha_1=\beta_0=\beta_1=\frac{1}{\sqrt{2}}. Using the expansion of ∣u⟩⊗∣v⟩\ket{u}\otimes\ket{v}, each amplitude of the pair is a product of two of these numbers, and 12⋅12=1(2)2=12\frac{1}{\sqrt{2}}\cdot\frac{1}{\sqrt{2}}=\frac{1}{(\sqrt{2})^2}=\frac{1}{2}:

∣+⟩∣+⟩=12⋅12∣00⟩+12⋅12∣01⟩+12⋅12∣10⟩+12⋅12∣11⟩=12∣00⟩+12∣01⟩+12∣10⟩+12∣11⟩\begin{align*} \ket{+}\ket{+} &=\frac{1}{\sqrt{2}}\cdot\frac{1}{\sqrt{2}}\ket{00}+\frac{1}{\sqrt{2}}\cdot\frac{1}{\sqrt{2}}\ket{01}+\frac{1}{\sqrt{2}}\cdot\frac{1}{\sqrt{2}}\ket{10}+\frac{1}{\sqrt{2}}\cdot\frac{1}{\sqrt{2}}\ket{11}\\ &=\frac{1}{2}\ket{00}+\frac{1}{2}\ket{01}+\frac{1}{2}\ket{10}+\frac{1}{2}\ket{11} \end{align*}

Matching this with a∣00⟩+b∣01⟩+c∣10⟩+d∣11⟩a\ket{00}+b\ket{01}+c\ket{10}+d\ket{11}, the amplitudes are the numbers in front of each basis state:

a=12 (of ∣00⟩),b=12 (of ∣01⟩),c=12 (of ∣10⟩),d=12 (of ∣11⟩)a=\frac{1}{2}\ (\text{of }\ket{00}),\qquad b=\frac{1}{2}\ (\text{of }\ket{01}),\qquad c=\frac{1}{2}\ (\text{of }\ket{10}),\qquad d=\frac{1}{2}\ (\text{of }\ket{11})

Substituting them into the test:

ad−bc=12⋅12−12⋅12=14−14=0ad-bc=\frac{1}{2}\cdot\frac{1}{2}-\frac{1}{2}\cdot\frac{1}{2}=\frac{1}{4}-\frac{1}{4}=0

Not entangled, as expected, since we built it as a product.

Next, the state we obtained at the end of part 3 :

∣Φ+⟩=∣00⟩+∣11⟩2=12∣00⟩+12∣11⟩\ket{\Phi^+}=\frac{\ket{00}+\ket{11}}{\sqrt{2}}=\frac{1}{\sqrt{2}}\ket{00}+\frac{1}{\sqrt{2}}\ket{11}

The basis states ∣01⟩\ket{01} and ∣10⟩\ket{10} do not appear at all. A basis state that does not appear has an amplitude of 00, so, writing all four terms out:

∣Φ+⟩=12∣00⟩+0∣01⟩+0∣10⟩+12∣11⟩\ket{\Phi^+}=\frac{1}{\sqrt{2}}\ket{00}+0\ket{01}+0\ket{10}+\frac{1}{\sqrt{2}}\ket{11}

Reading off the amplitudes as before:

a=12,b=0,c=0,d=12a=\frac{1}{\sqrt{2}},\qquad b=0,\qquad c=0,\qquad d=\frac{1}{\sqrt{2}}

Substituting them into the test:

ad−bc=12⋅12−0⋅0=12−0=12≠0ad-bc=\frac{1}{\sqrt{2}}\cdot\frac{1}{\sqrt{2}}-0\cdot0=\frac{1}{2}-0=\frac{1}{2}\neq0

Entangled! Since every product state gives 00, no choice of ∣u⟩\ket{u} and ∣v⟩\ket{v} can ever produce ∣Φ+⟩\ket{\Phi^+}.

We can also see this directly from the table above, without the test. For ∣Φ+⟩\ket{\Phi^+} to be ∣u⟩⊗∣v⟩\ket{u}\otimes\ket{v}, we would need α0β0=12\alpha_0\beta_0=\frac{1}{\sqrt{2}} and α1β1=12\alpha_1\beta_1=\frac{1}{\sqrt{2}}, so none of α0\alpha_0, β0\beta_0, α1\alpha_1 and β1\beta_1 can be 00. But we would also need α0β1=0\alpha_0\beta_1=0, which is only possible if α0=0\alpha_0=0 or β1=0\beta_1=0. Both demands cannot hold at the same time.

∣Φ+⟩\ket{\Phi^+} belongs to a family of four states named after John Bell. They are called the Bell states or EPR pairs (Nielsen, M. A. & Chuang, I. L., 2010):

∣Φ+⟩=∣00⟩+∣11⟩2,∣Φ−⟩=∣00⟩−∣11⟩2∣Ψ+⟩=∣01⟩+∣10⟩2,∣Ψ−⟩=∣01⟩−∣10⟩2\begin{align*} \ket{\Phi^+}&=\frac{\ket{00}+\ket{11}}{\sqrt{2}}, & \ket{\Phi^-}&=\frac{\ket{00}-\ket{11}}{\sqrt{2}}\\ \ket{\Psi^+}&=\frac{\ket{01}+\ket{10}}{\sqrt{2}}, & \ket{\Psi^-}&=\frac{\ket{01}-\ket{10}}{\sqrt{2}} \end{align*}

In the Φ\Phi states, the two qubits always agree (0000 or 1111). The Ψ\Psi states, on the other hand, always disagree (0101 or 1010). The sign in the middle is the relative phase we met with the Z-gate in part 3 . All four are entangled; for each of them, one of adad and bcbc is ±12\pm\frac{1}{2} and the other is 00.

Each of them comes from the same small circuit: a Hadamard on the first qubit, then a CNOT with the first qubit as the control. Only the input changes:

Bell-state circuit6 components and 5 connections.Q0|x⟩Q1|y⟩HH0HCXCNOTAABB
Bell-state circuit Six components joined by five nets, carrying quantum signals.

We need three facts from part 3 . First, H∣0⟩=∣0⟩+∣1⟩2H\ket{0}=\frac{\ket{0}+\ket{1}}{\sqrt{2}} and H∣1⟩=∣0⟩−∣1⟩2H\ket{1}=\frac{\ket{0}-\ket{1}}{\sqrt{2}}. Second, the CNOT leaves the target alone when the control is 00 and flips it when the control is 11: ∣00⟩→∣00⟩\ket{00}\to\ket{00}, ∣01⟩→∣01⟩\ket{01}\to\ket{01}, ∣10⟩→∣11⟩\ket{10}\to\ket{11} and ∣11⟩→∣10⟩\ket{11}\to\ket{10}. Third, gates are linear, so a gate acting on a sum acts on each term separately.

Now, we will not take the table on trust. Here is each input, gate by gate. The HH only touches the first qubit, and the second qubit comes along unchanged.

For ∣00⟩\ket{00}:

∣00⟩→H∣0⟩+∣1⟩2⊗∣0⟩=∣00⟩+∣10⟩2→CNOT⁡∣00⟩+∣11⟩2=∣Φ+⟩\ket{00} \xrightarrow{H} \frac{\ket{0}+\ket{1}}{\sqrt{2}}\otimes\ket{0}=\frac{\ket{00}+\ket{10}}{\sqrt{2}} \xrightarrow{\operatorname{CNOT}} \frac{\ket{00}+\ket{11}}{\sqrt{2}}=\ket{\Phi^+}

For ∣01⟩\ket{01}:

∣01⟩→H∣0⟩+∣1⟩2⊗∣1⟩=∣01⟩+∣11⟩2→CNOT⁡∣01⟩+∣10⟩2=∣Ψ+⟩\ket{01} \xrightarrow{H} \frac{\ket{0}+\ket{1}}{\sqrt{2}}\otimes\ket{1}=\frac{\ket{01}+\ket{11}}{\sqrt{2}} \xrightarrow{\operatorname{CNOT}} \frac{\ket{01}+\ket{10}}{\sqrt{2}}=\ket{\Psi^+}

For ∣10⟩\ket{10}:

∣10⟩→H∣0⟩−∣1⟩2⊗∣0⟩=∣00⟩−∣10⟩2→CNOT⁡∣00⟩−∣11⟩2=∣Φ−⟩\ket{10} \xrightarrow{H} \frac{\ket{0}-\ket{1}}{\sqrt{2}}\otimes\ket{0}=\frac{\ket{00}-\ket{10}}{\sqrt{2}} \xrightarrow{\operatorname{CNOT}} \frac{\ket{00}-\ket{11}}{\sqrt{2}}=\ket{\Phi^-}

For ∣11⟩\ket{11}:

∣11⟩→H∣0⟩−∣1⟩2⊗∣1⟩=∣01⟩−∣11⟩2→CNOT⁡∣01⟩−∣10⟩2=∣Ψ−⟩\ket{11} \xrightarrow{H} \frac{\ket{0}-\ket{1}}{\sqrt{2}}\otimes\ket{1}=\frac{\ket{01}-\ket{11}}{\sqrt{2}} \xrightarrow{\operatorname{CNOT}} \frac{\ket{01}-\ket{10}}{\sqrt{2}}=\ket{\Psi^-}

In each line, the CNOT step only changes the terms whose first qubit is 11: their second qubit flips. The table below collects the four results:

Input ∣xy⟩\ket{xy} After HH on the first qubit After CNOT
∣00⟩\ket{00} ∣00⟩+∣10⟩2\frac{\ket{00}+\ket{10}}{\sqrt{2}} ∣Φ+⟩\ket{\Phi^+}
∣01⟩\ket{01} ∣01⟩+∣11⟩2\frac{\ket{01}+\ket{11}}{\sqrt{2}} ∣Ψ+⟩\ket{\Psi^+}
∣10⟩\ket{10} ∣00⟩−∣10⟩2\frac{\ket{00}-\ket{10}}{\sqrt{2}} ∣Φ−⟩\ket{\Phi^-}
∣11⟩\ket{11} ∣01⟩−∣11⟩2\frac{\ket{01}-\ket{11}}{\sqrt{2}} ∣Ψ−⟩\ket{\Psi^-}

There is a second, very useful way to read this table: backwards. Both gates undo themselves. For HH, we showed H2=IH^2=I in part 3 . As for CNOT, applying it twice to ∣c,t⟩\ket{c,t} gives:

∣c,t⟩→CNOT⁡∣c,t⊕c⟩→CNOT⁡∣c,(t⊕c)⊕c⟩=∣c,t⟩\ket{c,t} \xrightarrow{\operatorname{CNOT}} \ket{c,t\oplus c} \xrightarrow{\operatorname{CNOT}} \ket{c,(t\oplus c)\oplus c}=\ket{c,t}

since c⊕c=0c\oplus c=0, one of the XOR properties from part 3 . To undo a circuit, the gates are undone in the reverse order: the last gate applied is the first one undone. So, applying CNOT first and then HH takes each Bell state back to the basis state it came from. For example:

∣Φ+⟩=∣00⟩+∣11⟩2→CNOT⁡∣00⟩+∣10⟩2=∣0⟩+∣1⟩2⊗∣0⟩→H∣0⟩⊗∣0⟩=∣00⟩\ket{\Phi^+}=\frac{\ket{00}+\ket{11}}{\sqrt{2}} \xrightarrow{\operatorname{CNOT}} \frac{\ket{00}+\ket{10}}{\sqrt{2}} =\frac{\ket{0}+\ket{1}}{\sqrt{2}}\otimes\ket{0} \xrightarrow{H} \ket{0}\otimes\ket{0}=\ket{00}

The last step uses H(∣0⟩+∣1⟩2)=H∣+⟩=∣0⟩H\left(\frac{\ket{0}+\ket{1}}{\sqrt{2}}\right)=H\ket{+}=\ket{0}, also from part 3 . We will rely on this in the worked examples to "measure in the Bell basis".

Now, suppose both qubits of ∣Φ+⟩\ket{\Phi^+} are measured in the computational basis. By the Born rule (Born, M., 1926), the probability of each outcome is the squared size of its amplitude. Using the amplitudes we read off earlier (a=d=12a=d=\frac{1}{\sqrt{2}} and b=c=0b=c=0):

P00=∣12∣2=12,P11=∣12∣2=12,P01=∣0∣2=0,P10=∣0∣2=0\mathcal{P}_{00}=\left|\frac{1}{\sqrt{2}}\right|^2=\frac{1}{2},\qquad \mathcal{P}_{11}=\left|\frac{1}{\sqrt{2}}\right|^2=\frac{1}{2},\qquad \mathcal{P}_{01}=|0|^2=0,\qquad \mathcal{P}_{10}=|0|^2=0

So, each qubit on its own is a fair coin: 00 half the time, 11 the other half. Yet the two coins always land the same way. If the first qubit gives 00, only the term ∣00⟩\ket{00} is consistent with that result, so the state has collapsed to ∣00⟩\ket{00}, and the second qubit will give 00 with certainty, even if it has been carried to the other side of the world in the meantime.

You may object that there is nothing quantum about this. Bell himself told the story of his colleague, Reinhold Bertlmann, who always wore socks of different colours (Bell, J. S., 1981). If you see that one of his socks is pink, you know at once that the other is not pink. Nothing travelled from one sock to the other; the colours were fixed in the morning when he dressed. Perhaps the qubits also "decide" their values when they are created, and the measurement only reveals them?

Socks, however, have a harder time with the next fact. We will rewrite ∣Φ+⟩\ket{\Phi^+} in the Hadamard basis, {∣+⟩,∣−⟩}\{\ket{+},\ket{-}\}. First, we need ∣0⟩\ket{0} and ∣1⟩\ket{1} in terms of ∣+⟩\ket{+} and ∣−⟩\ket{-}. Adding and subtracting the definitions ∣+⟩=∣0⟩+∣1⟩2\ket{+}=\frac{\ket{0}+\ket{1}}{\sqrt{2}} and ∣−⟩=∣0⟩−∣1⟩2\ket{-}=\frac{\ket{0}-\ket{1}}{\sqrt{2}}:

∣+⟩+∣−⟩=∣0⟩+∣1⟩+∣0⟩−∣1⟩2=2∣0⟩2=2∣0⟩⟹∣0⟩=∣+⟩+∣−⟩2∣+⟩−∣−⟩=∣0⟩+∣1⟩−∣0⟩+∣1⟩2=2∣1⟩2=2∣1⟩⟹∣1⟩=∣+⟩−∣−⟩2\begin{align*} \ket{+}+\ket{-}&=\frac{\ket{0}+\ket{1}+\ket{0}-\ket{1}}{\sqrt{2}}=\frac{2\ket{0}}{\sqrt{2}}=\sqrt{2}\ket{0} &&\Longrightarrow\quad \ket{0}=\frac{\ket{+}+\ket{-}}{\sqrt{2}}\\ \ket{+}-\ket{-}&=\frac{\ket{0}+\ket{1}-\ket{0}+\ket{1}}{\sqrt{2}}=\frac{2\ket{1}}{\sqrt{2}}=\sqrt{2}\ket{1} &&\Longrightarrow\quad \ket{1}=\frac{\ket{+}-\ket{-}}{\sqrt{2}} \end{align*}

Here, 22=2\frac{2}{\sqrt{2}}=\sqrt{2}, because 2=2⋅22=\sqrt{2}\cdot\sqrt{2}. Now, substitute into ∣00⟩=∣0⟩⊗∣0⟩\ket{00}=\ket{0}\otimes\ket{0} and expand the brackets as in the first section:

∣00⟩=∣+⟩+∣−⟩2⊗∣+⟩+∣−⟩2=12(∣++⟩+∣+−⟩+∣−+⟩+∣−−⟩)\ket{00} =\frac{\ket{+}+\ket{-}}{\sqrt{2}}\otimes\frac{\ket{+}+\ket{-}}{\sqrt{2}} =\frac{1}{2}\left(\ket{++}+\ket{+-}+\ket{-+}+\ket{--}\right)

The same for ∣11⟩=∣1⟩⊗∣1⟩\ket{11}=\ket{1}\otimes\ket{1}. This time, a term gets a minus sign when exactly one of its two factors comes with a minus, and (−1)⋅(−1)=+1(-1)\cdot(-1)=+1 for ∣−−⟩\ket{--}:

∣11⟩=∣+⟩−∣−⟩2⊗∣+⟩−∣−⟩2=12(∣++⟩−∣+−⟩−∣−+⟩+∣−−⟩)\ket{11} =\frac{\ket{+}-\ket{-}}{\sqrt{2}}\otimes\frac{\ket{+}-\ket{-}}{\sqrt{2}} =\frac{1}{2}\left(\ket{++}-\ket{+-}-\ket{-+}+\ket{--}\right)

Adding the two lines, the ∣+−⟩\ket{+-} and ∣−+⟩\ket{-+} terms cancel, while the ∣++⟩\ket{++} and ∣−−⟩\ket{--} terms double:

∣00⟩+∣11⟩=12(2∣++⟩+2∣−−⟩)=∣++⟩+∣−−⟩\ket{00}+\ket{11}=\frac{1}{2}\left(2\ket{++}+2\ket{--}\right)=\ket{++}+\ket{--}

Dividing both sides by 2\sqrt{2}:

∣Φ+⟩=∣00⟩+∣11⟩2=∣++⟩+∣−−⟩2\ket{\Phi^+}=\frac{\ket{00}+\ket{11}}{\sqrt{2}}=\frac{\ket{++}+\ket{--}}{\sqrt{2}}

The two qubits agree in the Hadamard basis as well! Even so, socks could imitate this. Each pair might leave the factory with two hidden instructions, one for each question, fixed before anyone looks. That is close to what Einstein, Podolsky and Rosen believed: the answers exist all along, and quantum mechanics simply fails to describe them (Einstein, A. et al., 1935). Bell's insight was to ask questions in between the two bases (Bell, J. S., 1964). David Mermin later turned Bell's argument into a version that needs nothing more than counting (Mermin, N. D., 1981), and we will follow it here.

First, we need a way to measure a qubit "at an angle". Recall from part 2 that a qubit state is a point on the Bloch sphere. The rotation about the y-axis of the sphere is the gate (Nielsen, M. A. & Chuang, I. L., 2010):

Ry(θ)=[cos⁡θ2−sin⁡θ2sin⁡θ2cos⁡θ2]R_y(\theta)=\begin{bmatrix} \cos\frac{\theta}{2} & -\sin\frac{\theta}{2}\\ \sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{bmatrix}

Multiplying it by ∣0⟩=[10]\ket{0}=\begin{bmatrix}1\\0\end{bmatrix} picks out its first column, and multiplying by ∣1⟩=[01]\ket{1}=\begin{bmatrix}0\\1\end{bmatrix} picks out its second column:

Ry(θ)∣0⟩=cos⁡θ2∣0⟩+sin⁡θ2∣1⟩,Ry(θ)∣1⟩=−sin⁡θ2∣0⟩+cos⁡θ2∣1⟩R_y(\theta)\ket{0}=\cos\frac{\theta}{2}\ket{0}+\sin\frac{\theta}{2}\ket{1},\qquad R_y(\theta)\ket{1}=-\sin\frac{\theta}{2}\ket{0}+\cos\frac{\theta}{2}\ket{1}

Two quick examples. With θ=0\theta=0, cos⁡0=1\cos0=1 and sin⁡0=0\sin0=0, so Ry(0)=[1001]=IR_y(0)=\begin{bmatrix}1&0\\0&1\end{bmatrix}=I. Taking θ=π2\theta=\frac{\pi}{2} instead, cos⁡π4=sin⁡π4=12\cos\frac{\pi}{4}=\sin\frac{\pi}{4}=\frac{1}{\sqrt{2}}, so Ry(π2)∣0⟩=12∣0⟩+12∣1⟩=∣+⟩R_y\left(\frac{\pi}{2}\right)\ket{0}=\frac{1}{\sqrt{2}}\ket{0}+\frac{1}{\sqrt{2}}\ket{1}=\ket{+}.

"Measuring at angle $\theta$" means asking whether the *qubit* is in $R_y(\theta)\ket{0}$ or in $R_y(\theta)\ket{1}$. For $\theta=0$, these are $\ket{0}$ and $\ket{1}$, the computational basis. When $\theta=\frac{\pi}{2}$, they are $\ket{+}$ and $\frac{-\ket{0}+\ket{1}}{\sqrt{2}}=-\ket{-}$, which is $\ket{-}$ up to a global phase, so this is the Hadamard basis. Hardware, however, only measures in the computational basis. The trick is to rotate the *qubit* back by $-\theta$ first. Since $\cos(-x)=\cos x$ and $\sin(-x)=-\sin x$:

Ry(−θ)=[cos⁡θ2sin⁡θ2−sin⁡θ2cos⁡θ2]R_y(-\theta)=\begin{bmatrix} \cos\frac{\theta}{2} & \sin\frac{\theta}{2}\\ -\sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{bmatrix}

Writing c=cos⁡θ2c=\cos\frac{\theta}{2} and s=sin⁡θ2s=\sin\frac{\theta}{2} to save space, and using c2+s2=1c^2+s^2=1:

Ry(−θ)Ry(θ)=[cs−sc][c−ssc]=[c2+s2−cs+sc−sc+css2+c2]=[1001]=IR_y(-\theta)R_y(\theta) =\begin{bmatrix}c&s\\-s&c\end{bmatrix}\begin{bmatrix}c&-s\\s&c\end{bmatrix} =\begin{bmatrix}c^2+s^2&-cs+sc\\-sc+cs&s^2+c^2\end{bmatrix} =\begin{bmatrix}1&0\\0&1\end{bmatrix}=I

So, Ry(−θ)R_y(-\theta) sends Ry(θ)∣0⟩R_y(\theta)\ket{0} back to ∣0⟩\ket{0} and Ry(θ)∣1⟩R_y(\theta)\ket{1} back to ∣1⟩\ket{1}. After it, the question "Ry(θ)∣0⟩R_y(\theta)\ket{0} or Ry(θ)∣1⟩R_y(\theta)\ket{1}?" has become "∣0⟩\ket{0} or ∣1⟩\ket{1}?", which an ordinary measurement answers.

Now, suppose the first qubit of ∣Φ+⟩\ket{\Phi^+} is measured at angle θA\theta_A and the second at angle θB\theta_B. That means applying Ry(−θA)R_y(-\theta_A) to the first qubit and Ry(−θB)R_y(-\theta_B) to the second, then measuring both normally. To keep the expressions short, write:

cA=cos⁡θA2,sA=sin⁡θA2,cB=cos⁡θB2,sB=sin⁡θB2c_A=\cos\frac{\theta_A}{2},\quad s_A=\sin\frac{\theta_A}{2},\quad c_B=\cos\frac{\theta_B}{2},\quad s_B=\sin\frac{\theta_B}{2}

From the columns of Ry(−θ)R_y(-\theta), each rotation acts on the basis states as:

Ry(−θ)∣0⟩=c∣0⟩−s∣1⟩,Ry(−θ)∣1⟩=s∣0⟩+c∣1⟩R_y(-\theta)\ket{0}=c\ket{0}-s\ket{1},\qquad R_y(-\theta)\ket{1}=s\ket{0}+c\ket{1}

∣Φ+⟩=12(∣0⟩⊗∣0⟩+∣1⟩⊗∣1⟩)\ket{\Phi^+}=\frac{1}{\sqrt{2}}\left(\ket{0}\otimes\ket{0}+\ket{1}\otimes\ket{1}\right), and each rotation acts on its own qubit, so:

12[(cA∣0⟩−sA∣1⟩)⊗(cB∣0⟩−sB∣1⟩)+(sA∣0⟩+cA∣1⟩)⊗(sB∣0⟩+cB∣1⟩)]\frac{1}{\sqrt{2}}\Big[ (c_A\ket{0}-s_A\ket{1})\otimes(c_B\ket{0}-s_B\ket{1}) +(s_A\ket{0}+c_A\ket{1})\otimes(s_B\ket{0}+c_B\ket{1}) \Big]

Expanding both products, just as before:

(cA∣0⟩−sA∣1⟩)⊗(cB∣0⟩−sB∣1⟩)=cAcB∣00⟩−cAsB∣01⟩−sAcB∣10⟩+sAsB∣11⟩(sA∣0⟩+cA∣1⟩)⊗(sB∣0⟩+cB∣1⟩)=sAsB∣00⟩+sAcB∣01⟩+cAsB∣10⟩+cAcB∣11⟩\begin{align*} (c_A\ket{0}-s_A\ket{1})\otimes(c_B\ket{0}-s_B\ket{1})&=c_Ac_B\ket{00}-c_As_B\ket{01}-s_Ac_B\ket{10}+s_As_B\ket{11}\\ (s_A\ket{0}+c_A\ket{1})\otimes(s_B\ket{0}+c_B\ket{1})&=s_As_B\ket{00}+s_Ac_B\ket{01}+c_As_B\ket{10}+c_Ac_B\ket{11} \end{align*}

Adding them and grouping by basis state, the state just before measurement is:

12[(cAcB+sAsB)∣00⟩+(sAcB−cAsB)∣01⟩+(cAsB−sAcB)∣10⟩+(cAcB+sAsB)∣11⟩]\frac{1}{\sqrt{2}}\Big[ (c_Ac_B+s_As_B)\ket{00} +(s_Ac_B-c_As_B)\ket{01} +(c_As_B-s_Ac_B)\ket{10} +(c_Ac_B+s_As_B)\ket{11} \Big]

The trigonometric identities cos⁡(x−y)=cos⁡xcos⁡y+sin⁡xsin⁡y\cos(x-y)=\cos x\cos y+\sin x\sin y and sin⁡(x−y)=sin⁡xcos⁡y−cos⁡xsin⁡y\sin(x-y)=\sin x\cos y-\cos x\sin y (Wikipedia., 2025) tidy this up. With x=θA2x=\frac{\theta_A}{2}, y=θB2y=\frac{\theta_B}{2} and Δ=θA−θB2\Delta=\frac{\theta_A-\theta_B}{2}:

cAcB+sAsB=cos⁡Δ,sAcB−cAsB=sin⁡Δ,cAsB−sAcB=−sin⁡Δc_Ac_B+s_As_B=\cos\Delta,\qquad s_Ac_B-c_As_B=\sin\Delta,\qquad c_As_B-s_Ac_B=-\sin\Delta

so the state is:

cos⁡Δ2∣00⟩+sin⁡Δ2∣01⟩−sin⁡Δ2∣10⟩+cos⁡Δ2∣11⟩\frac{\cos\Delta}{\sqrt{2}}\ket{00}+\frac{\sin\Delta}{\sqrt{2}}\ket{01}-\frac{\sin\Delta}{\sqrt{2}}\ket{10}+\frac{\cos\Delta}{\sqrt{2}}\ket{11}

The two results are the same when the outcome is 0000 or 1111. By the Born rule, their probabilities add:

Psame=∣cos⁡Δ2∣2+∣cos⁡Δ2∣2=cos⁡2Δ2+cos⁡2Δ2=cos⁡2θA−θB2\mathcal{P}_{\text{same}} =\left|\frac{\cos\Delta}{\sqrt{2}}\right|^2+\left|\frac{\cos\Delta}{\sqrt{2}}\right|^2 =\frac{\cos^2\Delta}{2}+\frac{\cos^2\Delta}{2} =\cos^2\frac{\theta_A-\theta_B}{2}

We can test it on what we already know. Equal angles give Δ=0\Delta=0 and cos⁡20=1\cos^2 0=1: the results always agree, which covers both bases we have seen. Angles 90∘90^\circ apart give Δ=45∘\Delta=45^\circ, and since cos⁡45∘=12\cos45^\circ=\frac{1}{\sqrt{2}}, Psame=12\mathcal{P}_{\text{same}}=\frac{1}{2}: the results are unrelated.

Next, let each side pick one of three angles, 0∘0^\circ, 120∘120^\circ or 240∘240^\circ, at random and independently. With three choices on each side, there are 3×3=93\times3=9 equally likely pairs of angles. In 33 of them, both sides pick the same angle, so the probability of equal angles is 39=13\frac{3}{9}=\frac{1}{3}, and then the results always agree. In the other 66 (probability 69=23\frac{6}{9}=\frac{2}{3}), the angles differ by ±120∘\pm120^\circ or ±240∘\pm240^\circ, so Δ\Delta is ±60∘\pm60^\circ or ±120∘\pm120^\circ. Since cos⁡60∘=12\cos60^\circ=\frac{1}{2} and cos⁡120∘=−12\cos120^\circ=-\frac{1}{2}, and squaring removes the sign, cos⁡2Δ=14\cos^2\Delta=\frac{1}{4} in every one of these cases. On average:

Psame=13⋅1+23⋅14=13+16=26+16=36=12\mathcal{P}_{\text{same}}=\frac{1}{3}\cdot1+\frac{2}{3}\cdot\frac{1}{4}=\frac{1}{3}+\frac{1}{6}=\frac{2}{6}+\frac{1}{6}=\frac{3}{6}=\frac{1}{2}

What would socks do? Each pair would carry a ready answer for each of the three angles, the same for both socks, since they must agree whenever the angles are equal. Take the instruction "00 at 0∘0^\circ, 00 at 120∘120^\circ, 11 at 240∘240^\circ" and list the nine equally likely choices of angles:

First angle Second angle Answers Same?
0∘0^\circ 0∘0^\circ 0,00,0 yes
0∘0^\circ 120∘120^\circ 0,00,0 yes
0∘0^\circ 240∘240^\circ 0,10,1 no
120∘120^\circ 0∘0^\circ 0,00,0 yes
120∘120^\circ 120∘120^\circ 0,00,0 yes
120∘120^\circ 240∘240^\circ 0,10,1 no
240∘240^\circ 0∘0^\circ 1,01,0 no
240∘240^\circ 120∘120^\circ 1,01,0 no
240∘240^\circ 240∘240^\circ 1,11,1 yes

That is 55 out of 99. Three answers, each 00 or 11, can only come in two patterns. Either all three are equal, and then all 99 pairs agree. Or two are equal and one is different, as in the table. Then the pairs that agree are the 33 with equal angles, plus the 22 that use the two angles with equal answers in either order: 55 in total. So, however the socks are made, they agree at least 59≈0.56\frac{5}{9}\approx0.56 of the time. Quantum mechanics predicts 12=0.5\frac{1}{2}=0.5, which is less. No set of answers written in advance can produce what ∣Φ+⟩\ket{\Phi^+} produces. This is the heart of Bell's theorem, and the experiments honoured by the 2022 Nobel Prize found that nature agrees with quantum mechanics (The Royal Swedish Academy of Sciences., 2022).

Before we get carried away, one thing entanglement cannot do is carry a message. The state above shows why. The second qubit gives 00 for the outcomes 0000 and 1010, so its probability of giving 00 is:

∣cos⁡Δ2∣2+∣−sin⁡Δ2∣2=cos⁡2Δ+sin⁡2Δ2=12\left|\frac{\cos\Delta}{\sqrt{2}}\right|^2+\left|-\frac{\sin\Delta}{\sqrt{2}}\right|^2 =\frac{\cos^2\Delta+\sin^2\Delta}{2} =\frac{1}{2}

since cos⁡2Δ+sin⁡2Δ=1\cos^2\Delta+\sin^2\Delta=1. Whatever angle the first person chooses, the second person, looking only at their own qubit, sees 00 half of the time and 11 half of the time. The correlation only appears when the two lists of results are brought together and compared, and that comparison travels by ordinary means (Nielsen, M. A. & Chuang, I. L., 2010).

Not all entangled states are equally entangled. For a two-qubit state a∣00⟩+b∣01⟩+c∣10⟩+d∣11⟩a\ket{00}+b\ket{01}+c\ket{10}+d\ket{11}, a common measure is the concurrence, defined by William Wootters (Wootters, W. K., 1998) as:

C=2∣ad−bc∣\mathcal{C}=2\left|ad-bc\right|

It is built on the same quantity as our test, so it is 00 exactly for product states. How large can it get? Two facts from school algebra settle this. First, the size of a difference is at most the sum of the sizes: ∣ad−bc∣≤∣a∣∣d∣+∣b∣∣c∣|ad-bc|\leq|a||d|+|b||c|. Second, for any real numbers xx and yy, (x−y)2≥0(x-y)^2\geq0, which expands to x2−2xy+y2≥0x^2-2xy+y^2\geq0, so xy≤x2+y22xy\leq\frac{x^2+y^2}{2}. Applying the second fact to ∣a∣∣d∣|a||d| and to ∣b∣∣c∣|b||c|:

∣ad−bc∣≤∣a∣2+∣d∣22+∣b∣2+∣c∣22=∣a∣2+∣b∣2+∣c∣2+∣d∣22=12|ad-bc|\leq\frac{|a|^2+|d|^2}{2}+\frac{|b|^2+|c|^2}{2}=\frac{|a|^2+|b|^2+|c|^2+|d|^2}{2}=\frac{1}{2}

The last step holds because the probabilities of all four outcomes add up to 11. Therefore, C=2∣ad−bc∣≤2⋅12=1\mathcal{C}=2|ad-bc|\leq2\cdot\frac{1}{2}=1. The concurrence runs from 00 for product states to 11 for the most entangled ones. For ∣Φ+⟩\ket{\Phi^+}, we found ad−bc=12ad-bc=\frac{1}{2}, so:

C=2⋅12=1\mathcal{C}=2\cdot\frac{1}{2}=1

It reaches the largest possible value. The Bell states are, therefore, maximally entangled. We will meet a state in between in Q3.

Just like ∣00⟩\ket{00}, ∣01⟩\ket{01}, ∣10⟩\ket{10} and ∣11⟩\ket{11}, the four Bell states have length 11 (for example, ∣12∣2+∣12∣2=1\left|\frac{1}{\sqrt{2}}\right|^2+\left|\frac{1}{\sqrt{2}}\right|^2=1 for ∣Φ+⟩\ket{\Phi^+}), and no two of them overlap. So, any two-qubit state can be written in terms of them. In particular, adding and subtracting pairs of Bell states gives back the basis states. Adding ∣Φ+⟩\ket{\Phi^+} and ∣Φ−⟩\ket{\Phi^-}, the ∣11⟩\ket{11} terms cancel:

∣Φ+⟩+∣Φ−⟩=∣00⟩+∣11⟩+∣00⟩−∣11⟩2=2∣00⟩2=2∣00⟩⟹∣00⟩=∣Φ+⟩+∣Φ−⟩2\ket{\Phi^+}+\ket{\Phi^-}=\frac{\ket{00}+\ket{11}+\ket{00}-\ket{11}}{\sqrt{2}}=\frac{2\ket{00}}{\sqrt{2}}=\sqrt{2}\ket{00} \quad\Longrightarrow\quad \ket{00}=\frac{\ket{\Phi^+}+\ket{\Phi^-}}{\sqrt{2}}

Subtracting them instead, the ∣00⟩\ket{00} terms cancel:

∣Φ+⟩−∣Φ−⟩=∣00⟩+∣11⟩−∣00⟩+∣11⟩2=2∣11⟩2=2∣11⟩⟹∣11⟩=∣Φ+⟩−∣Φ−⟩2\ket{\Phi^+}-\ket{\Phi^-}=\frac{\ket{00}+\ket{11}-\ket{00}+\ket{11}}{\sqrt{2}}=\frac{2\ket{11}}{\sqrt{2}}=\sqrt{2}\ket{11} \quad\Longrightarrow\quad \ket{11}=\frac{\ket{\Phi^+}-\ket{\Phi^-}}{\sqrt{2}}

The Ψ\Psi pair works the same way:

∣Ψ+⟩+∣Ψ−⟩=∣01⟩+∣10⟩+∣01⟩−∣10⟩2=2∣01⟩⟹∣01⟩=∣Ψ+⟩+∣Ψ−⟩2∣Ψ+⟩−∣Ψ−⟩=∣01⟩+∣10⟩−∣01⟩+∣10⟩2=2∣10⟩⟹∣10⟩=∣Ψ+⟩−∣Ψ−⟩2\begin{align*} \ket{\Psi^+}+\ket{\Psi^-}&=\frac{\ket{01}+\ket{10}+\ket{01}-\ket{10}}{\sqrt{2}}=\sqrt{2}\ket{01} &&\Longrightarrow\quad \ket{01}=\frac{\ket{\Psi^+}+\ket{\Psi^-}}{\sqrt{2}}\\ \ket{\Psi^+}-\ket{\Psi^-}&=\frac{\ket{01}+\ket{10}-\ket{01}+\ket{10}}{\sqrt{2}}=\sqrt{2}\ket{10} &&\Longrightarrow\quad \ket{10}=\frac{\ket{\Psi^+}-\ket{\Psi^-}}{\sqrt{2}} \end{align*}

Keep these four results close. They are the key to Q4 and Q5.

Compute (H⊗H⊗⋯⊗H)∣0n⟩(H\otimes H\otimes\cdots\otimes H)\ket{0^n}.

Solution

Here, ∣0n⟩\ket{0^n} is short for nn qubits, all in ∣0⟩\ket{0}:

∣0n⟩=∣0⟩⊗∣0⟩⊗⋯⊗∣0⟩⏟n times=∣0⟩⊗n\ket{0^n}=\underbrace{\ket{0}\otimes\ket{0}\otimes\cdots\otimes\ket{0}}_{n\text{ times}}=\ket{0}^{\otimes n}

In the same way, H⊗nH^{\otimes n} is short for H⊗H⊗⋯⊗HH\otimes H\otimes\cdots\otimes H, one HH for each qubit. A tensor product of gates acts on a tensor product of states one factor at a time: the first gate acts on the first qubit, the second gate on the second qubit, and so on. In symbols, (A⊗B)(∣x⟩⊗∣y⟩)=A∣x⟩⊗B∣y⟩(A\otimes B)(\ket{x}\otimes\ket{y})=A\ket{x}\otimes B\ket{y}.

We can check this rule against the matrix of H⊗IH\otimes I from Q2 of part 3 . Multiplying a matrix by ∣00⟩=[1000]T\ket{00}=\begin{bmatrix}1&0&0&0\end{bmatrix}^T picks out its first column, which for H⊗IH\otimes I is 12[1010]T=∣00⟩+∣10⟩2\frac{1}{\sqrt{2}}\begin{bmatrix}1&0&1&0\end{bmatrix}^T=\frac{\ket{00}+\ket{10}}{\sqrt{2}}. The rule gives the same answer: H∣0⟩⊗I∣0⟩=∣0⟩+∣1⟩2⊗∣0⟩=∣00⟩+∣10⟩2H\ket{0}\otimes I\ket{0}=\frac{\ket{0}+\ket{1}}{\sqrt{2}}\otimes\ket{0}=\frac{\ket{00}+\ket{10}}{\sqrt{2}}.

So, each HH meets one ∣0⟩\ket{0}:

H⊗n∣0⟩⊗n=H∣0⟩⊗H∣0⟩⊗⋯⊗H∣0⟩H^{\otimes n}\ket{0}^{\otimes n} =H\ket{0}\otimes H\ket{0}\otimes\cdots\otimes H\ket{0}

Recall that H∣0⟩=∣0⟩+∣1⟩2=∣+⟩H\ket{0}=\frac{\ket{0}+\ket{1}}{\sqrt{2}}=\ket{+}. Substituting it nn times:

H⊗n∣0n⟩=∣0⟩+∣1⟩2⊗∣0⟩+∣1⟩2⊗⋯⊗∣0⟩+∣1⟩2H^{\otimes n}\ket{0^n} =\frac{\ket{0}+\ket{1}}{\sqrt{2}}\otimes\frac{\ket{0}+\ket{1}}{\sqrt{2}}\otimes\cdots\otimes\frac{\ket{0}+\ket{1}}{\sqrt{2}}

Each of the nn factors carries a 12\frac{1}{\sqrt{2}}, and numbers can be moved to the front of a tensor product. The nn copies multiply to (12)n=1(2)n=12n\left(\frac{1}{\sqrt{2}}\right)^n=\frac{1}{(\sqrt{2})^n}=\frac{1}{\sqrt{2^n}}, since raising 2\sqrt{2} to the power nn is the same as taking the square root of 2n2^n. Therefore:

H⊗n∣0n⟩=12n(∣0⟩+∣1⟩)⊗(∣0⟩+∣1⟩)⊗⋯⊗(∣0⟩+∣1⟩)⏟n bracketsH^{\otimes n}\ket{0^n}=\frac{1}{\sqrt{2^n}}\underbrace{(\ket{0}+\ket{1})\otimes(\ket{0}+\ket{1})\otimes\cdots\otimes(\ket{0}+\ket{1})}_{n\text{ brackets}}

To see what this looks like when expanded, take n=2n=2. Here, 122=14=12\frac{1}{\sqrt{2^2}}=\frac{1}{\sqrt{4}}=\frac{1}{2}, and the two brackets expand like (p+q)(r+s)(p+q)(r+s):

12(∣0⟩+∣1⟩)⊗(∣0⟩+∣1⟩)=12(∣0⟩⊗∣0⟩+∣0⟩⊗∣1⟩+∣1⟩⊗∣0⟩+∣1⟩⊗∣1⟩)=12(∣00⟩+∣01⟩+∣10⟩+∣11⟩)\frac{1}{2}(\ket{0}+\ket{1})\otimes(\ket{0}+\ket{1}) =\frac{1}{2}\left(\ket{0}\otimes\ket{0}+\ket{0}\otimes\ket{1}+\ket{1}\otimes\ket{0}+\ket{1}\otimes\ket{1}\right) =\frac{1}{2}\left(\ket{00}+\ket{01}+\ket{10}+\ket{11}\right)

Look at how each term was formed: we picked either ∣0⟩\ket{0} or ∣1⟩\ket{1} from the first bracket, and either ∣0⟩\ket{0} or ∣1⟩\ket{1} from the second. Every possible way of picking gives one term, so every two-bit string appears exactly once, each with the same amplitude, 12\frac{1}{2}.

The same happens for any nn. Expanding nn brackets means picking ∣0⟩\ket{0} or ∣1⟩\ket{1} from each of them. That is 22 choices, nn times over, or 2×2×⋯×2=2n2\times2\times\cdots\times2=2^n ways in total, and each way spells out a different nn-bit string. For n=3n=3, the 23=82^3=8 strings ∣000⟩,∣001⟩,…,∣111⟩\ket{000},\ket{001},\ldots,\ket{111} each appear once, with amplitude 123=18\frac{1}{\sqrt{2^3}}=\frac{1}{\sqrt{8}}. In general:

∴H⊗n∣0n⟩=12n∑x∈{0,1}n∣x⟩\therefore\quad H^{\otimes n}\ket{0^n}=\frac{1}{\sqrt{2^n}}\sum_{x\in\{0,1\}^n}\ket{x}

Here, {0,1}n\{0,1\}^n is the set of all strings of nn bits, and ∑x∈{0,1}n∣x⟩\sum_{x\in\{0,1\}^n}\ket{x} means "add ∣x⟩\ket{x} for every such string xx". With only nn gates, we have put nn qubits into an equal superposition of 2n2^n states. This is the opening move of many quantum algorithms, including the Deutsch-Jozsa algorithm.

Now, is this state entangled? It looks impressive, but no. We built it as ∣+⟩⊗∣+⟩⊗⋯⊗∣+⟩\ket{+}\otimes\ket{+}\otimes\cdots\otimes\ket{+}, so it is a product state by construction. For n=2n=2, it is exactly the state ∣+⟩∣+⟩\ket{+}\ket{+} we tested in When the qubits cannot be separated , with a=b=c=d=12a=b=c=d=\frac{1}{2}, and there we found ad−bc=14−14=0ad-bc=\frac{1}{4}-\frac{1}{4}=0.

Superposition and entanglement are different things. A state can hold all 2n2^n bit strings at once and still be a simple product of nn independent qubits. Entanglement needs gates that act on two or more qubits together, such as CNOT.

Check

check.py
python
import cirq
import numpy as np
​
for n in (1, 2, 3, 4):
qubits = cirq.LineQubit.range(n)
​
# Apply H to every qubit of |00...0>
circuit = cirq.Circuit(cirq.H.on_each(*qubits))
state = cirq.Simulator().simulate(circuit, qubit_order=qubits).final_state_vector
​
# Every one of the 2^n amplitudes should equal 1/sqrt(2^n)
expected = np.ones(2**n) / np.sqrt(2**n)
np.testing.assert_allclose(state, expected, atol=1e-7)
​
# The state is a product of n copies of |+>, so it is not entangled
plus = np.array([1, 1]) / np.sqrt(2)
product = plus
for _ in range(n - 1):
product = np.kron(product, plus)
np.testing.assert_allclose(state, product, atol=1e-7)
​
print(f"n = {n}: all {2**n} amplitudes equal {1 / np.sqrt(2**n):.4f}")

Show the quantum circuits that generate the nn-qubit GHZ state, 12(∣00…0⟩+∣11…1⟩)\frac{1}{\sqrt{2}}(\ket{00\ldots0}+\ket{11\ldots1}), and the nn-qubit W state, 1n(∣10…0⟩+∣01…0⟩+⋯+∣00…1⟩)\frac{1}{\sqrt{n}}(\ket{10\ldots0}+\ket{01\ldots0}+\cdots+\ket{00\ldots1}), from ∣0n⟩\ket{0^n}.

Some texts call the second state the Werner state. The usual name is the W state (Dür, W. et al., 2000). A Werner state is something else: a mixture of a Bell state and pure noise, introduced by Reinhard Werner (Werner, R. F., 1989).

Solution

Both states spread entanglement across more than two qubits, but in very different ways. The GHZ state, named after Daniel Greenberger, Michael Horne and Anton Zeilinger (Greenberger, D. M. et al., 1989), is "all or nothing": every qubit is 00, or every qubit is 11. In the W state, exactly one qubit is 11, and that 11 is shared equally among all the positions.

(i) GHZ state

GHZ is the Bell state ∣Φ+⟩\ket{\Phi^+} grown to nn qubits, so we build it the same way. First, apply HH to the first qubit and leave the rest alone (the identity, II, on each of the other n−1n-1 qubits). By the rule from Q1, each gate acts on its own qubit:

(H⊗I⊗(n−1))∣0⟩∣0…0⟩=H∣0⟩⊗∣0…0⟩=∣0⟩+∣1⟩2⊗∣0…0⟩=∣00…0⟩+∣10…0⟩2(H\otimes I^{\otimes(n-1)})\ket{0}\ket{0\ldots0} =H\ket{0}\otimes\ket{0\ldots0} =\frac{\ket{0}+\ket{1}}{\sqrt{2}}\otimes\ket{0\ldots0} =\frac{\ket{00\ldots0}+\ket{10\ldots0}}{\sqrt{2}}

The first qubit is now in superposition while the rest are ∣0⟩\ket{0}. We call the two terms branches. Next, we apply CNOT gates with the first qubit as the control. Recall that a CNOT flips its target only when its control is 11. We will follow n=3n=3 to see what happens:

∣000⟩+∣100⟩2→CNOT⁡1,2∣000⟩+∣110⟩2→CNOT⁡1,3∣000⟩+∣111⟩2\frac{\ket{000}+\ket{100}}{\sqrt{2}} \xrightarrow{\operatorname{CNOT}_{1,2}} \frac{\ket{000}+\ket{110}}{\sqrt{2}} \xrightarrow{\operatorname{CNOT}_{1,3}} \frac{\ket{000}+\ket{111}}{\sqrt{2}}

In the first branch, the first qubit is 00, so neither CNOT does anything, and ∣000⟩\ket{000} stays as it is. In the second branch, the first qubit is 11, so CNOT⁡1,2\operatorname{CNOT}_{1,2} flips the second qubit (∣100⟩→∣110⟩\ket{100}\to\ket{110}) and CNOT⁡1,3\operatorname{CNOT}_{1,3} flips the third (∣110⟩→∣111⟩\ket{110}\to\ket{111}). Each CNOT copies the value of the first qubit onto one more qubit. For nn qubits, we continue until every qubit has been reached:

∴CNOT⁡1,n⋯CNOT⁡1,3CNOT⁡1,2 (H⊗I⊗(n−1))∣0n⟩=∣0n⟩+∣1n⟩2\therefore\quad \operatorname{CNOT}_{1,n}\cdots\operatorname{CNOT}_{1,3}\operatorname{CNOT}_{1,2}\,(H\otimes I^{\otimes(n-1)})\ket{0^n} =\frac{\ket{0^n}+\ket{1^n}}{\sqrt{2}}

The control of each CNOT does not have to be the first qubit. After CNOT⁡1,2\operatorname{CNOT}_{1,2}, the second qubit holds the same value as the first in each branch (00 in the first branch and 11 in the second). So, CNOT⁡2,3\operatorname{CNOT}_{2,3} flips the third qubit in exactly the same branch as CNOT⁡1,3\operatorname{CNOT}_{1,3} would. Chaining them like this, each qubit controlling the next, is common on hardware where only neighbouring qubits can interact (Cruz, D. et al., 2019). For three qubits, the chained version looks like this:

GHZ-state circuit for three qubits9 components and 8 connections.Q0|0⟩Q1|0⟩Q2|0⟩HH0HC01CNOTC12CNOTO0q₀O1q₁O2q₂
GHZ-state circuit for three qubits Nine components joined by eight nets, carrying quantum signals.

The GHZ state is fragile in an interesting way. Suppose one qubit is measured and gives 00. Of the two branches, only ∣0n⟩\ket{0^n} has a 00 in that position, so the state collapses to ∣0n⟩\ket{0^n}. That is a product state, so none of the remaining qubits is entangled any more. A single measurement destroys all of it.

(ii) W state

The W state needs a different idea, because its amplitudes are 1n\frac{1}{\sqrt{n}}, not 12\frac{1}{\sqrt{2}}. Our approach is to start with a single 11 on the first qubit and pass it down the line. At each qubit, a fair share is left behind and the rest is passed on.

We need a gate that splits a qubit between ∣0⟩\ket{0} and ∣1⟩\ket{1} in any proportion we like. The rotation Ry(θ)R_y(\theta), which we met in What makes entanglement strange , does exactly this, since Ry(θ)∣0⟩=cos⁡θ2∣0⟩+sin⁡θ2∣1⟩R_y(\theta)\ket{0}=\cos\frac{\theta}{2}\ket{0}+\sin\frac{\theta}{2}\ket{1}. By choosing θ\theta, we choose how the amplitude is split. We also need the inverse cosine, arccos⁡\arccos: arccos⁡y\arccos y is the angle whose cosine is yy. Now, we build ∣W3⟩=13(∣100⟩+∣010⟩+∣001⟩)\ket{W_3}=\frac{1}{\sqrt{3}}(\ket{100}+\ket{010}+\ket{001}) step by step.

We begin with an X-gate on the first qubit, which turns ∣000⟩\ket{000} into ∣100⟩\ket{100}. The single 11 sits on the first qubit.

In the first step, the first qubit should keep 13\frac{1}{3} of the probability, and so end with amplitude 13\frac{1}{\sqrt{3}}, while the remaining 23\frac{2}{3} moves on. We use two gates for this. A controlled-Ry(θ1)R_y(\theta_1), with the first qubit as the control, rotates the second qubit only when the first is ∣1⟩\ket{1}. In ∣100⟩\ket{100}, it is ∣1⟩\ket{1}, so the second qubit turns from ∣0⟩\ket{0} into Ry(θ1)∣0⟩R_y(\theta_1)\ket{0}:

∣100⟩⟼∣1⟩⊗(cos⁡θ12∣0⟩+sin⁡θ12∣1⟩)⊗∣0⟩=cos⁡θ12∣100⟩+sin⁡θ12∣110⟩\ket{100}\longmapsto\ket{1}\otimes\left(\cos\frac{\theta_1}{2}\ket{0}+\sin\frac{\theta_1}{2}\ket{1}\right)\otimes\ket{0} =\cos\frac{\theta_1}{2}\ket{100}+\sin\frac{\theta_1}{2}\ket{110}

Then a CNOT with the second qubit as the control and the first as the target clears the first qubit wherever the second has become 11. In ∣100⟩\ket{100}, the control (second qubit) is 00, so nothing happens. In ∣110⟩\ket{110}, the control is 11, so the first qubit flips from 11 to 00, giving ∣010⟩\ket{010}:

cos⁡θ12∣100⟩+sin⁡θ12∣010⟩\cos\frac{\theta_1}{2}\ket{100}+\sin\frac{\theta_1}{2}\ket{010}

The amplitude of ∣100⟩\ket{100} must be 13\frac{1}{\sqrt{3}}, so:

cos⁡θ12=13⟹θ12=arccos⁡13≈0.9553 rad⟹θ1≈1.9106 rad\cos\frac{\theta_1}{2}=\frac{1}{\sqrt{3}} \quad\Longrightarrow\quad \frac{\theta_1}{2}=\arccos\frac{1}{\sqrt{3}}\approx0.9553\text{ rad} \quad\Longrightarrow\quad \theta_1\approx1.9106\text{ rad}

The other amplitude follows from cos⁡2x+sin⁡2x=1\cos^2x+\sin^2x=1:

sin⁡θ12=1−cos⁡2θ12=1−13=23\sin\frac{\theta_1}{2}=\sqrt{1-\cos^2\frac{\theta_1}{2}}=\sqrt{1-\frac{1}{3}}=\sqrt{\frac{2}{3}}

So, after the first step, the state is 13∣100⟩+23∣010⟩\frac{1}{\sqrt{3}}\ket{100}+\sqrt{\frac{2}{3}}\ket{010}. The first qubit has its share, and the remaining (23)2=23\left(\sqrt{\frac{2}{3}}\right)^2=\frac{2}{3} of the probability now sits on the second qubit.

In the second step, we repeat the move between the second and third qubits: a controlled-Ry(θ2)R_y(\theta_2) from the second qubit to the third, then a CNOT from the third to the second. In ∣010⟩\ket{010}, the second qubit is 11, so the rotation acts and turns the third qubit into Ry(θ2)∣0⟩R_y(\theta_2)\ket{0}. The CNOT then clears the second qubit wherever the third has become 11:

∣010⟩⟼cos⁡θ22∣010⟩+sin⁡θ22∣011⟩⟼cos⁡θ22∣010⟩+sin⁡θ22∣001⟩\ket{010} \longmapsto \cos\frac{\theta_2}{2}\ket{010}+\sin\frac{\theta_2}{2}\ket{011} \longmapsto \cos\frac{\theta_2}{2}\ket{010}+\sin\frac{\theta_2}{2}\ket{001}

The term ∣100⟩\ket{100} is not touched in this step, because its second qubit is 00 and both gates need their control to be 11. Putting the pieces together:

13∣100⟩+23cos⁡θ22∣010⟩+23sin⁡θ22∣001⟩\frac{1}{\sqrt{3}}\ket{100}+\sqrt{\frac{2}{3}}\cos\frac{\theta_2}{2}\ket{010}+\sqrt{\frac{2}{3}}\sin\frac{\theta_2}{2}\ket{001}

The amplitude of ∣010⟩\ket{010} must also be 13\frac{1}{\sqrt{3}}. Dividing both sides by 23\sqrt{\frac{2}{3}}, and remembering that dividing by a fraction means multiplying by its flip:

23cos⁡θ22=13⟹cos⁡θ22=13⋅32=12⟹θ22=π4⟹θ2=π2\sqrt{\frac{2}{3}}\cos\frac{\theta_2}{2}=\frac{1}{\sqrt{3}} \quad\Longrightarrow\quad \cos\frac{\theta_2}{2}=\frac{1}{\sqrt{3}}\cdot\frac{\sqrt{3}}{\sqrt{2}}=\frac{1}{\sqrt{2}} \quad\Longrightarrow\quad \frac{\theta_2}{2}=\frac{\pi}{4} \quad\Longrightarrow\quad \theta_2=\frac{\pi}{2}

since cos⁡π4=12\cos\frac{\pi}{4}=\frac{1}{\sqrt{2}}. Then sin⁡θ22=sin⁡π4=12\sin\frac{\theta_2}{2}=\sin\frac{\pi}{4}=\frac{1}{\sqrt{2}} as well, and both of the last two amplitudes are 23⋅12=26=13=13\sqrt{\frac{2}{3}}\cdot\frac{1}{\sqrt{2}}=\sqrt{\frac{2}{6}}=\sqrt{\frac{1}{3}}=\frac{1}{\sqrt{3}}. So, the final state is:

13∣100⟩+13∣010⟩+13∣001⟩=13(∣100⟩+∣010⟩+∣001⟩)=∣W3⟩\frac{1}{\sqrt{3}}\ket{100}+\frac{1}{\sqrt{3}}\ket{010}+\frac{1}{\sqrt{3}}\ket{001} =\frac{1}{\sqrt{3}}\left(\ket{100}+\ket{010}+\ket{001}\right)=\ket{W_3}
W-state circuit for three qubits11 components and 12 connections.Q0|0⟩Q1|0⟩Q2|0⟩XX0XRyR1Ry(θ₁)B1CNOTRyR2Ry(θ₂)B2CNOTO0q₀O1q₁O2q₂
W-state circuit for three qubits 11 components joined by 12 nets, carrying quantum signals.

For nn qubits, the same move is repeated n−1n-1 times, and the angles follow the same reasoning. Before step kk (counting from 11), the first k−1k-1 qubits have each kept their share, 1n\frac{1}{n} of the probability. The probability still travelling is therefore 1−k−1n=n−k+1n1-\frac{k-1}{n}=\frac{n-k+1}{n}, which is an amplitude of n−k+1n\sqrt{\frac{n-k+1}{n}}, and it sits on qubit kk. Qubit kk should keep an amplitude of 1n\frac{1}{\sqrt{n}}, so:

n−k+1ncos⁡θk2=1n⟹cos⁡θk2=1n⋅nn−k+1=1n−k+1\sqrt{\frac{n-k+1}{n}}\cos\frac{\theta_k}{2}=\frac{1}{\sqrt{n}} \quad\Longrightarrow\quad \cos\frac{\theta_k}{2}=\frac{1}{\sqrt{n}}\cdot\sqrt{\frac{n}{n-k+1}}=\frac{1}{\sqrt{n-k+1}} ∴θk=2arccos⁡1n−k+1,k=1,2,…,n−1\therefore\quad \theta_k=2\arccos\frac{1}{\sqrt{n-k+1}},\qquad k=1,2,\ldots,n-1

For n=3n=3, k=1k=1 gives θ1=2arccos⁡13\theta_1=2\arccos\frac{1}{\sqrt{3}} and k=2k=2 gives θ2=2arccos⁡12=π2\theta_2=2\arccos\frac{1}{\sqrt{2}}=\frac{\pi}{2}, as above. At the last step, k=n−1k=n-1, the travelling amplitude is 2n\sqrt{\frac{2}{n}} and cos⁡θn−12=12\cos\frac{\theta_{n-1}}{2}=\frac{1}{\sqrt{2}}, so it splits evenly between the last two qubits, 1n\frac{1}{\sqrt{n}} each. With n=2n=2, there is a single angle, θ1=2arccos⁡12=π2\theta_1=2\arccos\frac{1}{\sqrt{2}}=\frac{\pi}{2}, and the circuit produces ∣10⟩+∣01⟩2=∣Ψ+⟩\frac{\ket{10}+\ket{01}}{\sqrt{2}}=\ket{\Psi^+}, a Bell state. This construction is the linear version of the one given by (Cruz, D. et al., 2019).

The W state behaves very differently from GHZ under loss. Suppose the first qubit of ∣W3⟩\ket{W_3} is measured and gives 00. Only the terms ∣010⟩\ket{010} and ∣001⟩\ket{001} have a 00 in that position, so they are all that remains. Their probabilities, 13\frac{1}{3} each, add up to 23\frac{2}{3}, so the state has to be rescaled to length 11 by dividing by 23\sqrt{\frac{2}{3}}. Each amplitude becomes 13÷23=13⋅32=12\frac{1}{\sqrt{3}}\div\sqrt{\frac{2}{3}}=\frac{1}{\sqrt{3}}\cdot\frac{\sqrt{3}}{\sqrt{2}}=\frac{1}{\sqrt{2}}, and the other two qubits are left in ∣10⟩+∣01⟩2\frac{\ket{10}+\ket{01}}{\sqrt{2}}, which is still a Bell state. Dür, Vidal and Cirac showed that GHZ and W are two genuinely different kinds of three-qubit entanglement; no local operations can turn one into the other, even with some chance of failure (Dür, W. et al., 2000).

Check

check.py
python
import cirq
import numpy as np
​
​
def ghz_circuit(n):
"""H on the first qubit, then a CNOT from the first qubit to every other qubit."""
q = cirq.LineQubit.range(n)
return cirq.Circuit(cirq.H(q[0]), [cirq.CNOT(q[0], q[k]) for k in range(1, n)]), q
​
​
def w_circuit(n):
"""Start from |10...0> and pass the 1 down the line, leaving a share behind at each step."""
q = cirq.LineQubit.range(n)
circuit = cirq.Circuit(cirq.X(q[0]))
for k in range(n - 1):
# Keep a share 1/(n-k) of what is left on qubit k, pass the rest to qubit k+1
theta = 2 * np.arccos(np.sqrt(1 / (n - k)))
circuit.append(cirq.ry(theta).on(q[k + 1]).controlled_by(q[k]))
circuit.append(cirq.CNOT(q[k + 1], q[k]))
return circuit, q
​
​
for n in (3, 4, 5):
# GHZ: (|00...0> + |11...1>)/sqrt(2)
circuit, q = ghz_circuit(n)
state = cirq.Simulator().simulate(circuit, qubit_order=q).final_state_vector
expected = np.zeros(2**n)
expected[0] = expected[-1] = 1 / np.sqrt(2)
np.testing.assert_allclose(state, expected, atol=1e-7)
​
# W: (|10...0> + |01...0> + ... + |00...1>)/sqrt(n)
circuit, q = w_circuit(n)
state = cirq.Simulator().simulate(circuit, qubit_order=q).final_state_vector
expected = np.zeros(2**n)
for k in range(n):
expected[2 ** (n - 1 - k)] = 1 / np.sqrt(n)
np.testing.assert_allclose(state, expected, atol=1e-7)
​
print(f"n = {n}: GHZ and W states are correct")
​
print(w_circuit(3)[0])

Design a circuit that constructs the state ∣ψ⟩=112(3∣00⟩+∣01⟩+∣10⟩+∣11⟩)\ket{\psi}=\frac{1}{\sqrt{12}}(3\ket{00}+\ket{01}+\ket{10}+\ket{11}).

Solution

Before designing anything, we should determine what kind of state this is. Moving 112\frac{1}{\sqrt{12}} into each term, the amplitudes are the numbers in front of the basis states:

∣ψ⟩=312∣00⟩+112∣01⟩+112∣10⟩+112∣11⟩\ket{\psi}=\frac{3}{\sqrt{12}}\ket{00}+\frac{1}{\sqrt{12}}\ket{01}+\frac{1}{\sqrt{12}}\ket{10}+\frac{1}{\sqrt{12}}\ket{11}

so a=312a=\frac{3}{\sqrt{12}}, b=112b=\frac{1}{\sqrt{12}}, c=112c=\frac{1}{\sqrt{12}} and d=112d=\frac{1}{\sqrt{12}}. As a sanity check, the state is normalized, since the squared amplitudes add up to 11:

(312)2+(112)2+(112)2+(112)2=912+112+112+112=1212=1\left(\frac{3}{\sqrt{12}}\right)^2+\left(\frac{1}{\sqrt{12}}\right)^2+\left(\frac{1}{\sqrt{12}}\right)^2+\left(\frac{1}{\sqrt{12}}\right)^2 =\frac{9}{12}+\frac{1}{12}+\frac{1}{12}+\frac{1}{12}=\frac{12}{12}=1

Now, the entanglement test. Using 12⋅12=12\sqrt{12}\cdot\sqrt{12}=12:

ad−bc=312⋅112−112⋅112=312−112=212=16≠0ad-bc=\frac{3}{\sqrt{12}}\cdot\frac{1}{\sqrt{12}}-\frac{1}{\sqrt{12}}\cdot\frac{1}{\sqrt{12}}=\frac{3}{12}-\frac{1}{12}=\frac{2}{12}=\frac{1}{6}\neq0

The state is entangled, so we will need a two-qubit gate. Its concurrence is:

C=2∣ad−bc∣=2⋅16=13\mathcal{C}=2\left|ad-bc\right|=2\cdot\frac{1}{6}=\frac{1}{3}

It is entangled, but much less than a Bell state, whose concurrence is 11.

The plan is to prepare the first qubit first, and then prepare the second qubit differently depending on the first. To do that, we group the terms by the value of the first qubit. The terms 3∣00⟩3\ket{00} and ∣01⟩\ket{01} both start with ∣0⟩\ket{0}, so ∣0⟩\ket{0} can be taken out as a common factor, the reverse of expanding a bracket: 3∣00⟩+∣01⟩=∣0⟩⊗(3∣0⟩+∣1⟩)3\ket{00}+\ket{01}=\ket{0}\otimes(3\ket{0}+\ket{1}). In the same way, ∣10⟩+∣11⟩=∣1⟩⊗(∣0⟩+∣1⟩)\ket{10}+\ket{11}=\ket{1}\otimes(\ket{0}+\ket{1}). Therefore:

∣ψ⟩=112(∣0⟩⊗(3∣0⟩+∣1⟩)+∣1⟩⊗(∣0⟩+∣1⟩))\ket{\psi}=\frac{1}{\sqrt{12}}\Big(\ket{0}\otimes(3\ket{0}+\ket{1})+\ket{1}\otimes(\ket{0}+\ket{1})\Big)

The two brackets are not valid single-qubit states yet, because their lengths are not 11. Recall from part 1 that the length of x∣0⟩+y∣1⟩x\ket{0}+y\ket{1} is ∣x∣2+∣y∣2\sqrt{|x|^2+|y|^2}. So, 3∣0⟩+∣1⟩3\ket{0}+\ket{1} has length 32+12=10\sqrt{3^2+1^2}=\sqrt{10}, and ∣0⟩+∣1⟩\ket{0}+\ket{1} has length 12+12=2\sqrt{1^2+1^2}=\sqrt{2}. Dividing each bracket by its length, and multiplying by the same number outside so that nothing changes:

3∣0⟩+∣1⟩=10(310∣0⟩+110∣1⟩),∣0⟩+∣1⟩=2⋅∣0⟩+∣1⟩23\ket{0}+\ket{1}=\sqrt{10}\left(\frac{3}{\sqrt{10}}\ket{0}+\frac{1}{\sqrt{10}}\ket{1}\right),\qquad \ket{0}+\ket{1}=\sqrt{2}\cdot\frac{\ket{0}+\ket{1}}{\sqrt{2}}

Substituting these, the numbers 112⋅10=1012\frac{1}{\sqrt{12}}\cdot\sqrt{10}=\frac{\sqrt{10}}{\sqrt{12}} and 112⋅2=212\frac{1}{\sqrt{12}}\cdot\sqrt{2}=\frac{\sqrt{2}}{\sqrt{12}} appear in front:

∣ψ⟩=1012⏟α∣0⟩⊗(310⏟γ∣0⟩+110⏟δ∣1⟩)+212⏟β∣1⟩⊗∣0⟩+∣1⟩2\ket{\psi}= \underbrace{\frac{\sqrt{10}}{\sqrt{12}}}_{\alpha}\ket{0}\otimes\Big(\underbrace{\frac{3}{\sqrt{10}}}_{\gamma}\ket{0}+\underbrace{\frac{1}{\sqrt{10}}}_{\delta}\ket{1}\Big) +\underbrace{\frac{\sqrt{2}}{\sqrt{12}}}_{\beta}\ket{1}\otimes\frac{\ket{0}+\ket{1}}{\sqrt{2}}

We can confirm that the pieces are consistent. The first qubit is in α∣0⟩+β∣1⟩\alpha\ket{0}+\beta\ket{1}, a valid state, because α2+β2=1012+212=1\alpha^2+\beta^2=\frac{10}{12}+\frac{2}{12}=1. The bracket γ∣0⟩+δ∣1⟩\gamma\ket{0}+\delta\ket{1} is valid too, because γ2+δ2=910+110=1\gamma^2+\delta^2=\frac{9}{10}+\frac{1}{10}=1. Multiplying back gives the original amplitudes:

αγ=1012⋅310=312,αδ=1012⋅110=112,β2=212⋅12=112\alpha\gamma=\frac{\sqrt{10}}{\sqrt{12}}\cdot\frac{3}{\sqrt{10}}=\frac{3}{\sqrt{12}},\qquad \alpha\delta=\frac{\sqrt{10}}{\sqrt{12}}\cdot\frac{1}{\sqrt{10}}=\frac{1}{\sqrt{12}},\qquad \frac{\beta}{\sqrt{2}}=\frac{\sqrt{2}}{\sqrt{12}}\cdot\frac{1}{\sqrt{2}}=\frac{1}{\sqrt{12}}

The last one is the amplitude of both ∣10⟩\ket{10} and ∣11⟩\ket{11}. Now the circuit reads itself off the equation, in three steps.

First, put the first qubit into α∣0⟩+β∣1⟩\alpha\ket{0}+\beta\ket{1} with Ry(θ1)R_y(\theta_1). Since Ry(θ)∣0⟩=cos⁡θ2∣0⟩+sin⁡θ2∣1⟩R_y(\theta)\ket{0}=\cos\frac{\theta}{2}\ket{0}+\sin\frac{\theta}{2}\ket{1}, we need cos⁡θ12=α\cos\frac{\theta_1}{2}=\alpha. Simplifying 1012=56\frac{10}{12}=\frac{5}{6}:

cos⁡θ12=1012=56⟹θ12=arccos⁡56≈0.4205 rad⟹θ1≈0.8411 rad\cos\frac{\theta_1}{2}=\frac{\sqrt{10}}{\sqrt{12}}=\sqrt{\frac{5}{6}} \quad\Longrightarrow\quad \frac{\theta_1}{2}=\arccos\sqrt{\frac{5}{6}}\approx0.4205\text{ rad} \quad\Longrightarrow\quad \theta_1\approx0.8411\text{ rad}

Multiplying by 180∘π\frac{180^\circ}{\pi} converts this to about 48.19∘48.19^\circ. The amplitude of ∣1⟩\ket{1} then comes out right by itself:

sin⁡θ12=1−cos⁡2θ12=1−56=16=212=212=β\sin\frac{\theta_1}{2}=\sqrt{1-\cos^2\frac{\theta_1}{2}}=\sqrt{1-\frac{5}{6}}=\sqrt{\frac{1}{6}}=\sqrt{\frac{2}{12}}=\frac{\sqrt{2}}{\sqrt{12}}=\beta

Second, when the first qubit is ∣0⟩\ket{0}, put the second into γ∣0⟩+δ∣1⟩\gamma\ket{0}+\delta\ket{1}, again with an RyR_y:

cos⁡θ22=γ=310⟹θ22=arccos⁡310≈0.3218 rad⟹θ2≈0.6435 rad (36.87∘)\cos\frac{\theta_2}{2}=\gamma=\frac{3}{\sqrt{10}} \quad\Longrightarrow\quad \frac{\theta_2}{2}=\arccos\frac{3}{\sqrt{10}}\approx0.3218\text{ rad} \quad\Longrightarrow\quad \theta_2\approx0.6435\text{ rad}\ (36.87^\circ)

and, as before, sin⁡θ22=1−910=110=110=δ\sin\frac{\theta_2}{2}=\sqrt{1-\frac{9}{10}}=\sqrt{\frac{1}{10}}=\frac{1}{\sqrt{10}}=\delta.

This calls for a gate that acts only when the control is ∣0⟩\ket{0}. It is drawn with an open (hollow) circle on the control. It works like a normal controlled gate with an X-gate on the control wire before and after it: the first X turns a control of ∣0⟩\ket{0} into ∣1⟩\ket{1}, so the gate fires, and the second X turns the control back.

Third, when the first qubit is ∣1⟩\ket{1}, put the second into ∣0⟩+∣1⟩2\frac{\ket{0}+\ket{1}}{\sqrt{2}}. Since H∣0⟩=∣0⟩+∣1⟩2H\ket{0}=\frac{\ket{0}+\ket{1}}{\sqrt{2}}, that is simply a controlled-HH.

We can follow the state through. Both qubits start in ∣0⟩\ket{0}. The first step only touches the first qubit:

Ry(θ1)∣0⟩⊗∣0⟩=(α∣0⟩+β∣1⟩)⊗∣0⟩=α∣00⟩+β∣10⟩R_y(\theta_1)\ket{0}\otimes\ket{0}=(\alpha\ket{0}+\beta\ket{1})\otimes\ket{0}=\alpha\ket{00}+\beta\ket{10}

The second step fires only where the first qubit is 00, that is, on α∣00⟩\alpha\ket{00}, and turns its second qubit into Ry(θ2)∣0⟩=γ∣0⟩+δ∣1⟩R_y(\theta_2)\ket{0}=\gamma\ket{0}+\delta\ket{1}. The third step fires only where the first qubit is 11, on β∣10⟩\beta\ket{10}, and turns its second qubit into H∣0⟩H\ket{0}:

α∣0⟩⊗(γ∣0⟩+δ∣1⟩)+β∣1⟩⊗∣0⟩+∣1⟩2=αγ∣00⟩+αδ∣01⟩+β2∣10⟩+β2∣11⟩\alpha\ket{0}\otimes(\gamma\ket{0}+\delta\ket{1})+\beta\ket{1}\otimes\frac{\ket{0}+\ket{1}}{\sqrt{2}} =\alpha\gamma\ket{00}+\alpha\delta\ket{01}+\frac{\beta}{\sqrt{2}}\ket{10}+\frac{\beta}{\sqrt{2}}\ket{11}

Substituting the three products we computed above:

=312∣00⟩+112∣01⟩+112∣10⟩+112∣11⟩=112(3∣00⟩+∣01⟩+∣10⟩+∣11⟩)=\frac{3}{\sqrt{12}}\ket{00}+\frac{1}{\sqrt{12}}\ket{01}+\frac{1}{\sqrt{12}}\ket{10}+\frac{1}{\sqrt{12}}\ket{11} =\frac{1}{\sqrt{12}}(3\ket{00}+\ket{01}+\ket{10}+\ket{11})

That is the required state. The circuit is:

Circuit for (3|00⟩ + |01⟩ + |10⟩ + |11⟩)/√127 components and 7 connections.Q0|0⟩Q1|0⟩Ryθ₁R0RyRyR1Ry(θ₂), open controlHCHHO0q₀O1q₁
Circuit for (3|00⟩ + |01⟩ + |10⟩ + |11⟩)/√12 Seven components joined by seven nets, carrying quantum signals.

The same recipe works for any two-qubit state: rotate the first qubit, then prepare the second with one gate controlled on ∣0⟩\ket{0} and another controlled on ∣1⟩\ket{1}.

Check

check.py
python
import cirq
import numpy as np
​
q0, q1 = cirq.LineQubit.range(2)
​
# Rotation angles from the solution
theta1 = 2 * np.arccos(np.sqrt(10 / 12)) # first qubit: cos(theta1/2) = sqrt(10/12)
theta2 = 2 * np.arccos(3 / np.sqrt(10)) # second qubit when the first is |0>
​
circuit = cirq.Circuit(
cirq.ry(theta1).on(q0),
# Open control: act only when q0 is |0>
cirq.ry(theta2).on(q1).controlled_by(q0, control_values=[0]),
# Normal control: act only when q0 is |1>
cirq.H(q1).controlled_by(q0),
)
​
state = cirq.Simulator().simulate(circuit, qubit_order=[q0, q1]).final_state_vector
expected = np.array([3, 1, 1, 1]) / np.sqrt(12)
np.testing.assert_allclose(state, expected, atol=1e-7)
​
a, b, c, d = expected
print("theta1 =", round(theta1, 4), "rad; theta2 =", round(theta2, 4), "rad")
print("ad - bc =", round(a * d - b * c, 4), "(not zero, so the state is entangled)")
print("concurrence =", round(2 * abs(a * d - b * c), 4))
print(circuit)

Verify the entanglement-swapping protocol: given two Bell pairs, ABAB and CDCD, show that the teleportation protocol applied to the qubits BB, CC and DD yields a Bell pair on the qubits AA and DD.

Solution

First, we put people to the qubits. Alice holds AA and Dave holds DD. Bob created the pair ABAB and sent AA to Alice; Carol created the pair CDCD and sent DD to Dave. Later, the two of them meet in the middle with BB and CC. Alice and Dave have never met, and their qubits have never interacted. The claim is that a single measurement in the middle, by Bob and Carol, leaves Alice and Dave holding a Bell pair. This is called entanglement swapping, and it was proposed by Żukowski and colleagues in 1993 (Żukowski, M. et al., 1993).

Entanglement swapping16 components and 17 connections.QA|0⟩QB|0⟩QC|0⟩QD|0⟩HHAHPABCNOTHHCHPCDCNOTMBCCNOTHHBHMBMMCMXXDX if mC = 1ZZDZ if mB = 1OAAODD
Entanglement swapping 16 components joined by 17 nets, carrying classical and quantum signals.

The two pairs are ∣Φ+⟩\ket{\Phi^+} states. Each qubit carries its letter as a subscript, so we always know which is which:

∣Φ+⟩AB=∣0A0B⟩+∣1A1B⟩2,∣Φ+⟩CD=∣0C0D⟩+∣1C1D⟩2\ket{\Phi^+}_{AB}=\frac{\ket{0_A0_B}+\ket{1_A1_B}}{\sqrt{2}},\qquad \ket{\Phi^+}_{CD}=\frac{\ket{0_C0_D}+\ket{1_C1_D}}{\sqrt{2}}

The four qubits together are in the tensor product of the two. We expand it exactly as in the first section, each term of the first bracket with each term of the second, and the two 12\frac{1}{\sqrt{2}} factors multiply to 12\frac{1}{2}:

∣ψ⟩=∣Φ+⟩AB⊗∣Φ+⟩CD=12(∣0A0B⟩+∣1A1B⟩)⊗(∣0C0D⟩+∣1C1D⟩)=12(∣0A0B0C0D⟩+∣0A0B1C1D⟩+∣1A1B0C0D⟩+∣1A1B1C1D⟩)\begin{align*} \ket{\psi}=\ket{\Phi^+}_{AB}\otimes\ket{\Phi^+}_{CD} &=\frac{1}{2}\left(\ket{0_A0_B}+\ket{1_A1_B}\right)\otimes\left(\ket{0_C0_D}+\ket{1_C1_D}\right)\\ &=\frac{1}{2}\left(\ket{0_A0_B0_C0_D}+\ket{0_A0_B1_C1_D}+\ket{1_A1_B0_C0_D}+\ket{1_A1_B1_C1_D}\right) \end{align*}

Bob and Carol are going to measure BB and CC together in the Bell basis. So, we write the pair BCBC in the middle of each term and AA and DD on the outside. Since every qubit carries its label, changing the order in which we write them changes nothing. Reading the labels in each term:

Term AA BB CC DD Rewritten
∣0A0B0C0D⟩\ket{0_A0_B0_C0_D} 00 00 00 00 ∣0A⟩∣00⟩BC∣0D⟩\ket{0_A}\ket{00}_{BC}\ket{0_D}
∣0A0B1C1D⟩\ket{0_A0_B1_C1_D} 00 00 11 11 ∣0A⟩∣01⟩BC∣1D⟩\ket{0_A}\ket{01}_{BC}\ket{1_D}
∣1A1B0C0D⟩\ket{1_A1_B0_C0_D} 11 11 00 00 ∣1A⟩∣10⟩BC∣0D⟩\ket{1_A}\ket{10}_{BC}\ket{0_D}
∣1A1B1C1D⟩\ket{1_A1_B1_C1_D} 11 11 11 11 ∣1A⟩∣11⟩BC∣1D⟩\ket{1_A}\ket{11}_{BC}\ket{1_D}

So:

∣ψ⟩=12(∣0A⟩∣00⟩BC∣0D⟩+∣0A⟩∣01⟩BC∣1D⟩+∣1A⟩∣10⟩BC∣0D⟩+∣1A⟩∣11⟩BC∣1D⟩)\ket{\psi}=\frac{1}{2}\left( \ket{0_A}\ket{00}_{BC}\ket{0_D} +\ket{0_A}\ket{01}_{BC}\ket{1_D} +\ket{1_A}\ket{10}_{BC}\ket{0_D} +\ket{1_A}\ket{11}_{BC}\ket{1_D} \right)

Now, we use the four results from The Bell states as a basis to replace each ∣xy⟩BC\ket{xy}_{BC}:

∣00⟩=∣Φ+⟩+∣Φ−⟩2,∣01⟩=∣Ψ+⟩+∣Ψ−⟩2,∣10⟩=∣Ψ+⟩−∣Ψ−⟩2,∣11⟩=∣Φ+⟩−∣Φ−⟩2\ket{00}=\frac{\ket{\Phi^+}+\ket{\Phi^-}}{\sqrt{2}},\qquad \ket{01}=\frac{\ket{\Psi^+}+\ket{\Psi^-}}{\sqrt{2}},\qquad \ket{10}=\frac{\ket{\Psi^+}-\ket{\Psi^-}}{\sqrt{2}},\qquad \ket{11}=\frac{\ket{\Phi^+}-\ket{\Phi^-}}{\sqrt{2}}

Each replacement brings a 12\frac{1}{\sqrt{2}}, which joins the 12\frac{1}{2} in front as 12⋅12=122\frac{1}{2}\cdot\frac{1}{\sqrt{2}}=\frac{1}{2\sqrt{2}}:

∣ψ⟩=122(∣0A⟩(∣Φ+⟩+∣Φ−⟩)BC∣0D⟩+∣0A⟩(∣Ψ+⟩+∣Ψ−⟩)BC∣1D⟩+∣1A⟩(∣Ψ+⟩−∣Ψ−⟩)BC∣0D⟩+∣1A⟩(∣Φ+⟩−∣Φ−⟩)BC∣1D⟩)\begin{align*} \ket{\psi}=\frac{1}{2\sqrt{2}}\Big( &\ket{0_A}\left(\ket{\Phi^+}+\ket{\Phi^-}\right)_{BC}\ket{0_D} +\ket{0_A}\left(\ket{\Psi^+}+\ket{\Psi^-}\right)_{BC}\ket{1_D}\\ +&\ket{1_A}\left(\ket{\Psi^+}-\ket{\Psi^-}\right)_{BC}\ket{0_D} +\ket{1_A}\left(\ket{\Phi^+}-\ket{\Phi^-}\right)_{BC}\ket{1_D} \Big) \end{align*}

Opening the four brackets gives eight terms. We now collect them by the Bell state of BCBC, moving it to the front of each term and leaving AA and DD together behind it:

  • ∣Φ+⟩BC\ket{\Phi^+}_{BC} appears in the first bracket with ∣0A⟩…∣0D⟩\ket{0_A}\ldots\ket{0_D} (sign ++) and in the fourth with ∣1A⟩…∣1D⟩\ket{1_A}\ldots\ket{1_D} (sign ++). It therefore carries ∣Φ+⟩BC(∣0A0D⟩+∣1A1D⟩)\ket{\Phi^+}_{BC}\left(\ket{0_A0_D}+\ket{1_A1_D}\right).
  • ∣Φ−⟩BC\ket{\Phi^-}_{BC} appears in the first bracket with ∣0A⟩…∣0D⟩\ket{0_A}\ldots\ket{0_D} (sign ++) and in the fourth with ∣1A⟩…∣1D⟩\ket{1_A}\ldots\ket{1_D} (sign −-), so it carries ∣Φ−⟩BC(∣0A0D⟩−∣1A1D⟩)\ket{\Phi^-}_{BC}\left(\ket{0_A0_D}-\ket{1_A1_D}\right).
  • ∣Ψ+⟩BC\ket{\Psi^+}_{BC} appears in the second bracket with ∣0A⟩…∣1D⟩\ket{0_A}\ldots\ket{1_D} (sign ++) and in the third with ∣1A⟩…∣0D⟩\ket{1_A}\ldots\ket{0_D} (sign ++), which gives ∣Ψ+⟩BC(∣0A1D⟩+∣1A0D⟩)\ket{\Psi^+}_{BC}\left(\ket{0_A1_D}+\ket{1_A0_D}\right).
  • ∣Ψ−⟩BC\ket{\Psi^-}_{BC} appears in the second bracket with ∣0A⟩…∣1D⟩\ket{0_A}\ldots\ket{1_D} (sign ++) and in the third with ∣1A⟩…∣0D⟩\ket{1_A}\ldots\ket{0_D} (sign −-); the result is ∣Ψ−⟩BC(∣0A1D⟩−∣1A0D⟩)\ket{\Psi^-}_{BC}\left(\ket{0_A1_D}-\ket{1_A0_D}\right).

Writing 122\frac{1}{2\sqrt{2}} as 12⋅12\frac{1}{2}\cdot\frac{1}{\sqrt{2}} and giving the 12\frac{1}{\sqrt{2}} to each ADAD part:

∣ψ⟩=12(∣Φ+⟩BC∣0A0D⟩+∣1A1D⟩2+∣Φ−⟩BC∣0A0D⟩−∣1A1D⟩2+∣Ψ+⟩BC∣0A1D⟩+∣1A0D⟩2+∣Ψ−⟩BC∣0A1D⟩−∣1A0D⟩2)\begin{align*} \ket{\psi}=\frac{1}{2}\Big( &\ket{\Phi^+}_{BC}\frac{\ket{0_A0_D}+\ket{1_A1_D}}{\sqrt{2}} +\ket{\Phi^-}_{BC}\frac{\ket{0_A0_D}-\ket{1_A1_D}}{\sqrt{2}}\\ +&\ket{\Psi^+}_{BC}\frac{\ket{0_A1_D}+\ket{1_A0_D}}{\sqrt{2}} +\ket{\Psi^-}_{BC}\frac{\ket{0_A1_D}-\ket{1_A0_D}}{\sqrt{2}} \Big) \end{align*}

Compare each ADAD part with the definitions of the Bell states. They are the Bell states themselves, now on AA and DD:

∣ψ⟩=12(∣Φ+⟩BC∣Φ+⟩AD+∣Φ−⟩BC∣Φ−⟩AD+∣Ψ+⟩BC∣Ψ+⟩AD+∣Ψ−⟩BC∣Ψ−⟩AD)\ket{\psi}=\frac{1}{2}\left( \ket{\Phi^+}_{BC}\ket{\Phi^+}_{AD} +\ket{\Phi^-}_{BC}\ket{\Phi^-}_{AD} +\ket{\Psi^+}_{BC}\ket{\Psi^+}_{AD} +\ket{\Psi^-}_{BC}\ket{\Psi^-}_{AD} \right)

We have not done anything to the qubits yet. This is the same state as before, written differently. Yet it already says everything: whichever Bell state Bob and Carol find on BCBC, Alice and Dave are left holding the matching Bell state on ADAD. Each of the four terms has amplitude 12\frac{1}{2} in front of states of length 11, so, by the Born rule, each outcome has probability ∣12∣2=14\left|\frac{1}{2}\right|^2=\frac{1}{4}, and the four probabilities add up to 11.

How do Bob and Carol measure "in the Bell basis"? In The four Bell states , we saw that running the Bell circuit backwards, a CNOT from BB to CC followed by HH on BB, takes each Bell state back to the basis state it came from. Reading the table there from right to left, with BB as the first qubit and CC as the second, ∣Φ+⟩→∣00⟩\ket{\Phi^+}\to\ket{00}, ∣Ψ+⟩→∣01⟩\ket{\Psi^+}\to\ket{01}, ∣Φ−⟩→∣10⟩\ket{\Phi^-}\to\ket{10} and ∣Ψ−⟩→∣11⟩\ket{\Psi^-}\to\ket{11}. Bob and Carol then measure BB and CC normally and obtain two bits, mBm_B and mCm_C:

Bell state of BCBC (mB,mC)(m_B, m_C) State of ADAD Dave's correction
∣Φ+⟩\ket{\Phi^+} (0,0)(0,0) ∣Φ+⟩\ket{\Phi^+} none
∣Φ−⟩\ket{\Phi^-} (1,0)(1,0) ∣Φ−⟩\ket{\Phi^-} ZZ
∣Ψ+⟩\ket{\Psi^+} (0,1)(0,1) ∣Ψ+⟩\ket{\Psi^+} XX
∣Ψ−⟩\ket{\Psi^-} (1,1)(1,1) ∣Ψ−⟩\ket{\Psi^-} XX, then ZZ

If Alice and Dave want ∣Φ+⟩\ket{\Phi^+} every time, Bob and Carol phone Dave with the two bits, and Dave applies the correction in the last column to his qubit. Recall that XX swaps ∣0⟩\ket{0} and ∣1⟩\ket{1}, while ZZ leaves ∣0⟩\ket{0} alone and changes ∣1⟩\ket{1} into −∣1⟩-\ket{1}. Each row can then be checked:

∣Φ−⟩AD=∣0A0D⟩−∣1A1D⟩2→Z on D∣0A0D⟩−(−∣1A1D⟩)2=∣0A0D⟩+∣1A1D⟩2∣Ψ+⟩AD=∣0A1D⟩+∣1A0D⟩2→X on D∣0A0D⟩+∣1A1D⟩2∣Ψ−⟩AD=∣0A1D⟩−∣1A0D⟩2→X on D∣0A0D⟩−∣1A1D⟩2→Z on D∣0A0D⟩+∣1A1D⟩2\begin{align*} \ket{\Phi^-}_{AD}=\frac{\ket{0_A0_D}-\ket{1_A1_D}}{\sqrt{2}} &\xrightarrow{Z\text{ on }D} \frac{\ket{0_A0_D}-(-\ket{1_A1_D})}{\sqrt{2}}=\frac{\ket{0_A0_D}+\ket{1_A1_D}}{\sqrt{2}}\\ \ket{\Psi^+}_{AD}=\frac{\ket{0_A1_D}+\ket{1_A0_D}}{\sqrt{2}} &\xrightarrow{X\text{ on }D} \frac{\ket{0_A0_D}+\ket{1_A1_D}}{\sqrt{2}}\\ \ket{\Psi^-}_{AD}=\frac{\ket{0_A1_D}-\ket{1_A0_D}}{\sqrt{2}} &\xrightarrow{X\text{ on }D} \frac{\ket{0_A0_D}-\ket{1_A1_D}}{\sqrt{2}} \xrightarrow{Z\text{ on }D} \frac{\ket{0_A0_D}+\ket{1_A1_D}}{\sqrt{2}} \end{align*}

Every row ends in ∣Φ+⟩AD\ket{\Phi^+}_{AD}. Notice that XX is needed exactly when mC=1m_C=1, and ZZ exactly when mB=1m_B=1. These are the gates "XX if mC=1m_C=1" and "ZZ if mB=1m_B=1" in the circuit above, applied in that order.

This verifies the protocol. Notice the phone call. Without the two bits, Dave cannot tell which of the four Bell states he shares with Alice, so nothing travels faster than light, just as we said earlier.

Why should anyone care? Entanglement fades over long optical fibres, so it cannot be sent directly across a continent. With swapping, short entangled links can be joined end to end, with a measurement at each junction, into one long link. Devices that do this are called quantum repeaters (Briegel, H.-J. et al., 1998). The first experiment, in 1998, swapped entanglement between photons that had never interacted (Pan, J.-W. et al., 1998).

Check

check.py
python
import cirq
import numpy as np
​
A, B, C, D = cirq.LineQubit.range(4)
​
circuit = cirq.Circuit(
cirq.H(A), cirq.CNOT(A, B), # Bell pair |Phi+> on A, B
cirq.H(C), cirq.CNOT(C, D), # Bell pair |Phi+> on C, D
cirq.CNOT(B, C), cirq.H(B), # Bell circuit run backwards on B, C
cirq.measure(B, key="mB"), cirq.measure(C, key="mC"),
cirq.X(D).with_classical_controls("mC"), # Dave's corrections
cirq.Z(D).with_classical_controls("mB"),
)
​
phi_plus = np.array([1, 0, 0, 1]) / np.sqrt(2)
seen = set()
for seed in range(40):
result = cirq.Simulator(seed=seed).simulate(circuit)
m_b, m_c = int(result.measurements["mB"][0]), int(result.measurements["mC"][0])
​
# Read off the state of A and D for this measurement outcome
state = result.final_state_vector.reshape(2, 2, 2, 2) # indices: A, B, C, D
ad = state[:, m_b, m_c, :].reshape(4)
​
# Equal to |Phi+> up to a global phase
assert np.isclose(abs(np.vdot(phi_plus, ad)), 1)
seen.add((m_b, m_c))
​
print("A and D share |Phi+> for every outcome (mB, mC):", sorted(seen))

Does the entanglement-swapping protocol generalize to the case where ABAB is an arbitrary entangled state? Prove or disprove.

Solution

Let AA and BB start in any two-qubit state:

∣ψ⟩AB=α∣0A0B⟩+β∣0A1B⟩+γ∣1A0B⟩+δ∣1A1B⟩\ket{\psi}_{AB}=\alpha\ket{0_A0_B}+\beta\ket{0_A1_B}+\gamma\ket{1_A0_B}+\delta\ket{1_A1_B}

where the complex numbers α\alpha, β\beta, γ\gamma and δ\delta satisfy ∣α∣2+∣β∣2+∣γ∣2+∣δ∣2=1|\alpha|^2+|\beta|^2+|\gamma|^2+|\delta|^2=1 (Born, M., 1926). CC and DD are still the Bell pair ∣Φ+⟩CD=∣0C0D⟩+∣1C1D⟩2\ket{\Phi^+}_{CD}=\frac{\ket{0_C0_D}+\ket{1_C1_D}}{\sqrt{2}}. We follow exactly the steps of Q4, only with more bookkeeping.

First, the tensor product. Each of the four terms of ∣ψ⟩AB\ket{\psi}_{AB} is multiplied by each of the two terms of ∣Φ+⟩CD\ket{\Phi^+}_{CD}, which gives 4×2=84\times2=8 terms, all sharing the factor 12\frac{1}{\sqrt{2}}. For example, α∣0A0B⟩⊗∣1C1D⟩=α∣0A0B1C1D⟩\alpha\ket{0_A0_B}\otimes\ket{1_C1_D}=\alpha\ket{0_A0_B1_C1_D}. As in Q4, we write each term with BCBC in the middle; this one becomes α∣0A⟩∣01⟩BC∣1D⟩\alpha\ket{0_A}\ket{01}_{BC}\ket{1_D}. All eight are:

∣ψ⟩AB⊗∣Φ+⟩CD=12(α∣0A⟩∣00⟩BC∣0D⟩+α∣0A⟩∣01⟩BC∣1D⟩+β∣0A⟩∣10⟩BC∣0D⟩+β∣0A⟩∣11⟩BC∣1D⟩+γ∣1A⟩∣00⟩BC∣0D⟩+γ∣1A⟩∣01⟩BC∣1D⟩+δ∣1A⟩∣10⟩BC∣0D⟩+δ∣1A⟩∣11⟩BC∣1D⟩)\begin{align*} \ket{\psi}_{AB}\otimes\ket{\Phi^+}_{CD}=\frac{1}{\sqrt{2}}\Big( &\alpha\ket{0_A}\ket{00}_{BC}\ket{0_D}+\alpha\ket{0_A}\ket{01}_{BC}\ket{1_D} +\beta\ket{0_A}\ket{10}_{BC}\ket{0_D}+\beta\ket{0_A}\ket{11}_{BC}\ket{1_D}\\ +&\gamma\ket{1_A}\ket{00}_{BC}\ket{0_D}+\gamma\ket{1_A}\ket{01}_{BC}\ket{1_D} +\delta\ket{1_A}\ket{10}_{BC}\ket{0_D}+\delta\ket{1_A}\ket{11}_{BC}\ket{1_D} \Big) \end{align*}

It helps to sort these eight terms by the value of BCBC. Reading them off:

BCBC Terms (without the BCBC part)
∣00⟩\ket{00} α∣0A0D⟩\alpha\ket{0_A0_D} and γ∣1A0D⟩\gamma\ket{1_A0_D}
∣01⟩\ket{01} α∣0A1D⟩\alpha\ket{0_A1_D} and γ∣1A1D⟩\gamma\ket{1_A1_D}
∣10⟩\ket{10} β∣0A0D⟩\beta\ket{0_A0_D} and δ∣1A0D⟩\delta\ket{1_A0_D}
∣11⟩\ket{11} β∣0A1D⟩\beta\ket{0_A1_D} and δ∣1A1D⟩\delta\ket{1_A1_D}

Next, we replace each ∣xy⟩BC\ket{xy}_{BC} with Bell states, using the same four results as in Q4:

∣00⟩=∣Φ+⟩+∣Φ−⟩2,∣01⟩=∣Ψ+⟩+∣Ψ−⟩2,∣10⟩=∣Ψ+⟩−∣Ψ−⟩2,∣11⟩=∣Φ+⟩−∣Φ−⟩2\ket{00}=\frac{\ket{\Phi^+}+\ket{\Phi^-}}{\sqrt{2}},\qquad \ket{01}=\frac{\ket{\Psi^+}+\ket{\Psi^-}}{\sqrt{2}},\qquad \ket{10}=\frac{\ket{\Psi^+}-\ket{\Psi^-}}{\sqrt{2}},\qquad \ket{11}=\frac{\ket{\Phi^+}-\ket{\Phi^-}}{\sqrt{2}}

These four lines tell us exactly where each Bell state comes from, and with which sign:

  • ∣Φ+⟩\ket{\Phi^+} comes from ∣00⟩\ket{00} (sign ++) and from ∣11⟩\ket{11} (sign ++);
  • ∣Φ−⟩\ket{\Phi^-} comes from ∣00⟩\ket{00} (sign ++) and from ∣11⟩\ket{11} (sign −-);
  • ∣Ψ+⟩\ket{\Psi^+} comes from ∣01⟩\ket{01} (sign ++) and from ∣10⟩\ket{10} (sign ++);
  • ∣Ψ−⟩\ket{\Psi^-} comes from ∣01⟩\ket{01} (sign ++) and from ∣10⟩\ket{10} (sign −-).

Every replacement also brings a 12\frac{1}{\sqrt{2}}, which joins the 12\frac{1}{\sqrt{2}} already in front: 12⋅12=12\frac{1}{\sqrt{2}}\cdot\frac{1}{\sqrt{2}}=\frac{1}{2}. So, to collect, for example, all the ∣Φ+⟩BC\ket{\Phi^+}_{BC} terms, we take the ∣00⟩\ket{00} row of the table and the ∣11⟩\ket{11} row, both with a plus sign. To collect the ∣Φ−⟩BC\ket{\Phi^-}_{BC} terms, we take the ∣00⟩\ket{00} row with a plus sign and the ∣11⟩\ket{11} row with a minus sign, and so on:

∣Φ+⟩BC:12(α∣0A0D⟩+γ∣1A0D⟩⏟from ∣00⟩ +β∣0A1D⟩+δ∣1A1D⟩⏟from ∣11⟩)∣Φ−⟩BC:12(α∣0A0D⟩+γ∣1A0D⟩⏟from ∣00⟩ −β∣0A1D⟩−δ∣1A1D⟩⏟from ∣11⟩)∣Ψ+⟩BC:12(α∣0A1D⟩+γ∣1A1D⟩⏟from ∣01⟩ +β∣0A0D⟩+δ∣1A0D⟩⏟from ∣10⟩)∣Ψ−⟩BC:12(α∣0A1D⟩+γ∣1A1D⟩⏟from ∣01⟩ −β∣0A0D⟩−δ∣1A0D⟩⏟from ∣10⟩)\begin{align*} \ket{\Phi^+}_{BC}&:\quad \frac{1}{2}\Big(\underbrace{\alpha\ket{0_A0_D}+\gamma\ket{1_A0_D}}_{\text{from }\ket{00}}\ \underbrace{+\beta\ket{0_A1_D}+\delta\ket{1_A1_D}}_{\text{from }\ket{11}}\Big)\\ \ket{\Phi^-}_{BC}&:\quad \frac{1}{2}\Big(\underbrace{\alpha\ket{0_A0_D}+\gamma\ket{1_A0_D}}_{\text{from }\ket{00}}\ \underbrace{-\beta\ket{0_A1_D}-\delta\ket{1_A1_D}}_{\text{from }\ket{11}}\Big)\\ \ket{\Psi^+}_{BC}&:\quad \frac{1}{2}\Big(\underbrace{\alpha\ket{0_A1_D}+\gamma\ket{1_A1_D}}_{\text{from }\ket{01}}\ \underbrace{+\beta\ket{0_A0_D}+\delta\ket{1_A0_D}}_{\text{from }\ket{10}}\Big)\\ \ket{\Psi^-}_{BC}&:\quad \frac{1}{2}\Big(\underbrace{\alpha\ket{0_A1_D}+\gamma\ket{1_A1_D}}_{\text{from }\ket{01}}\ \underbrace{-\beta\ket{0_A0_D}-\delta\ket{1_A0_D}}_{\text{from }\ket{10}}\Big) \end{align*}

Rearranging each bracket into the order α\alpha, β\beta, γ\gamma, δ\delta, the whole state becomes:

∣ψ⟩AB⊗∣Φ+⟩CD=12(∣Φ+⟩BC∣ϕ+⟩AD+∣Φ−⟩BC∣ϕ−⟩AD+∣Ψ+⟩BC∣χ+⟩AD+∣Ψ−⟩BC∣χ−⟩AD)\ket{\psi}_{AB}\otimes\ket{\Phi^+}_{CD}=\frac{1}{2}\Big( \ket{\Phi^+}_{BC}\ket{\phi^+}_{AD} +\ket{\Phi^-}_{BC}\ket{\phi^-}_{AD} +\ket{\Psi^+}_{BC}\ket{\chi^+}_{AD} +\ket{\Psi^-}_{BC}\ket{\chi^-}_{AD}\Big)

where:

∣ϕ+⟩AD=α∣0A0D⟩+β∣0A1D⟩+γ∣1A0D⟩+δ∣1A1D⟩∣ϕ−⟩AD=α∣0A0D⟩−β∣0A1D⟩+γ∣1A0D⟩−δ∣1A1D⟩∣χ+⟩AD=α∣0A1D⟩+β∣0A0D⟩+γ∣1A1D⟩+δ∣1A0D⟩∣χ−⟩AD=α∣0A1D⟩−β∣0A0D⟩+γ∣1A1D⟩−δ∣1A0D⟩\begin{align*} \ket{\phi^+}_{AD}&=\alpha\ket{0_A0_D}+\beta\ket{0_A1_D}+\gamma\ket{1_A0_D}+\delta\ket{1_A1_D}\\ \ket{\phi^-}_{AD}&=\alpha\ket{0_A0_D}-\beta\ket{0_A1_D}+\gamma\ket{1_A0_D}-\delta\ket{1_A1_D}\\ \ket{\chi^+}_{AD}&=\alpha\ket{0_A1_D}+\beta\ket{0_A0_D}+\gamma\ket{1_A1_D}+\delta\ket{1_A0_D}\\ \ket{\chi^-}_{AD}&=\alpha\ket{0_A1_D}-\beta\ket{0_A0_D}+\gamma\ket{1_A1_D}-\delta\ket{1_A0_D} \end{align*}

Look at the first one. ∣ϕ+⟩AD\ket{\phi^+}_{AD} is ∣ψ⟩\ket{\psi} itself, with DD in the place of BB! Each of the four states has length 11, because its squared amplitudes are ∣α∣2|\alpha|^2, ∣±β∣2=∣β∣2|\pm\beta|^2=|\beta|^2, ∣γ∣2|\gamma|^2 and ∣±δ∣2=∣δ∣2|\pm\delta|^2=|\delta|^2, which add up to 11. So, as in Q4, each outcome has probability ∣12∣2=14\left|\frac{1}{2}\right|^2=\frac{1}{4}.

If Bob and Carol find ∣Φ+⟩BC\ket{\Phi^+}_{BC}, Alice and Dave already hold the original state. The other three are close relatives, and Dave's corrections from Q4 repair them. Recall that ZZ on DD changes the sign of every term where DD is 11, and XX on DD swaps 0D0_D and 1D1_D in every term:

∣ϕ−⟩AD→Z on Dα∣0A0D⟩+β∣0A1D⟩+γ∣1A0D⟩+δ∣1A1D⟩∣χ+⟩AD→X on Dα∣0A0D⟩+β∣0A1D⟩+γ∣1A0D⟩+δ∣1A1D⟩∣χ−⟩AD→X on Dα∣0A0D⟩−β∣0A1D⟩+γ∣1A0D⟩−δ∣1A1D⟩→Z on Dα∣0A0D⟩+β∣0A1D⟩+γ∣1A0D⟩+δ∣1A1D⟩\begin{align*} \ket{\phi^-}_{AD} &\xrightarrow{Z\text{ on }D} \alpha\ket{0_A0_D}+\beta\ket{0_A1_D}+\gamma\ket{1_A0_D}+\delta\ket{1_A1_D}\\ \ket{\chi^+}_{AD} &\xrightarrow{X\text{ on }D} \alpha\ket{0_A0_D}+\beta\ket{0_A1_D}+\gamma\ket{1_A0_D}+\delta\ket{1_A1_D}\\ \ket{\chi^-}_{AD} &\xrightarrow{X\text{ on }D} \alpha\ket{0_A0_D}-\beta\ket{0_A1_D}+\gamma\ket{1_A0_D}-\delta\ket{1_A1_D} \xrightarrow{Z\text{ on }D} \alpha\ket{0_A0_D}+\beta\ket{0_A1_D}+\gamma\ket{1_A0_D}+\delta\ket{1_A1_D} \end{align*}

In the first line, the terms with 1D1_D were −β-\beta and −δ-\delta, and ZZ turns them into +β+\beta and +δ+\delta. In the second, swapping 0D0_D and 1D1_D moves each amplitude to its proper place. The third combines the two.

∴\therefore Once Bob and Carol have measured and Dave has corrected, AA and DD are always in:

α∣0A0D⟩+β∣0A1D⟩+γ∣1A0D⟩+δ∣1A1D⟩\alpha\ket{0_A0_D}+\beta\ket{0_A1_D}+\gamma\ket{1_A0_D}+\delta\ket{1_A1_D}

which is the original state of ABAB, now living on ADAD. The protocol does generalize. In fact, it generalizes further than the question asks: the proof never used the fact that ∣ψ⟩AB\ket{\psi}_{AB} was entangled. What the protocol really does is teleport BB's part of the state onto DD (Bennett, C. H. et al., 1993). If AA and BB are entangled, the entanglement goes along. Otherwise, BB's state is simply teleported to Dave. As a special case, taking α=δ=12\alpha=\delta=\frac{1}{\sqrt{2}} and β=γ=0\beta=\gamma=0 gives back Q4.

Check

check.py
python
import cirq
import numpy as np
​
A, B, C, D = cirq.LineQubit.range(4)
​
# A random two-qubit state for A and B
rng = np.random.default_rng(2026)
psi = rng.normal(size=4) + 1j * rng.normal(size=4)
psi /= np.linalg.norm(psi)
​
circuit = cirq.Circuit(
cirq.StatePreparationChannel(psi).on(A, B), # arbitrary state on A, B
cirq.H(C), cirq.CNOT(C, D), # Bell pair |Phi+> on C, D
cirq.CNOT(B, C), cirq.H(B), # Bell measurement on B, C
cirq.measure(B, key="mB"), cirq.measure(C, key="mC"),
cirq.X(D).with_classical_controls("mC"), # Dave's corrections
cirq.Z(D).with_classical_controls("mB"),
)
​
seen = set()
for seed in range(40):
result = cirq.Simulator(seed=seed).simulate(circuit)
m_b, m_c = int(result.measurements["mB"][0]), int(result.measurements["mC"][0])
​
state = result.final_state_vector.reshape(2, 2, 2, 2) # indices: A, B, C, D
ad = state[:, m_b, m_c, :].reshape(4)
​
# A and D now hold the original state of A and B (up to a global phase)
assert np.isclose(abs(np.vdot(psi, ad)), 1)
seen.add((m_b, m_c))
​
print("A and D hold the original AB state for every outcome (mB, mC):", sorted(seen))

Enjoyed this article? I'm a Software Engineer and Technical Writer actively seeking new opportunities to impact and learn, particularly in areas related to web security, finance, healthcare, and education. If you think my expertise aligns with your team's needs, let's chat! You can find me on LinkedIn and X . I am also an email away.