Quantum Computation

Fourteen modules, from a single qubit to quantum key distribution, each taught in the format that fits it best. Click gates onto a Bloch sphere, build circuits, run Bell tests and Grover search, watch noise shrink a state, then check yourself with concept questions and practice problems.

Follows the chapter order of M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, 10th Anniversary Edition (Cambridge University Press, 2010), and covers all twelve chapters; Chapters 1 and 2 get two modules each. Chapter numbers refer to that book; the questions and examples here are written for this page. Exercises from the book appear at the end of each module, with their numbers from the book and their statements restated in our own words.

InteractiveNielsen–Chuang, Ch. 1: Introduction and overview

Qubits and the Bloch sphere

A qubit's state is a pair of complex numbers. Throw away the overall phase, which no experiment can see, and what is left is a point on a sphere. Every single-qubit gate is then a rotation of that sphere, and you can watch each one turn the state.

The idea

Qubit. A unit vector |ψ⟩=α|0⟩+β|1⟩ in C2, with |α|2+|β|2=1. Measuring in the computational basis gives 0 with probability |α|2 and 1 with probability |β|2.
Bloch sphere. The states |ψ⟩ and eiγ|ψ⟩ give the same probabilities for every measurement, so up to this global phase every qubit state can be written
|ψ⟩=cos⁑θ2|0⟩+eiΟ†sin⁑θ2|1⟩,rβ†’=(sin⁑θcos⁑φ,Β sin⁑θsin⁑φ,Β cos⁑θ).

|0⟩ is the north pole, |1⟩ the south pole, and |±⟩=(|0⟩±|1⟩)/2 and |±i⟩=(|0⟩±i|1⟩)/2 sit on the equator along ±x and ±y. The common gates are

X=(0110),Β Y=(0βˆ’ii0),Β Z=(100βˆ’1),Β H=12(111βˆ’1),Β S=(100i),Β T=(100eiΟ€/4).
Gates are rotations. For a real unit vector n^, Rn^(ΞΈ)=eβˆ’iΞΈn^β‹…Οƒβ†’/2=cos⁑θ2Iβˆ’isin⁑θ2(n^β‹…Οƒβ†’) rotates the Bloch vector by ΞΈ about n^. Every one-qubit unitary is eiΞ³Rn^(ΞΈ) for some Ξ³,n^,ΞΈ. For example X is a half turn about x, H a half turn about (x+z)/2, S a quarter turn about z, and T an eighth of a turn about z.
Angles double. Orthogonal states are antipodal on the sphere, not perpendicular: the angle between Bloch vectors is twice the angle between the state vectors.

Explore

the state r→ path of the last gate its rotation axis · drag to turn the sphere
Start from
Apply a gate

Worked example

Find the rotation performed by the gate SH (first H, then S), and what happens if you apply it three times.

  1. Where does H send the three Bloch axes x, y, z?

    H is a half turn about (x+z)/2. A half turn swaps the two axes symmetric about its axis and reverses the one perpendicular to it: x↦z, z↦x, yβ†¦βˆ’y. Check: H|0⟩=|+⟩ and H|+i⟩=eiΟ€/4|βˆ’i⟩.

  2. And S?

    A quarter turn counterclockwise about z: x↦y, yβ†¦βˆ’x, z↦z. Indeed S|+⟩=(|0⟩+i|1⟩)/2=|+i⟩.

  3. Compose them. What does SH do to the axes, and what rotation is that?

    x↦z↦z, Β yβ†¦βˆ’y↦x, Β z↦x↦y. So SH cycles zβ†’yβ†’xβ†’z. A rotation that permutes the axes cyclically fixes the diagonal (1,1,1)/3 and turns by a third of a full turn. The cycle xβ†’yβ†’z is +2Ο€/3 about that axis, so ours, the reverse cycle, is

    SH=eiΞ³Rn^(βˆ’2Ο€/3),n^=13(1,1,1).
  4. Try it in the explorer: start at |0⟩ and press H, S three times over. Then compute (SH)3 exactly.

    The state goes |0βŸ©β†’|+iβŸ©β†’|+βŸ©β†’|0⟩ on the sphere, as the cycle predicts. Three thirds of a turn is the identity rotation, so (SH)3 is a multiple of I. Multiplying the matrices gives

    (SH)3=eiΟ€/4I.

    The phase eiΟ€/4 is global, so it is invisible, but the amplitudes shown in the explorer do carry it.

Check your understanding

Which pair of states can be told apart by some measurement (given many copies)?

  1. |0⟩+|1⟩ and βˆ’|0βŸ©βˆ’|1⟩ (normalised)These differ by the global factor βˆ’1. Every probability |βŸ¨Ο•|ψ⟩|2 is unchanged by a global phase.
  2. |0⟩+|1⟩ and |0βŸ©βˆ’|1⟩ (normalised)
  3. |1⟩ and i|1⟩i multiplies the whole state, so it is a global phase.
A relative phase between |0⟩ and |1⟩ moves the Bloch vector around the equator: |+⟩ and |βˆ’βŸ© are antipodal, and a measurement in the X basis tells them apart with certainty. A global phase doesn't move the Bloch vector at all.

What is T8?

  1. Exactly I
  2. βˆ’I: eight eighth-turns make a full turn, and Rz(2Ο€)=βˆ’IRz(2Ο€) is indeed βˆ’I, but T is Rz(Ο€/4) times the phase eiΟ€/8, and that phase also gets raised to the 8th power.
  3. ZT2=S and S2=Z, so Z is T4. Keep going.
T=diag(1,eiΟ€/4), so T8=diag(1,e2Ο€i)=I. As a rotation, T8=eiΟ€Rz(2Ο€)=(βˆ’1)(βˆ’I)=I. The sign of a full rotation and the global phase cancel.

The Bloch vectors of two pure states make an angle of 90∘. What is |βŸ¨Ο•|ψ⟩|2?

  1. 0Orthogonal states are antipodal (180∘ apart), not perpendicular.
  2. 1/2
  3. 1/2That's |βŸ¨Ο•|ψ⟩|, before squaring.
For pure states |βŸ¨Ο•|ψ⟩|2=(1+rβ†’β‹…sβ†’)/2. At 90∘, rβ†’β‹…sβ†’=0, giving 1/2. Example: |0⟩ and |+⟩.

Practice

Locate a stateFrom amplitudes to the Bloch vector

Find the Bloch vector of |ψ⟩=(|0⟩+(1+i)|1⟩)/3.

Hint

For Ξ±|0⟩+Ξ²|1⟩, the Bloch vector is (2Re(Ξ±Β―Ξ²),Β 2Im(Ξ±Β―Ξ²),Β |Ξ±|2βˆ’|Ξ²|2).

Solution

Ξ±Β―Ξ²=(1+i)/3, so x=y=2/3, and z=1/3βˆ’2/3=βˆ’1/3. Check: 4/9+4/9+1/9=1. The state is just below the equator, halfway between +x and +y.

A square root of NOTRotations by half the angle

Find a unitary V with V2=X, and describe it on the Bloch sphere.

Hint

X is a half turn about x, so try a quarter turn about x, and fix the phase afterwards.

Solution

Rx(Ο€/2)2=Rx(Ο€)=βˆ’iX. Multiplying by eiΟ€/4 fixes the phase, since (eiΟ€/4)2(βˆ’i)=1:

V=eiΟ€/4Rx(Ο€/2)=12(1+i1βˆ’i1βˆ’i1+i),V2=X.

On the sphere V is a quarter turn about x. (Rx in the explorer with ΞΈ = Ο€/2 does the same rotation, with a different global phase.)

From Nielsen and Chuang, Quantum Computation and Quantum Information (10th anniversary ed., Cambridge, 2010)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 4.1Where the Pauli eigenvectors sit

Find the normalized eigenvectors of X, Y and Z, and mark the point on the Bloch sphere for each one.

Hint

The +1 eigenvector of n^β‹…Οƒβ†’ has Bloch vector n^. Or compute directly: Ξ±|0⟩+Ξ²|1⟩ sits at (2Re(Ξ±Β―Ξ²),2Im(Ξ±Β―Ξ²),|Ξ±|2βˆ’|Ξ²|2).

Solution

Z: |0⟩ (eigenvalue +1) is the north pole (0,0,1); |1⟩ (eigenvalue βˆ’1) is the south pole.

X: |±⟩=(|0⟩±|1⟩)/2 with eigenvalues ±1; here α¯β=±12, so they sit at (±1,0,0).

Y: (|0⟩±i|1⟩)/2 with eigenvalues ±1; α¯β=±i2, so they sit at (0,±1,0).

In every case the +1 eigenvector lies on the positive axis of its own Pauli matrix and the βˆ’1 eigenvector on the negative one.

Exercise 4.4The Hadamard gate from rotations

Write H as a product of Rx and Rz rotations times a global phase eiφ.

Hint

On the sphere H is a half turn about the axis (x^+z^)/2. Try a quarter turn about z, a quarter turn about x, and another quarter turn about z.

Solution
H=eiΟ€/2Rz(Ο€/2)Rx(Ο€/2)Rz(Ο€/2).

Check by multiplying: Rz(Ο€/2)=eβˆ’iΟ€/4diag(1,i) and Rx(Ο€/2)=12(1βˆ’iβˆ’i1). The product of the three rotations is βˆ’i2(111βˆ’1), and the factor eiΟ€/2=i removes the βˆ’i.

Geometrically: the first quarter turn about z sends +x to +y; the quarter turn about x sends +y to +z; the last turn about z leaves +z alone. Net effect +x↦+z, and similarly +z↦+x, +yβ†¦βˆ’y: exactly H.

Exercise 4.6Why Rn^(ΞΈ) deserves the name rotation

Let a qubit have Bloch vector Ξ»β†’, so ρ=(I+Ξ»β†’β‹…Οƒβ†’)/2. Prove that Rn^(ΞΈ)ρRn^(ΞΈ)† has Bloch vector Ξ»β†’ rotated by ΞΈ about n^. (This explains the factor 1/2 in Rn^(ΞΈ)=eβˆ’iΞΈn^β‹…Οƒβ†’/2.)

Hint

Split Ξ»β†’ into a part along n^ and a part mβ†’βŸ‚n^. Use that n^β‹…Οƒβ†’ commutes with itself and anticommutes with mβ†’β‹…Οƒβ†’, and that (aβ†’β‹…Οƒβ†’)(bβ†’β‹…Οƒβ†’)=(aβ†’β‹…bβ†’)I+i(aβ†’Γ—bβ†’)β‹…Οƒβ†’.

Solution

Write R=cIβˆ’isN with N=n^β‹…Οƒβ†’, c=cos⁑θ2, s=sin⁑θ2. It suffices to compute R(vβ†’β‹…Οƒβ†’)R† for each vector vβ†’.

If vβ†’=n^, N commutes with R, so RNR†=N: the axis is fixed.

If mβ†’βŸ‚n^, set M=mβ†’β‹…Οƒβ†’. Then NM=βˆ’MN, so RM=M(cI+isN) and

RMR†=M(cI+isN)2=M(cos⁑θI+isin⁑θN)=cos⁑θM+isin⁑θMN.

Since mβ†’β‹…n^=0, MN=i(mβ†’Γ—n^)β‹…Οƒβ†’, so isin⁑θMN=sin⁑θ(n^Γ—mβ†’)β‹…Οƒβ†’. Hence m→↦cos⁑θmβ†’+sin⁑θn^Γ—mβ†’, which is the right-handed rotation by ΞΈ about n^.

By linearity, R(Ξ»β†’β‹…Οƒβ†’)R†=(RΞ»β†’)β‹…Οƒβ†’ with R that rotation, and RIR†=I. The half angle appears because R acts on both sides of ρ.

Animated lessonNielsen–Chuang, Ch. 1: Introduction and overview

Bell states and teleportation

With one shared entangled pair and two classical bits, Alice can hand Bob an unknown qubit without ever learning what it is. The animation follows the state through the circuit and shows, at each moment, what Bob would hold for each result Alice could get.

The idea

Two qubits. The state space is C2βŠ—C2β‰…C4, with basis |00⟩,|01⟩,|10⟩,|11⟩. A state is a product if it equals |aβŸ©βŠ—|b⟩, and entangled otherwise.
Bell states. H on the first qubit followed by a CNOT turns |xy⟩ into
|Ξ²xy⟩=|0y⟩+(βˆ’1)x|1y¯⟩2:|Ξ²00⟩=|00⟩+|11⟩2,Β |Ξ²01⟩=|01⟩+|10⟩2,Β |Ξ²10⟩=|00βŸ©βˆ’|11⟩2,Β |Ξ²11⟩=|01βŸ©βˆ’|10⟩2.
No cloning. No unitary sends |ψ⟩|0βŸ©β†¦|ψ⟩|ψ⟩ for every |ψ⟩: it would have to preserve inner products, but βŸ¨Ο•|ψ⟩ and βŸ¨Ο•|ψ⟩2 differ unless the states are equal or orthogonal. So a teleported qubit cannot also stay with Alice.
Teleportation identity. If Alice holds |ψ⟩ and shares |β00⟩ with Bob, then after Alice applies CNOT (her two qubits) and H (her first qubit),
|ψ⟩|Ξ²00⟩ ⟼ 12βˆ‘m1,m2∈{0,1}|m1m2βŸ©βŠ—Xm2Zm1|ψ⟩.

Alice measures, gets m1m2 with probability 1/4 whatever |ψ⟩ is, and sends the two bits. Bob applies Xm2 then Zm1 and holds |ψ⟩.

Nothing travels faster than light. Until the bits arrive, Bob's qubit is an equal mixture of the four branches, which is the state I/2 for every |ψ⟩.

Watch

Alice's unknown state
Alice's measurement result
Top: the circuit, Alice's two qubits above and Bob's below. Bottom: Bob's qubit in each branch m1m2, that is, what he would hold if Alice measured now. Bob's state Alice's |ψ⟩, for comparison
  1. Alice holds an unknown qubit |ψ⟩. Two more qubits start in |0⟩. No branch shows |ψ⟩ on Bob's side yet.
  2. H and CNOT make the Bell pair |β00⟩. Alice keeps one half, Bob takes the other.
  3. Alice applies CNOT from |ψ⟩ to her half of the pair. Bob's branches are now |0⟩ or |1⟩: only the amplitudes' sizes have moved, not the phase.
  4. Alice applies H to her first qubit. Every branch is now equally likely and holds |ψ⟩ up to a Pauli: Xm2Zm1|ψ⟩.
  5. Alice measures and gets m1m2. The other branches vanish; Bob holds Xm2Zm1|ψ⟩ but doesn't yet know which.
  6. The two bits reach Bob. He applies Xm2, then Zm1, and now holds exactly |ψ⟩. Alice's copy is gone.

Worked example

Suppose Alice and Bob share |Ξ²11⟩=(|01βŸ©βˆ’|10⟩)/2 instead of |Ξ²00⟩, and Alice does exactly the same steps. Which correction must Bob apply for each result?

  1. Write |β11⟩ as a one-qubit operation on Bob's half of |β00⟩.

    (IβŠ—X)|Ξ²00⟩=(|01⟩+|10⟩)/2, and then (IβŠ—Z) gives (βˆ’|01⟩+|10⟩)/2=βˆ’|Ξ²11⟩. So |Ξ²11⟩=βˆ’(IβŠ—ZX)|Ξ²00⟩.

  2. Why can we pretend Bob applied ZX at the very start?

    Alice's CNOT, H and measurement act only on her two qubits, and ZX acts only on Bob's. Operators on different qubits commute, so the extra ZX can be moved past all of Alice's steps.

  3. So what does Bob hold after Alice reports m1m2?

    Up to a sign, ZXXm2Zm1|ψ⟩. He must undo this with Zm1Xm2XZ (read right to left: apply Z first).

  4. Simplify the four corrections.

    Using X2=Z2=I and ZX=βˆ’XZ:

    00:Β XZ,01:Β Z,10:Β XΒ (up to sign),11:Β nothing.

    Check 11: Bob holds ZXβ‹…XZ|ψ⟩=|ψ⟩ up to sign. Any shared Bell state works, as long as Alice and Bob agree in advance which one it is.

Check your understanding

Alice has measured, but her two bits haven't reached Bob. What state should Bob use to predict his own measurements?

  1. |ψ⟩Then Alice could signal instantly, by choosing |ψ⟩ and letting Bob measure.
  2. Xm2Zm1|ψ⟩That's correct only for someone who knows m1m2. Bob doesn't.
  3. The maximally mixed state I/2, whatever |ψ⟩ is
Each of the four Pauli-rotated copies of |ψ⟩ has probability 1/4, and 14βˆ‘PP|ψ⟩⟨ψ|P†=I/2 for the Paulis I,X,Z,XZ. Bob's statistics don't depend on |ψ⟩ until the bits arrive.

Is 12(|00⟩+|01⟩+|10⟩+|11⟩) entangled?

  1. Yes: all four basis states appear.The number of terms depends on the basis. Try to factor it.
  2. No: it is |+βŸ©βŠ—|+⟩.
  3. Yes: it's one of the Bell states.Each Bell state has only two terms in this basis.
Write the amplitudes as a matrix (c00c01c10c11). The state is a product exactly when this matrix has rank 1, i.e. c00c11=c01c10. Here 14=14.

Why does Alice apply H to |ψ⟩'s qubit before measuring?

  1. Without it, Bob's branch states are just |0⟩ or |1⟩, and the phase of |ψ⟩ would be lost in the measurement.
  2. It is part of making the Bell pair.The Bell pair's H acts on Alice's other qubit, earlier in the circuit.
  3. It only changes a global phase, so it could be skipped.Scrub the animation to just before the H: Bob's branches are |0⟩ or |1⟩, not copies of |ψ⟩.
After the CNOT, the branches are α|0⟩,α|1⟩,β|1⟩,β|0⟩: a measurement then would reveal partial information about |α|,|β| and destroy the relative phase. The H mixes the branches so each one carries all of |ψ⟩, and each outcome has probability 1/4.

Practice

Back from the Bell basisChange of basis

Express |01⟩ and |11⟩ as combinations of Bell states.

Hint

Add and subtract Bell states that contain the same two basis vectors.

Solution

|Ξ²01⟩+|Ξ²11⟩=22|01⟩, so |01⟩=(|Ξ²01⟩+|Ξ²11⟩)/2. Similarly |Ξ²00βŸ©βˆ’|Ξ²10⟩=2|11⟩, so |11⟩=(|Ξ²00βŸ©βˆ’|Ξ²10⟩)/2.

Teleporting entanglementEntanglement swapping

Charlie and Alice share |β00⟩, and Alice and Bob share another |β00⟩. Alice teleports her half of the first pair to Bob, using the second pair. What do Charlie and Bob end up with?

Hint

Teleportation is linear: it works term by term on 12(|0⟩C|0⟩A+|1⟩C|1⟩A).

Solution

The protocol maps |c⟩C|a⟩A to |c⟩C|a⟩B (after Bob's correction) for each basis state a, with the same correction for both terms, since the correction depends only on Alice's outcome. By linearity Charlie and Bob share |β00⟩, though Charlie and Bob never interacted.

From Nielsen and Chuang, Quantum Computation and Quantum Information (10th anniversary ed., Cambridge, 2010)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 1.2Distinguishing is as strong as cloning

Suppose a device, given one of two non-orthogonal states |ψ⟩,|Ο†βŸ©, always says correctly which one it got. Explain how to turn it into a cloner for these two states (contradicting no-cloning). Conversely, explain how a cloner for |ψ⟩,|Ο†βŸ© would let you distinguish them.

Hint

Once you know which state you hold, you can prepare as many copies as you like. In the other direction, copies make the states closer to orthogonal: |βŸ¨ΟˆβŠ—n|Ο†βŠ—n⟩|=|⟨ψ|Ο†βŸ©|n.

Solution

Distinguisher β‡’ cloner. Feed the input to the device, read off the label ψ or Ο†, and prepare two fresh copies of that state. Output |ψ⟩|ψ⟩ or |Ο†βŸ©|Ο†βŸ©: the states have been cloned, which no-cloning forbids for non-orthogonal pairs. So no perfect distinguisher exists.

Cloner β‡’ distinguisher. Apply the cloner repeatedly to get n copies. The two candidate states |ΟˆβŸ©βŠ—n and |Ο†βŸ©βŠ—n have overlap |⟨ψ|Ο†βŸ©|nβ†’0. The optimal (Helstrom) measurement tells two pure states apart with error probability 12(1βˆ’1βˆ’|⟨ψ|Ο†βŸ©|2n), which goes to 0. So a cloner gives distinguishing to arbitrary accuracy.

Exercise 2.69The Bell basis is orthonormal

Check that the four Bell states (|00⟩±|11⟩)/2 and (|01⟩±|10⟩)/2 form an orthonormal basis of the two-qubit space.

Hint

Two of them use only |00⟩,|11⟩, the other two only |01⟩,|10⟩.

Solution

Each has norm (1+1)/2=1. States from different pairs are supported on disjoint sets of basis vectors, so their inner product is 0. Within a pair, 12(⟨00|+⟨11|)(|00βŸ©βˆ’|11⟩)=12(1βˆ’1)=0, and the same for |01⟩±|10⟩. Four orthonormal vectors in a 4-dimensional space form a basis.

Exercise 4.33Measuring in the Bell basis

The circuit applies a CNOT (first qubit control) and then H on the first qubit, and then measures both qubits in the computational basis. Show that this realises a measurement whose POVM elements are the four projectors onto the Bell states, and give its measurement operators.

Hint

Run each Bell state through CNOT and then HβŠ—I. Where does each one land?

Solution

Write U=(HβŠ—I)CNOT. Then

U|β00⟩=|00⟩,U|β01⟩=|01⟩,U|β10⟩=|10⟩,U|β11⟩=|11⟩,

where |Ξ²xy⟩=(|0y⟩+(βˆ’1)x|1y¯⟩)/2. For example CNOT(|01⟩+|10⟩)/2=|+⟩|1⟩ and H|+⟩=|0⟩. So U maps the Bell basis to the computational basis.

Measuring |xy⟩ after U has measurement operators Mxy=|xy⟩⟨xy|U, and |xy⟩⟨xy|U=|xy⟩⟨βxy| since U†|xy⟩=|Ξ²xy⟩. The POVM elements are Mxy†Mxy=|Ξ²xy⟩⟨βxy|: the Bell projectors. The measurement operators are |xy⟩⟨βxy|, so the post-measurement state is the computational basis state |xy⟩, not the Bell state.

SimulationNielsen–Chuang, Ch. 2: Introduction to quantum mechanics

Measurement and density operators

Quantum mechanics predicts probabilities, and probabilities only show up as frequencies over many runs. Measure a prepared state again and again, watch the frequency settle, and find out which preparations no experiment can tell apart.

The idea

The postulates, briefly. A closed system's state is a unit vector in a Hilbert space; it evolves by unitaries; the state space of a composite system is the tensor product. A measurement is a set of operators {Mm} with βˆ‘mMm†Mm=I: outcome m has probability p(m)=⟨ψ|Mm†Mm|ψ⟩ and leaves the state Mm|ψ⟩/p(m).
Projective measurement. An observable A=βˆ‘mmPm (spectral decomposition) is measured by the projectors Pm. Its mean is ⟨A⟩=⟨ψ|A|ψ⟩. For a qubit with Bloch vector rβ†’, measuring n^β‹…Οƒβ†’ gives
p(+1)=1+rβ†’β‹…n^2,⟨n^β‹…Οƒβ†’βŸ©=rβ†’β‹…n^.
Density operator. If the system is |ψi⟩ with probability pi, its state is ρ=βˆ‘ipi|ψi⟩⟨ψi|: positive with trace 1, and p(m)=tr(Mm†Mmρ). For a qubit,
ρ=12(I+rβ†’β‹…Οƒβ†’),|rβ†’|≀1,pure⟺|rβ†’|=1.
Same ρ, same physics. Every measurement probability depends on the ensemble only through ρ. Two ensembles with the same density operator cannot be told apart by any experiment.
Superposition is not mixture. |+⟩ and "|0⟩ or |1⟩ with probability 12" give the same Z statistics. Their density operators differ (rβ†’=(1,0,0) against rβ†’=0), and an X measurement shows it.

Explore

prepared state r→ measurement axis: outcome +1 toward the arrow · drag to turn
Preparation
Measure
frequency of +1 so far Born probability, with a band of Β±2 standard deviations

Worked example

A qubit is prepared in |ψ⟩=32|0⟩+12|1⟩ (the "tilted" preparation in the explorer). Predict its Z and X statistics, then check them against its density matrix.

  1. What are the probabilities in the Z basis?

    p(0)=3/4 and p(1)=1/4, so ⟨Z⟩=3/4βˆ’1/4=1/2.

  2. What is p(+) for an X measurement?

    ⟨+|ψ⟩=12(32+12), so

    p(+)=(3+1)28=2+34β‰ˆ0.933.
  3. Find the Bloch vector and confirm p(+)=(1+rx)/2.

    cos⁑θ2=32 gives ΞΈ=Ο€/3, and Ο†=0. So rβ†’=(sin⁑π3,0,cos⁑π3)=(32,0,12), and (1+32)/2=(2+3)/4. The z-component 1/2 is ⟨Z⟩, as it should be.

  4. Write ρ and compute tr(ρX).

    ρ=|ψ⟩⟨ψ|=(3/43/43/41/4),tr(ρX)=ρ01+ρ10=32=rx.

    In the explorer, run 1000 shots in X: the frequency should land within about 20.933β‹…0.067/1000β‰ˆ0.016 of 0.933.

Check your understanding

Preparation A: |0⟩ or |1⟩, each with probability 12. Preparation B: |+⟩ or |βˆ’βŸ©, each with probability 12. Can any measurement tell A from B?

  1. Yes: measure X. B always gives a definite X outcome.Each member of B has a definite X value, but you don't know which member was sent. Try both in the explorer.
  2. Only a measurement on many copies at once.Even joint measurements on many copies see ΟβŠ—n, which is the same for A and B.
  3. No: both have ρ=I/2.
12(|0⟩⟨0|+|1⟩⟨1|)=12(|+⟩⟨+|+|βˆ’βŸ©βŸ¨βˆ’|)=I/2. Probabilities depend only on ρ, so A and B give identical statistics for every measurement.

A qubit has Bloch vector r→. What is the mean value of the observable n^⋅σ→?

  1. r→⋅n^
  2. (1+rβ†’β‹…n^)/2That's the probability of the outcome +1. The mean is p(+1)βˆ’p(βˆ’1).
  3. (r→⋅n^)2Squaring belongs to amplitudes, not to Bloch components.
⟨n^β‹…Οƒβ†’βŸ©=tr(12(I+rβ†’β‹…Οƒβ†’)n^β‹…Οƒβ†’)=rβ†’β‹…n^, using tr(ΟƒjΟƒk)=2Ξ΄jk and trΟƒj=0.

You measure Z on 100 fresh copies of |+⟩ and get 58 zeros. What should you conclude?

  1. The source is not producing |+⟩.How big a fluctuation is normal for 100 shots?
  2. Nothing alarming: the count has standard deviation 5, so 58 is 1.6 standard deviations from 50.
  3. Earlier measurements disturbed the later copies.Each shot uses a fresh copy, so earlier outcomes have no effect.
The number of zeros is binomial with n=100, p=12: standard deviation np(1βˆ’p)=5. Deviations of order n are expected; the explorer's band shows this shrinking like 1/N in the frequency.

Practice

Purity on the Bloch ballPure states live on the surface

Show that tr(ρ2)=(1+|rβ†’|2)/2 for a qubit, and conclude that ρ is pure exactly when |rβ†’|=1.

Hint

(r→⋅σ→)2=|r→|2I, because the Pauli matrices anticommute and square to I.

Solution

ρ2=14(I+2rβ†’β‹…Οƒβ†’+|rβ†’|2I), and the Paulis are traceless, so trρ2=14(2+2|rβ†’|2). A density operator is pure iff trρ2=1 (its eigenvalues are then 1 and 0), i.e. iff |rβ†’|=1.

An ensemble on two axesFrom an ensemble to ρ

A source emits |0⟩ or |+i⟩, each with probability 12. Find ρ, its Bloch vector, its purity, and the probability of outcome 0 in a Z measurement.

Solution

Bloch vectors average: r→=12(0,0,1)+12(0,1,0)=(0,12,12). Then

ρ=12(I+rβ†’β‹…Οƒβ†’)=(3/4βˆ’i/4i/41/4),

with purity (1+12)/2=34, so the state is mixed. p(0)=ρ00=34, which matches 12β‹…1+12β‹…12.

From Nielsen and Chuang, Quantum Computation and Quantum Information (10th anniversary ed., Cambridge, 2010)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 2.59Measuring X on |0⟩

A qubit is in |0⟩ and we measure the observable X. Find the mean and the standard deviation of the result.

Hint

⟨X⟩=⟨0|X|0⟩, and X2=I.

Solution

⟨X⟩=⟨0|X|0⟩=⟨0|1⟩=0. Since X2=I, ⟨X2⟩=1, so Ξ”X=1βˆ’0=1. Indeed the outcomes Β±1 are equally likely.

Exercise 2.61Measuring a spin along v→

For a unit vector vβ†’, measure vβ†’β‹…Οƒβ†’ on the state |0⟩. What is the probability of the outcome +1, and what is the state afterwards?

Hint

The projector for +1 is P+=(I+v→⋅σ→)/2.

Solution

p(+1)=⟨0|P+|0⟩=12(1+⟨0|vβ†’β‹…Οƒβ†’|0⟩)=12(1+v3), since only Z has a nonzero |0⟩ diagonal entry.

The post-measurement state is P+|0⟩/p(+1). With P+|0⟩=12((1+v3)|0⟩+(v1+iv2)|1⟩), it is

(1+v3)|0⟩+(v1+iv2)|1⟩2(1+v3),

the +1 eigenvector of vβ†’β‹…Οƒβ†’, whose Bloch vector is vβ†’. (If v3=βˆ’1 the outcome +1 has probability 0.)

Exercise 2.71Purity test

Show that every density operator satisfies tr(ρ2)≀1, with equality exactly when ρ is pure.

Hint

Diagonalise: ρ=βˆ‘iΞ»i|i⟩⟨i| with Ξ»iβ‰₯0, βˆ‘Ξ»i=1.

Solution

trρ2=βˆ‘iΞ»i2β‰€βˆ‘iΞ»i=1, because 0≀λi≀1 gives Ξ»i2≀λi. Equality forces Ξ»i2=Ξ»i for all i, so every Ξ»i is 0 or 1; since they sum to 1, exactly one is 1 and ρ=|i⟩⟨i| is pure. Conversely a pure state has ρ2=ρ, so trρ2=trρ=1.

Exercise 2.72The Bloch ball

(1) Show that every single-qubit density matrix can be written ρ=(I+rβ†’β‹…Οƒβ†’)/2 with rβ†’ real and β€–r→‖≀1. (2) What is rβ†’ for ρ=I/2? (3) Show ρ is pure iff β€–rβ†’β€–=1. (4) Check that for pure states this rβ†’ is the Bloch vector from Section 1.2.

Hint

I,X,Y,Z form a basis of the 2×2 Hermitian matrices, and r→⋅σ→ has eigenvalues ±‖r→‖.

Solution

(1) A Hermitian 2Γ—2 matrix is aI+rβ†’β‹…Οƒβ†’/2 with a and rβ†’ real; trρ=1 forces a=1/2. The eigenvalues of ρ are (1Β±β€–rβ†’β€–)/2, and positivity requires β€–r→‖≀1. Conversely any such rβ†’ gives a density matrix.

(2) r→=0: the centre of the ball.

(3) trρ2=12(1+β€–rβ†’β€–2) (the Paulis are traceless and trΟƒiΟƒj=2Ξ΄ij). By the previous exercise, ρ is pure iff this is 1, iff β€–rβ†’β€–=1.

(4) For |ψ⟩=cos⁑θ2|0⟩+eiΟ†sin⁑θ2|1⟩, ri=tr(ρσi)=⟨ψ|Οƒi|ψ⟩, which works out to (sin⁑θcos⁑φ,sin⁑θsin⁑φ,cos⁑θ): the same point.

InteractiveNielsen–Chuang, Ch. 2: Introduction to quantum mechanics

Entanglement and Bell's inequality

If every measurement result were fixed in advance by shared local information, one combination of correlations, the CHSH quantity S, could never exceed 2. Entangled qubits reach 22. Turn the four measurement directions and run the experiment.

The idea

Schmidt decomposition. Every pure state of a system AB can be written |ψ⟩=βˆ‘iΞ»i|iA⟩|iB⟩ with orthonormal |iA⟩, orthonormal |iB⟩, and Ξ»iβ‰₯0, βˆ‘Ξ»i2=1. The state is entangled exactly when more than one Ξ»i is nonzero.
Reduced state. Alice's half is described by ρA=trB|ψ⟩⟨ψ|=βˆ‘iΞ»i2|iA⟩⟨iA|. For a Bell state ρA=I/2: Alice alone sees pure noise.
CHSH inequality. Suppose each run assigns definite values A,Aβ€²,B,Bβ€²βˆˆ{Β±1} to the four possible measurements, and Alice's choice of setting does not affect Bob's values. Then
A(Bβˆ’Bβ€²)+Aβ€²(B+Bβ€²)=Β±2⟹S=E(a,b)βˆ’E(a,bβ€²)+E(aβ€²,b)+E(aβ€²,bβ€²)≀2,

where E is the average of the product of the two Β±1 results.

The quantum prediction. For |β00⟩, with Alice measuring cos⁑aZ+sin⁑aX and Bob cos⁑bZ+sin⁑bX,
E(a,b)=cos⁑(aβˆ’b),S=22Β Β atΒ a=0,Β aβ€²=Ο€2,Β b=Ο€4,Β bβ€²=3Ο€4.

22 is the largest value quantum mechanics allows (Tsirelson's bound).

Explore

Source
Drag the four directions (angles from z toward x). Alice: a,aβ€² Bob: b,bβ€²
Correlation E against the angle difference. quantum cos⁑Δ the local model sampled estimates

Worked example

The explorer uses |Ξ²00⟩. Work out the correlations of the singlet |Ξ²11⟩=(|01βŸ©βˆ’|10⟩)/2 instead, and find its best CHSH value.

  1. Compute ⟨ZβŠ—Z⟩, ⟨XβŠ—X⟩ and ⟨ZβŠ—X⟩ in the singlet.

    ZβŠ—Z multiplies both |01⟩ and |10⟩ by βˆ’1: mean βˆ’1. XβŠ—X swaps |01βŸ©β†”|10⟩, turning the singlet into minus itself: mean βˆ’1. ZβŠ—X maps it to (|00⟩+|11⟩)/2, which is orthogonal to it: mean 0. Likewise ⟨XβŠ—Z⟩=0.

  2. Expand E(a,b).

    E(a,b)=cos⁑acos⁑b⟨ZZ⟩+sin⁑asin⁑b⟨XX⟩+(cross terms=0)=βˆ’cos⁑(aβˆ’b).

    The singlet is perfectly anticorrelated along every common axis.

  3. Evaluate S at the settings that give 22 for |β00⟩.

    Every correlation changes sign, so S=βˆ’22. The inequality really bounds |S|: local models satisfy βˆ’2≀S≀2, because A(Bβˆ’Bβ€²)+Aβ€²(B+Bβ€²)=Β±2. Relabelling Bob's outcomes (Β±1β†’βˆ“1) turns the singlet's βˆ’22 into +22.

  4. Where exactly does the local argument fail for quantum systems?

    It assumes all four values A,Aβ€²,B,Bβ€² exist in every run. In the quantum experiment only one setting per side is measured, and cos⁑aZ+sin⁑aX and cos⁑aβ€²Z+sin⁑aβ€²X don't commute, so there is no joint value of A and Aβ€² to plug into the identity.

Check your understanding

Alice and Bob share |β00⟩. Alice measures in some basis of her choice, then Bob measures Z. Does Alice's choice change the probabilities Bob sees?

  1. Yes: her measurement collapses his qubit.It collapses to a state that depends on her random outcome. Average over that outcome.
  2. No: Bob's reduced state is I/2 whatever she does.
  3. Only if she measures Z too.Then the outcomes are correlated, but Bob's own frequencies are still 50/50.
Operations on Alice's qubit can't change ρB=trAρ. Entanglement shows up in correlations, which need both records to be compared; it can't be used to signal.

Point all four directions along z (a=aβ€²=b=bβ€²). What is S for |Ξ²00⟩?

  1. 0Every correlation is cos⁑0=1 here, not 0; only the signs in S can cancel them.
  2. 2
  3. 4One of the four terms enters with a minus sign.
  4. 22That needs the directions spread out by 45∘ steps.
All four correlations are cos⁑0=1, so S=1βˆ’1+1+1=2. Perfect correlation along one axis is easy to fake classically. Press "All along z" and compare the two sources.

An experiment measures S=2.7Β±0.05. What has it ruled out?

  1. Quantum mechanics.Quantum mechanics predicts values up to 22β‰ˆ2.83.
  2. Every model in which outcomes are fixed by shared local variables and neither side's setting affects the other's result.
  3. Entanglement between the two qubits.The other way around: unentangled (separable) states always satisfy |S|≀2, so a violation certifies entanglement.
The CHSH bound uses only the two assumptions in the correct answer, plus free choice of settings. A violation means at least one of them fails in nature.

Practice

Four terms, two in disguiseA Schmidt decomposition

Find the Schmidt decomposition and ρA for |ψ⟩=12(|00⟩+|01⟩+|10βŸ©βˆ’|11⟩).

Hint

Group the terms by the first qubit.

Solution

|ψ⟩=12(|0⟩|+⟩+|1⟩|βˆ’βŸ©). This is a Schmidt form with Ξ»1=Ξ»2=1/2, so the state is maximally entangled and ρA=I/2. (Its amplitude matrix is H/2, and 12HH†=I/2.)

Product states obey CHSHNo entanglement, no violation

Show that |S|≀2 for every product state |α⟩|β⟩, whatever the four settings.

Hint

For a product state, E(a,b)=⟨A⟩⟨B⟩. Use |xβˆ’y|+|x+y|=2max(|x|,|y|).

Solution

With ⟨A⟩,⟨Aβ€²βŸ©,⟨B⟩,⟨Bβ€²βŸ©βˆˆ[βˆ’1,1],

|S|=|⟨A⟩(⟨BβŸ©βˆ’βŸ¨Bβ€²βŸ©)+⟨Aβ€²βŸ©(⟨B⟩+⟨Bβ€²βŸ©)|≀|⟨BβŸ©βˆ’βŸ¨Bβ€²βŸ©|+|⟨B⟩+⟨Bβ€²βŸ©|≀2.

Mixtures of product states inherit the bound, since S is linear in ρ.

From Nielsen and Chuang, Quantum Computation and Quantum Information (10th anniversary ed., Cambridge, 2010)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 2.75Reduced states of the Bell states

For each of the four Bell states, find the reduced density operator of each qubit.

Hint

Write each Bell state as 12(|a⟩|u⟩+|b⟩|v⟩) with orthonormal |a⟩,|b⟩ and orthonormal |u⟩,|v⟩.

Solution

For |β00⟩=(|00⟩+|11⟩)/2: ρ=12(|00⟩⟨00|+|00⟩⟨11|+|11⟩⟨00|+|11⟩⟨11|). Tracing out qubit 2 kills the cross terms (they contain ⟨1|0⟩), leaving ρ1=12(|0⟩⟨0|+|1⟩⟨1|)=I/2. By symmetry ρ2=I/2.

The other three are obtained from |β00⟩ by a local unitary X, Z or XZ on one qubit, which doesn't change the reduced state of the other qubit and maps I/2 to I/2 on its own qubit. So every Bell state has both reduced states equal to I/2: maximally mixed.

Exercise 2.78Product states, Schmidt number 1, pure marginals

Prove that a state |ψ⟩ of a composite system AB is a product state iff its Schmidt number is 1, and iff ρA (equivalently ρB) is pure.

Hint

Write the Schmidt decomposition |ψ⟩=βˆ‘iΞ»i|iA⟩|iB⟩ and compute ρA=βˆ‘iΞ»i2|iA⟩⟨iA|.

Solution

If |ψ⟩=|a⟩|b⟩, that is already a Schmidt decomposition with one term. Conversely, one nonzero Schmidt coefficient means |ψ⟩=|1A⟩|1B⟩. So product ⟺ Schmidt number 1.

From the Schmidt form, ρA=βˆ‘iΞ»i2|iA⟩⟨iA|, whose rank is the Schmidt number; ρB has the same nonzero eigenvalues. A density matrix is pure iff it has rank 1. So ρA pure ⟺ Schmidt number 1 ⟺ ρB pure.

Exercise 2.79Three Schmidt decompositions

Find Schmidt decompositions of (|00⟩+|11⟩)/2, (|00⟩+|01⟩+|10⟩+|11⟩)/2 and (|00⟩+|01⟩+|10⟩)/3.

Hint

Write the state as a 2Γ—2 coefficient matrix C with |ψ⟩=βˆ‘cjk|j⟩|k⟩. The Schmidt coefficients are the singular values of C.

Solution

(1) Already in Schmidt form: coefficients 1/2,1/2.

(2) It factors: |+⟩|+⟩. Schmidt number 1, coefficient 1.

(3) C=13(1110) is symmetric with eigenvalues ΞΌΒ±=(1Β±5)/(23). For a real symmetric matrix the singular values are |ΞΌΒ±|, i.e. Ξ»1=(5+1)/(23)β‰ˆ0.934 and Ξ»2=(5βˆ’1)/(23)β‰ˆ0.357 (check: Ξ»12+Ξ»22=1). With |u±⟩ the normalised eigenvectors ∝|0⟩+βˆ’1Β±52|1⟩,

|ψ⟩=Ξ»1|u+⟩|u+⟩+Ξ»2|uβˆ’βŸ©(βˆ’|uβˆ’βŸ©),

where the sign is absorbed into the second Schmidt vector because ΞΌβˆ’<0.

Worked examplesNielsen–Chuang, Ch. 3: Introduction to computer science

Reversible computation and complexity

A quantum computer evolves by unitaries, so whatever it computes it must compute reversibly. Classical logic can be made reversible at modest cost, which is why a quantum computer can run any classical algorithm, and the scratch work has to be cleaned up afterwards.

The idea

Circuits. A Boolean circuit is built from gates such as AND, OR, NOT, with wires that can be copied (FANOUT). NAND alone, with FANOUT, is universal: it can build every Boolean function.
Toffoli gate. (a,b,c)↦(a,b,cβŠ•ab). It is a permutation of the 8 inputs and its own inverse. With c=1 it outputs NAND; with a=b=1 it is NOT on c; with a=1,c=0 it copies b. So reversible circuits can compute anything.
Landauer's principle. Erasing one bit of information in an environment at temperature T dissipates at least kBTln⁑2 of heat. Reversible gates erase nothing, so in principle they need not dissipate.
Uncomputation (Bennett). A reversible circuit for f leaves garbage: (x,0,0)↦(x,g(x),f(x)). Copy f(x) into a fresh register with CNOTs, then run the circuit backwards. The result is (x,0,0,f(x)), at about twice the gate count.
Complexity classes. P: decided in polynomial time. NP: "yes" answers can be checked in polynomial time. BPP: decided by a randomised polynomial algorithm with error at most 1/3. BQP: the same for quantum circuits. Known: PβŠ†BPPβŠ†BQPβŠ†PSPACE. Whether any of these inclusions is strict is open.
Not a shortcut to NP. Factoring is in BQP (Shor) but is not believed to be NP-complete, and there is no known efficient quantum algorithm for NP-complete problems.

Worked example

Build a reversible circuit that computes y=x1x2x3 (AND of three bits) into a target bit, using Toffoli gates and one scratch bit w, and leave the scratch bit clean. Then see why the cleaning matters quantum mechanically.

  1. One Toffoli computes the AND of two bits. How?

    Toffoli(x1,x2;w) with w=0 gives w=0βŠ•x1x2=x1x2.

  2. Now get x1x2x3 into the target y (initially 0).

    Toffoli(w,x3;y) gives y=x1x2x3. The scratch bit w still holds x1x2: this is garbage.

  3. Why is the garbage harmful on a quantum computer?

    On a superposition of inputs the circuit produces βˆ‘xcx|x⟩|w(x)⟩|f(x)⟩ instead of βˆ‘xcx|x⟩|0⟩|f(x)⟩. The garbage register is entangled with the input. Tracing it out leaves the rest in a mixed state, and the interference that a quantum algorithm relies on is lost.

  4. Clean up w.

    Apply Toffoli(x1,x2;w) once more: w↦x1x2βŠ•x1x2=0. Nothing it depends on (x1,x2) has changed, so the uncomputation is exact. The circuit is three Toffolis, and its output is (x1,x2,x3,w=0,y=x1x2x3).

  5. Generalise to the AND of n bits. How many Toffolis and scratch bits?

    Chain the partial ANDs x1x2,Β x1x2x3, … into nβˆ’2 scratch bits, with the last Toffoli writing into the target: nβˆ’1 gates. Uncompute the nβˆ’2 scratch bits in reverse order: nβˆ’2 more. Total 2nβˆ’3 Toffolis and nβˆ’2 clean scratch bits; for n=3, three Toffolis and one scratch bit, as above.

  6. What does Landauer's principle say about the ordinary irreversible AND gate on uniformly random inputs?

    The input carries 2 bits of entropy. The output is 1 with probability 1/4, so it carries H(1/4)β‰ˆ0.811 bits. The gate erases about 2βˆ’0.811=1.19 bits, so it must dissipate at least 1.19kBTln⁑2 per use. The reversible version keeps x1,x2, erases nothing, and has no such floor.

Check your understanding

A Toffoli gate gets inputs (a,b,1). What is its third output?

  1. a∧bThe target starts at 1, so it becomes 1βŠ•ab.
  2. ¬(a∧b), the NAND
  3. aβŠ•bToffoli multiplies the controls; XOR would need two CNOTs.
1βŠ•ab is 0 exactly when a=b=1. Since NAND is universal, so is Toffoli, with constant inputs and spare outputs allowed.

Why must every gate in a quantum circuit be reversible?

  1. Closed quantum evolution is unitary, and unitaries are invertible.
  2. To avoid Landauer heat, which would destroy the qubits.Heat is a practical concern; the requirement is more basic than that.
  3. Because of the no-cloning theorem.No-cloning forbids copying unknown states; reversibility comes from unitarity itself.
A unitary U has inverse U†. Irreversible steps (such as a reset) are possible only by involving an environment or a measurement, which is not a gate on the qubits alone.

Which of these is known to be true?

  1. BPPβŠ†BQPβŠ†PSPACE
  2. NP βŠ† BQPOpen, and widely doubted: search gives only a square-root speed-up for unstructured problems.
  3. Factoring is NP-completeFactoring (as a decision problem) lies in NP ∩ co-NP, which makes NP-completeness unlikely.
A quantum circuit can simulate coin flips, giving BPP βŠ† BQP. A classical machine can add up the amplitudes of all paths through a quantum circuit using polynomial space, giving BQP βŠ† PSPACE.

Practice

A reversible ORDe Morgan with a Toffoli

Using one Toffoli and some NOT gates, compute a∨b into a target bit and leave a,b unchanged.

Hint

a∨b=¬(¬a∧¬b).

Solution

NOT a and b, apply Toffoli onto a target that starts at 1 (giving 1βŠ•aΒ―bΒ―=a∨b), then NOT a and b again to restore them.

The Fredkin gateControlled swap

The Fredkin gate swaps its second and third bits when the first is 1. Show it never changes the number of 1s, and use it with constant inputs to compute AND and NOT.

Solution

It either does nothing or swaps two bits, so the count of 1s is unchanged. Input (a,b,0): if a=1 the output is (1,0,b), otherwise (0,b,0); the third output is ab. Input (a,0,1): if a=1 the output is (1,1,0), otherwise (0,0,1); the third output is Β¬a, and the second is a copy of a.

From Nielsen and Chuang, Quantum Computation and Quantum Information (10th anniversary ed., Cambridge, 2010)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 3.29The Fredkin gate undoes itself

Show that applying two Fredkin (controlled-swap) gates in a row returns the original inputs.

Hint

Split into the cases control =0 and control =1.

Solution

The control bit c passes through unchanged. If c=0 neither gate does anything. If c=1 each gate swaps the two targets, and two swaps cancel. In both cases the output equals the input, so F2=I and F is its own inverse.

Exercise 3.31A reversible half-adder

Build a reversible circuit taking bits x,y (plus ancillas) to (x,y,c,xβŠ•y), where c=xy is the carry.

Hint

A Toffoli computes an AND into a fresh 0; a CNOT computes an XOR into a fresh 0.

Solution

Start from (x,y,0,0). Apply a Toffoli with controls x,y and target the third bit: (x,y,xy,0). Then a CNOT from x into the fourth bit and a CNOT from y into the fourth bit: (x,y,xy,xβŠ•y). Every gate is reversible, so the whole circuit is.

Exercise 3.32Fredkin vs Toffoli

What is the smallest number of Fredkin gates needed to simulate a Toffoli gate, and the smallest number of Toffoli gates needed to simulate a Fredkin gate? (Constant inputs and garbage outputs are allowed.)

Hint

Work over F2: a Toffoli adds a product of two current wire values to its target, and the Fredkin's outputs are c,Β aβŠ•c(aβŠ•b),Β bβŠ•c(aβŠ•b). For a lower bound, ask which outputs one gate could possibly produce.

Solution

Three Toffolis make a Fredkin. CNOT bβ†’a (a Toffoli with one control fixed at 1) gives aβŠ•b on wire a; Toffoli (c,a)β†’b adds c(aβŠ•b) to b; CNOT bβ†’a restores a and adds the same term to it. The result is aβŠ•c(aβŠ•b),Β bβŠ•c(aβŠ•b), the controlled swap. Two cannot suffice: two output wires must change, each to a degree-2 polynomial containing caβŠ•cb. A first Toffoli acting on the original wires adds a single product xy of two inputs, which can never equal c(aβŠ•b), so at most the second gate can produce a correct output, and we need two.

Three Fredkins make a Toffoli. F(x;y,0) puts p=xy on its last wire (AND). F(p;1,0) outputs pΒ― and a copy of p (NOT and FANOUT). F(t;p,pΒ―) outputs tΒ―pβŠ•tpΒ―=tβŠ•p on its middle wire. So three gates give tβŠ•xy, with garbage. Fewer is impossible: the output tβŠ•xy needs wires carrying both xy and xy― for the final t-controlled selection, and a single Fredkin with constant inputs never produces both xy and its complement (its outputs are c, cΒ―aβŠ•cb and caβŠ•cΒ―b).

So the answer is three in each direction.

SimulatorNielsen–Chuang, Ch. 4: Quantum circuits

Quantum circuits

Single-qubit gates and CNOT are enough to build any unitary. Put gates on three wires and watch all eight amplitudes change, column by column. Entanglement shows up as a qubit whose own state is no longer pure.

The idea

Many qubits. n qubits have 2n amplitudes, one for each bit string. Here |q1q2q3⟩ lists the wires top to bottom. A gate U on wire k acts as IβŠ—β‹―βŠ—UβŠ—β‹―βŠ—I.
Controlled gates. Controlled-U maps |c⟩|tβŸ©β†¦|c⟩Uc|t⟩. CNOT is controlled-X; CZ is controlled-Z, which multiplies |11⟩ by βˆ’1 and is symmetric in its two qubits.
Universality. CNOT and all one-qubit gates generate every unitary exactly. The finite set {H,S,T,CNOT} approximates any unitary to accuracy Ξ΅, and by the Solovay–Kitaev theorem a one-qubit gate costs only O(logc⁑(1/Ξ΅)) gates from the set, for a constant c near 2.
Phase kickback. If the target is an eigenvector, U|u⟩=eiΟ•|u⟩, then controlled-U sends (a|0⟩+b|1⟩)|uβŸ©β†¦(a|0⟩+eiΟ•b|1⟩)|u⟩. The phase lands on the control. With CNOT and |u⟩=|βˆ’βŸ©, Ο•=Ο€.
Exponential bookkeeping. A simulator like the one below stores 2n numbers. That is easy for 3 qubits and hopeless for 300, which is part of why quantum computers might be powerful.

Explore

Gate to place
Load a circuit
Click a cell to place the gate. For CNOT and CZ, click the control, then the target in the same column. Click a gate again to remove it.
Bar height: probability |cx|2. The dial above each bar shows the amplitude cx as an arrow in the complex plane (pointing right means positive real).

Worked example

Load "Deutsch–Jozsa" in the simulator. It tests whether f:{0,1}2β†’{0,1} is constant or balanced with one call to the oracle |x⟩|yβŸ©β†¦|x⟩|yβŠ•f(x)⟩, here for f(x1,x2)=x1βŠ•x2, built from two CNOTs into the third wire. Work through the circuit by hand.

  1. After X on wire 3 and H on all three wires, what is the state?

    |+⟩|+⟩|βˆ’βŸ©=12βˆ‘x∈{0,1}2|xβŸ©βŠ—|βˆ’βŸ©.

  2. What does the oracle do to |x⟩|βˆ’βŸ©?

    |x⟩(|f(x)βŸ©βˆ’|1βŠ•f(x)⟩)/2=(βˆ’1)f(x)|x⟩|βˆ’βŸ©: phase kickback. So the state becomes

    12(|00βŸ©βˆ’|01βŸ©βˆ’|10⟩+|11⟩)|βˆ’βŸ©=|βˆ’βŸ©|βˆ’βŸ©|βˆ’βŸ©.
  3. Apply H to wires 1 and 2. What is measured?

    H|βˆ’βŸ©=|1⟩, so the result is |11⟩|βˆ’βŸ©: wires 1 and 2 read 11 with certainty. The simulator shows probability 12 on each of |110⟩ and |111⟩ because wire 3 is |βˆ’βŸ©.

  4. What would a constant f give, and why does this decide the question?

    For constant f the kickback is a global sign, the first two wires stay |++⟩, and the final Hs return |00⟩. For any balanced f, the amplitude of |00⟩ after the final Hs is 14βˆ‘x(βˆ’1)f(x)=0. So "00" means constant and anything else means balanced. Remove one CNOT from the oracle (it becomes f=x1 or x2, still balanced) and check that 00 still never appears.

Check your understanding

In a CZ gate, which qubit is the control?

  1. The top one, by convention.Write out its matrix and swap the qubits.
  2. Either: CZ is symmetric.
  3. The one in state |1⟩.Control is a role in the circuit, not a property of the state.
CZ =diag(1,1,1,βˆ’1): it multiplies |11⟩ by βˆ’1 and leaves the rest alone, which doesn't distinguish the qubits. Even for CNOT the roles depend on basis: in the |±⟩ basis, control and target swap.

H on wire 1 then CNOT 1β†’2 turns |00⟩ into a Bell state. What if the CNOT comes first and the H second?

  1. The same Bell state.Look at what the CNOT does when its control is |0⟩.
  2. The product state |+⟩|0⟩.
  3. A different Bell state.No entangling step acts on a superposition, so no entanglement can appear.
With control |0⟩ the CNOT does nothing, and then H just makes |+⟩|0⟩. Gates don't commute in general, so order matters; try both in the simulator and look at the purities.

Control in |+⟩, target in |βˆ’βŸ©. What does a CNOT produce?

  1. |+⟩|βˆ’βŸ©, unchanged.The target is unchanged. The control is not.
  2. |βˆ’βŸ©|βˆ’βŸ©
  3. An entangled state.The target is an eigenvector of X, so the output stays a product.
X|βˆ’βŸ©=βˆ’|βˆ’βŸ©, so CNOT|x⟩|βˆ’βŸ©=(βˆ’1)x|x⟩|βˆ’βŸ©. The control picks up the relative sign: |+βŸ©β†¦|βˆ’βŸ©. This is phase kickback, the engine of Deutsch–Jozsa and phase estimation.

Practice

Three-qubit GHZ stateEntangled, but each pair is not

Give a circuit that makes (|000⟩+|111⟩)/2 from |000⟩. Then trace out qubit 3 and decide whether qubits 1 and 2 are entangled with each other.

Solution

H on wire 1, then CNOT 1β†’2 and CNOT 2β†’3 (the "GHZ" preset). Tracing out qubit 3 gives ρ12=12(|00⟩⟨00|+|11⟩⟨11|), a classical mixture of product states: perfectly correlated, but not entangled. Each single qubit has purity 12, the minimum.

Kickback from controlled-SReading off an eigenvalue

A controlled-S gate has its control in |+⟩ and its target in |1⟩. What is the output, and how could you tell the phase from a measurement of the control?

Hint

|1⟩ is an eigenvector of S. With which eigenvalue?

Solution

S|1⟩=i|1⟩, so the output is 12(|0⟩+i|1⟩)|1⟩=|+i⟩|1⟩. Measuring the control in the Y basis gives +1 with certainty; in the X basis it gives each outcome half the time. Phase estimation generalises this: controlled powers of U write the eigenphase into a register, and an inverse Fourier transform reads it out.

From Nielsen and Chuang, Quantum Computation and Quantum Information (10th anniversary ed., Cambridge, 2010)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 4.13Conjugating Paulis by H

Prove HXH=Z, HYH=βˆ’Y and HZH=X.

Hint

H=(X+Z)/2. Use the anticommutation of distinct Paulis.

Solution

With H=(X+Z)/2: HXH=12(X+Z)X(X+Z)=12(X+Z)(I+XZ)=12(X+Z+XXZ+ZXZ)=12(X+Z+Zβˆ’X)=Z. Since H2=I, conjugating both sides gives HZH=X. For Y=iXZ: HYH=i(HXH)(HZH)=iZX=βˆ’iXZ=βˆ’Y.

Exercise 4.17CNOT from a controlled-Z

Build a CNOT from one controlled-Z gate and two Hadamards. Which qubit is which?

Hint

HZH=X.

Solution

Put H on the target qubit before and after a controlled-Z (control unchanged):

CNOT=(IβŠ—H)CZ(IβŠ—H).

If the control is |0⟩, the target sees HH=I. If it is |1⟩, the target sees HZH=X. Controlled-Z is symmetric in its two qubits, so the qubit that gets the Hadamards becomes the target.

Exercise 4.20Control and target swap in the |±⟩ basis

Show that (HβŠ—H)CNOT1β†’2(HβŠ—H)=CNOT2β†’1. Deduce how CNOT1β†’2 acts on |±⟩|±⟩.

Hint

Write CNOT1β†’2=|0⟩⟨0|βŠ—I+|1⟩⟨1|βŠ—X and conjugate each factor by H.

Solution

H|0⟩⟨0|H=|+⟩⟨+|=(I+X)/2, H|1⟩⟨1|H=(Iβˆ’X)/2, HXH=Z. So

(HβŠ—H)CNOT(HβŠ—H)=I+X2βŠ—I+Iβˆ’X2βŠ—Z=IβŠ—|0⟩⟨0|+XβŠ—|1⟩⟨1|,

using (I+Z)/2=|0⟩⟨0| and (Iβˆ’Z)/2=|1⟩⟨1|. That is the CNOT controlled by qubit 2 with target qubit 1.

Translating: |±⟩ are H|0⟩,H|1⟩. So CNOT1β†’2 sends |+⟩|+βŸ©β†¦|+⟩|+⟩, |βˆ’βŸ©|+βŸ©β†¦|βˆ’βŸ©|+⟩, |+⟩|βˆ’βŸ©β†¦|βˆ’βŸ©|βˆ’βŸ©, |βˆ’βŸ©|βˆ’βŸ©β†¦|+⟩|βˆ’βŸ©: in this basis the second qubit controls a flip of the first.

SimulationNielsen–Chuang, Ch. 5: The quantum Fourier transform and its applications

Fourier transform and period finding

Shor's algorithm turns factoring into finding the period of x↦axmodN. The quantum Fourier transform turns a periodic superposition into sharp peaks, and a short continued-fraction calculation reads the period off one measurement. Here it is for N=15 and N=21.

The idea

Quantum Fourier transform. On t qubits, with Q=2t,
|j⟩ ⟼ 1Qβˆ‘k=0Qβˆ’1e2Ο€ijk/Q|k⟩.

It is unitary and needs only O(t2) gates (Hadamards and controlled phase rotations), against O(t2t) steps for the classical fast Fourier transform of 2t numbers. The catch: the output amplitudes can't be read, only sampled.

Order. For a coprime to N, the order r is the least r>0 with ar≑1(modN).
From order to factors. If r is even and ar/2β‰’βˆ’1(modN), then gcd(ar/2βˆ’1,N) and gcd(ar/2+1,N) are nontrivial factors of N. For odd N that isn't a prime power, a random a works with probability at least 1/2.
Order finding. Prepare 1Qβˆ‘x|x⟩|axmodN⟩, apply the QFT to the first register and measure it, getting y. Then y/Q is close to s/r for a uniformly random s∈{0,…,rβˆ’1}. If Qβ‰₯N2, the fraction s/r (in lowest terms) is one of the continued-fraction convergents of y/Q.
Lowest terms. If gcd(s,r)>1, continued fractions return a proper divisor of r. Check whether aq≑1; if not, try small multiples of q or run again.

Explore

N
Base a
P(y) after the QFT the ideal peak positions sQ/r your measured y

Worked example

Factor N=21 with a=2 and t=9 counting qubits (Q=512β‰₯212=441). Set the explorer to the same values to follow along.

  1. What is the order of 2 modulo 21? (The quantum computer finds this; we check it by hand.)

    2,4,8,16,32≑11,22≑1. So r=6.

  2. Where are the peaks of P(y)?

    Near y=sQ/r=512s/6: 0,Β 85.3,Β 170.7,Β 256,Β 341.3,Β 426.7. Since 6 doesn't divide 512, the peaks spill onto neighbouring y.

  3. Suppose the measurement gives y=427. Expand 427/512 as a continued fraction and list the convergents.

    512=1β‹…427+85,Β 427=5β‹…85+2,Β 85=42β‹…2+1,Β 2=2β‹…1, so 427/512=[0;1,5,42,2], with convergents

    01,11,56,211253,427512.

    The last convergent with denominator below N=21 is 5/6, so the candidate is r=6. Check: 26=64=3β‹…21+1.

  4. Turn r=6 into factors.

    r is even and 23=8β‰’βˆ’1(mod21). Then gcd(8βˆ’1,21)=7 and gcd(8+1,21)=3, and 21=3β‹…7.

  5. What if the measurement had given y=341?

    341/512=[0;1,1,1,170], convergents 0,Β 1,Β 12,Β 23,Β 341512. The candidate is q=3, but 23=8β‰’1. Here s=4 shares the factor 2 with r=6, and 4/6 reduced to 2/3. Trying the multiple 2q=6 works.

Check your understanding

N=15, a=7 (order 4), Q=256. Which outcomes y can occur?

  1. Any y, with peaks near multiples of 64.When r divides Q the cancellation away from the peaks is exact.
  2. Only 0,64,128,192, each with probability 1/4.
  3. Only y=64, which gives r=4 directly.s is uniformly random in {0,1,2,3}, so all four peaks are equally likely.
With r∣Q, the sum βˆ‘ke2Ο€ikry/Q is zero unless ry/Q is an integer, i.e. y is a multiple of Q/r=64. Only y=64 and y=192 (s odd, coprime to 4) give r directly; y=128 gives 1/2.

You measure y=0. What do you learn?

  1. Nothing: 0/Q=0/1, the candidate order is 1, and you run again.
  2. That r=Q.The order is at most N, far below Q.
  3. That a is a bad choice.y=0 (that is, s=0) has probability about 1/r for every a.
The s=0 peak always exists and carries no information about r. It is one reason the algorithm is repeated a few times.

Why take Qβ‰₯N2?

  1. The QFT only works when Q is a perfect square.The QFT works for every Q=2t.
  2. Then |y/Qβˆ’s/r|≀1/(2Q)≀1/(2r2), which guarantees s/r is a convergent of y/Q.
  3. To make the peaks wider and easier to hit.Larger Q makes the peaks narrower relative to their spacing.
A classical theorem: if |xβˆ’s/r|≀1/(2r2), then s/r is a convergent of x. With r<N and Qβ‰₯N2 the peaks are sharp enough. Lower t in the explorer and watch the continued fractions start to fail.

Practice

The four-point transformQFT by hand

Write the matrix of the QFT for Q=4, check that for Q=2 it is H, and show that applying the Q=4 transform twice sends |j⟩ to |βˆ’jmod4⟩.

Solution

With Ο‰=e2Ο€i/4=i, the entries are Ο‰jk/2:

F4=12(11111iβˆ’1βˆ’i1βˆ’11βˆ’11βˆ’iβˆ’1i),F2=12(111βˆ’1)=H.

(F2)jl=1Qβˆ‘kΟ‰k(j+l), which is 1 when j+l≑0(modQ) and 0 otherwise. So F2|l⟩=|βˆ’l⟩, and F4=I.

Exact peaksWhy r∣Q gives a clean comb

Let r divide Q and |Ο•βŸ©=r/Qβˆ‘k=0Q/rβˆ’1|x0+kr⟩. Show that the QFT of |Ο•βŸ© is 1rβˆ‘s=0rβˆ’1e2Ο€ix0s/r|sQ/r⟩.

Hint

The amplitude of |y⟩ contains the geometric sum βˆ‘ke2Ο€ikry/Q.

Solution

The amplitude of |y⟩ is rQe2Ο€ix0y/Qβˆ‘k=0Q/rβˆ’1e2Ο€ikry/Q. The sum is Q/r if ry/Q∈Z, i.e. y=sQ/r, and 0 otherwise. At y=sQ/r the amplitude is rQβ‹…Qre2Ο€ix0s/r=1re2Ο€ix0s/r. The offset x0 only affects phases, so measuring axmodN first changes nothing about P(y).

From Nielsen and Chuang, Quantum Computation and Quantum Information (10th anniversary ed., Cambridge, 2010)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 5.10Order of 5 mod 21

Show that the order of 5 modulo 21 is 6.

Hint

Compute powers, reducing each time.

Solution

51=5, 52=25≑4, 53≑20, 54≑100≑16, 55≑80≑17, 56≑85≑1(mod21). No smaller power is 1, so the order is 6. (As a check, the order divides lcm(Ο†(3),Ο†(7))=6.)

Exercise 5.18Factoring 91 by order-finding

Factor N=91 with the order-finding reduction: check the preliminary steps, take x=4, find its order r, and use xr/2 to find a factor.

Hint

Is 91 even? Is it a perfect power? Then compute powers of 4 mod 91.

Solution

91 is odd and not of the form ab with bβ‰₯2 (92=81, 102=100, 43=64, 53=125), so the preliminary steps pass. gcd(4,91)=1.

Powers: 42=16, 43=64, 46=642=4096=45β‹…91+1. Also 42β‰’1, 43β‰’1, so r=6, which is even. Then xr/2=43=64β‰’βˆ’1(mod91). So gcd(64βˆ’1,91)=gcd(63,91)=7 and gcd(64+1,91)=gcd(65,91)=13. Indeed 91=7β‹…13. (The book's printed gcd(64βˆ’1,19) is a typo for gcd(63,91).)

Exercise 5.19Why 15 is the first interesting case

Show that 15 is the smallest composite number that is neither even nor a perfect power, so the smallest one that genuinely needs order-finding.

Hint

List the odd composites below 15.

Solution

The odd composites less than 15 are 9 only, and 9=32 is a perfect power. Every other composite below 15 (4,6,8,10,12,14) is even. 15=3β‹…5 is odd and not a perfect power, so it is the first case left for the order-finding step.

InteractiveNielsen–Chuang, Ch. 6: Quantum search algorithms

Grover search as a rotation

Each Grover iteration is two reflections, and two reflections make a rotation. In the plane spanned by "marked" and "unmarked", the state turns by a fixed angle each step, so about Ο€4N/M steps reach a marked item, and further steps overshoot.

The idea

Oracle. O|x⟩=(βˆ’1)f(x)|x⟩, where f(x)=1 for the M marked items out of N=2n. (A bit-flip oracle with its output qubit in |βˆ’βŸ© acts this way, by phase kickback.)
Grover iteration. G=(2|ψ⟩⟨ψ|βˆ’I)O, where |ψ⟩=HβŠ—n|0⟩ is the uniform superposition. The second factor, the diffusion, maps each amplitude cx to 2cΒ―βˆ’cx: an inversion about the mean.
The geometry. Let |α⟩ and |β⟩ be the uniform superpositions of unmarked and marked items. Then |ψ⟩=cos⁑θ2|α⟩+sin⁑θ2|β⟩ with sin⁑θ2=M/N. O reflects about |α⟩, the diffusion reflects about |ψ⟩, and together they rotate by θ:
Gk|ψ⟩=cos⁑(2k+1)θ2|α⟩+sin⁑(2k+1)θ2|β⟩,Psuccess=sin2⁑(2k+1)θ2.
Optimality. Any quantum algorithm that finds a marked item with high probability needs Ξ©(N/M) oracle calls, so Grover's algorithm is optimal up to a constant factor.

Explore

the state |ψ⟩, the start the mirror of the last reflection
Success probability after k iterations. where you are now

Worked example

Search N=16 items with one marked item, tracking the actual amplitudes. (Set n=4, M=1 in the explorer.)

  1. What is ΞΈ, and what does the formula predict for k=1,2,3,4?

    sin⁑θ2=14, so ΞΈ2β‰ˆ14.48∘. The success probabilities sin2⁑((2k+1)β‹…14.48∘) are 0.473,Β 0.908,Β 0.961,Β 0.582. Best is k=3, close to Ο€416β‰ˆ3.1.

  2. Do the first iteration with amplitudes. All 16 start at 14.

    Oracle: the marked amplitude becomes βˆ’14. The mean is (15β‹…14βˆ’14)/16=0.21875. Inversion about the mean: unmarked 2(0.21875)βˆ’0.25=0.1875; marked 2(0.21875)+0.25=0.6875. Probability 0.68752=0.473, as predicted.

  3. Do the second and third iterations.

    Second: mean (15β‹…0.1875βˆ’0.6875)/16=0.1328; unmarked 0.0781, marked 0.9531, probability 0.908. Third: mean (15β‹…0.0781βˆ’0.9531)/16=0.0137; unmarked βˆ’0.0508, marked 0.9805, probability 0.961.

  4. The unmarked amplitudes just went negative. What does that tell you?

    The state has rotated past |β⟩: its |α⟩-component is now negative. A fourth iteration moves it further from |β⟩, and the probability drops to 0.582. A classical search with 3 queries succeeds with probability only 3/16, or 4/16 if you guess one of the unchecked items at the end.

Check your understanding

N=220β‰ˆ106, one marked item. Roughly how many iterations give the best chance of success?

  1. About 20That's log2⁑N. Search is quadratically faster than classical, not exponentially.
  2. About 800
  3. About 500,000That's the average for a classical search.
Ο€4220=Ο€4β‹…1024β‰ˆ804. Each iteration rotates by ΞΈβ‰ˆ2/N, and the state has to turn through about Ο€/2.

You run twice the optimal number of iterations. The success probability is then

  1. close to 1, since extra iterations can't hurt.The iteration is a rotation, and it keeps turning past |β⟩.
  2. close to 0.
  3. about 1/2.After twice the optimum the angle is close to Ο€, not 3Ο€/4.
The optimum puts the angle near Ο€/2; twice as many steps put it near Ο€, that is, near βˆ’|α⟩, where the marked amplitude is almost zero. Try "Run to the best k", then keep pressing "Full iteration".

What does the oracle step alone do to the measurement probabilities?

  1. It raises the probability of the marked items.It only flips the sign of their amplitudes.
  2. Nothing: it changes signs, and probabilities are squared magnitudes.
  3. It sets the marked amplitudes to zero.A unitary can't destroy amplitude; it reflects it.
On its own the sign flip is invisible to a computational-basis measurement. The diffusion step turns the sign difference into a size difference. Press Oracle alone in the explorer and watch the probability readout.

Practice

Eight itemsChoosing the number of iterations

For N=8 and M=1, find ΞΈ, the best number of iterations, and its success probability.

Solution

sin⁑θ2=1/8 gives ΞΈ2β‰ˆ20.7∘. The angles (2k+1)ΞΈ/2 are 62.1∘,103.5∘,144.9∘ for k=1,2,3, with probabilities 0.781,0.945,0.330. Best is k=2, at about 94.5%.

A quarter markedCertainty in one step

Show that if exactly a quarter of the items are marked, one Grover iteration finds a marked item with certainty.

Solution

sin⁑θ2=1/4=12, so ΞΈ2=30∘ and after one iteration the angle is 3β‹…30∘=90∘: the state is exactly |β⟩. (With amplitudes: after the oracle the mean is 12N, so unmarked amplitudes 1N become 0.)

From Nielsen and Chuang, Quantum Computation and Quantum Information (10th anniversary ed., Cambridge, 2010)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 6.2Inversion about the mean

Let |ψ⟩=1Nβˆ‘k|k⟩. Show that (2|ψ⟩⟨ψ|βˆ’I)βˆ‘kΞ±k|k⟩=βˆ‘k(βˆ’Ξ±k+2⟨α⟩)|k⟩, where ⟨α⟩=1Nβˆ‘kΞ±k.

Hint

Compute ⟨ψ|α⟩ first.

Solution

⟨ψ|α⟩=1Nβˆ‘kΞ±k=N⟨α⟩. So 2|ψ⟩⟨ψ|α⟩=2NβŸ¨Ξ±βŸ©β‹…1Nβˆ‘k|k⟩=βˆ‘k2⟨α⟩|k⟩. Subtracting I|α⟩=βˆ‘kΞ±k|k⟩ gives the claim. Each amplitude is reflected about the mean: Ξ±kβ†¦βŸ¨Ξ±βŸ©βˆ’(Ξ±kβˆ’βŸ¨Ξ±βŸ©).

Exercise 6.3Grover's iterate is a rotation

With |α⟩ the normalised sum of non-solutions, |β⟩ the normalised sum of solutions, and |ψ⟩=cos⁑θ2|α⟩+sin⁑θ2|β⟩, show that G=(2|ψ⟩⟨ψ|βˆ’I)O acts on span{|α⟩,|β⟩} as (cosβ‘ΞΈβˆ’sin⁑θsin⁑θcos⁑θ).

Hint

O is the reflection diag(1,βˆ’1) in this basis. Write 2|ψ⟩⟨ψ|βˆ’I as a matrix too and multiply.

Solution

In the basis (|α⟩,|β⟩), with c=cos⁑θ2, s=sin⁑θ2,

2|ψ⟩⟨ψ|βˆ’I=(2c2βˆ’12cs2cs2s2βˆ’1)=(cos⁑θsin⁑θsinβ‘ΞΈβˆ’cos⁑θ),O=(100βˆ’1).

Multiplying, G=(cosβ‘ΞΈβˆ’sin⁑θsin⁑θcos⁑θ), the rotation by ΞΈ. (Two reflections compose to a rotation by twice the angle between their axes, here 2β‹…ΞΈ2.)

InteractiveNielsen–Chuang, Ch. 7: Quantum computers: physical realization

Driving a qubit: Rabi oscillations

In NMR, ion traps and cavity QED, a gate is a pulse of radiation of a chosen length. On resonance the qubit swings all the way from |0⟩ to |1⟩ and back. Off resonance it precesses about a tilted axis and never fully flips, which is one way real gates go wrong.

The idea

What a physical qubit needs. A robust way to represent quantum information, a way to perform a universal set of unitaries, a way to prepare a known initial state, and a way to measure the result, all with decoherence slow compared with the gates.
Driven two-level system. In a frame rotating with the drive, a qubit driven with Rabi frequency Ξ© and detuning Ξ” (drive frequency minus qubit frequency, up to sign convention) has, with ℏ=1,
H=Ξ”2Z+Ξ©2X.
Rabi formula. eβˆ’iHt rotates the Bloch vector about n^=(Ξ©,0,Ξ”)/Ξ©β€² at angular speed Ξ©β€²=Ξ©2+Ξ”2. Starting in |0⟩,
P1(t)=Ξ©2Ξ©2+Ξ”2sin2(Ξ©β€²t2).

On resonance a pulse of area Ξ©t=Ο€ (a "Ο€ pulse") is X up to phase, and Ξ©t=Ο€/2 makes an equal superposition. Shifting the phase of the drive changes X to cos⁑χX+sin⁑χY, which gives rotations about any axis in the equatorial plane.

Explore

the state rotation axis n^ its path during the pulse Β· drag to turn
P1 against pulse area on resonance, for comparison

Worked example

Design a pulse that takes |0⟩ to |+⟩ on a resonantly driven qubit with Ξ©/2Ο€=50 kHz, and estimate the error if the drive is detuned by Ξ”=0.1Ξ©.

  1. A drive with phase Ο‡=0 rotates about x. Can it reach |+⟩ from |0⟩?

    No. A rotation about x moves the north pole around the circle in the y–z plane, through |βˆ’i⟩ and |1⟩, never reaching +x.

  2. Which axis and angle work, and what is the matrix?

    A quarter turn about +y (drive phase Ο‡=Ο€/2) sends +z to +x:

    Ry(Ο€/2)=12(1βˆ’111),Ry(Ο€/2)|0⟩=|+⟩.
  3. How long is the pulse?

    We need Ξ©t=Ο€/2, so t=Ο€/(2Ξ©)=Ο€/(2β‹…2Ο€β‹…50kHz)=5Β ΞΌs.

  4. With Ξ”=0.1Ξ©, how far off is a Ο€ pulse? (Set Ξ”/Ξ© = 0.10 in the explorer.)

    The axis tilts by arctan⁑0.1β‰ˆ5.7∘, and the largest possible P1 is Ξ©2/(Ξ©2+Ξ”2)=1/1.01β‰ˆ0.990. The nominal Ο€ pulse is also slightly too short for the faster rotation: Ξ©β€²t=Ο€1.01, giving P1=0.990sin2⁑(0.5025Ο€)β‰ˆ0.990. So the error is about 1%, second order in Ξ”/Ξ©.

Check your understanding

On resonance, a 2Ο€ pulse is applied to Ξ±|0⟩+Ξ²|1⟩. The result is

  1. exactly the original state.The Bloch vector comes back, but Rx(2Ο€) is not the identity matrix.
  2. βˆ’(Ξ±|0⟩+Ξ²|1⟩).
  3. Ξ²|0⟩+Ξ±|1⟩.That (up to phase) is what a Ο€ pulse does: half a turn about x.
Rx(2Ο€)=cos⁑πIβˆ’isin⁑πX=βˆ’I. The sign is a global phase for an isolated qubit, but it becomes a measurable relative phase if the qubit is in superposition with a third, undriven level. A spin-12 state needs a 4Ο€ rotation to return to itself exactly.

The detuning equals the Rabi frequency, Ξ”=Ξ©. What is the largest P1 any pulse length can give?

  1. 1, with a long enough pulseOff resonance the oscillation has reduced amplitude, however long you wait.
  2. 1/2
  3. 1/4The amplitude is Ξ©2/(Ξ©2+Ξ”2); don't square it again.
Ξ©2/(Ξ©2+Ξ”2)=1/2. The axis is tilted 45∘ from z, so the state circles from the north pole down to the equator and back. Set Ξ”/Ξ© = 1 in the explorer.

A qubit has coherence time T2=1 ms and a Ο€ pulse takes 10Β ΞΌs. Roughly how many sequential gates fit before coherence is mostly lost?

  1. About 10Divide the two times.
  2. About 100
  3. About 10,000Check the units: 1 ms is 1000 ΞΌs.
T2/tgate=1000/10=100. This ratio, not either time alone, is the figure of merit, and error correction needs it to be large.

Practice

How far down?The precession cone

With detuning Ξ”, the Bloch vector starting at the north pole moves on a circle around n^. Find the lowest z it reaches, and check that it agrees with the Rabi formula.

Hint

Rotating z^ by Ο€ about n^ gives the point on the circle farthest from where it started.

Solution

A half turn sends z^ to 2(n^β‹…z^)n^βˆ’z^, whose z-component is 2nz2βˆ’1=2Ξ”2/Ξ©β€²2βˆ’1. Then P1=(1βˆ’z)/2=1βˆ’Ξ”2/Ξ©β€²2=Ξ©2/Ξ©β€²2, the amplitude in the Rabi formula.

Pulse lengths for an ionUnits

An ion qubit is driven with Ξ©/2Ο€=100 kHz. How long are its Ο€ and Ο€/2 pulses?

Solution

tΟ€=Ο€/Ξ©=1/(2β‹…100kHz)=5Β ΞΌs and tΟ€/2=2.5Β ΞΌs. A common slip is to use Ξ©=100 kHz instead of 2π×100 kHz, which gives a time 2Ο€ times too long.

From Nielsen and Chuang, Quantum Computation and Quantum Information (10th anniversary ed., Cambridge, 2010)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 7.18Rabi oscillations by exponentiating

In the one-excitation subspace with basis |00⟩,|01⟩,|10⟩ (field, atom), the Jaynes–Cummings Hamiltonian is H=βˆ’(Ξ΄000Ξ΄g0gβˆ’Ξ΄). Using einβ†’β‹…Οƒβ†’=cos⁑|nβ†’|+in^β‹…Οƒβ†’sin⁑|nβ†’|, compute U=eβˆ’iHt and recover the Rabi frequency Ξ©=g2+Ξ΄2.

Hint

The |00⟩ block is 1Γ—1. On the |01⟩,|10⟩ block, βˆ’H=Ξ΄Z+gX=nβ†’β‹…Οƒβ†’ with nβ†’=(g,0,Ξ΄).

Solution

On |00⟩: U=eiΞ΄t. (The book's eβˆ’iΞ΄t corresponds to the opposite sign convention for this entry; only a phase.)

On the 2Γ—2 block, βˆ’iHt=it(gX+Ξ΄Z), so with |nβ†’|t=Ξ©t,

U=cos⁑ΩtI+isin⁑ΩtgX+Ξ΄ZΞ©=(cos⁑Ωt+iδΩsin⁑ΩtigΞ©sin⁑ΩtigΞ©sin⁑Ωtcos⁑Ωtβˆ’iδΩsin⁑Ωt).

This matches (7.77) up to the sign convention on the off-diagonal phase. The off-diagonal entry has modulus gΩ|sin⁑Ωt|: a photon and an atomic excitation are exchanged at the Rabi frequency Ω=g2+δ2, with full transfer only on resonance.

Exercise 7.31Hadamard from Ry and Rx

Construct a Hadamard gate from Ry and Rx rotations.

Hint

A quarter turn about y takes +z to +x; then a half turn about x fixes +x and sends +z to βˆ’z.

Solution
H=iRx(Ο€)Ry(Ο€/2)

(apply Ry(Ο€/2) first). Check: Ry(Ο€/2)=12(1βˆ’111), Rx(Ο€)=βˆ’iX, and βˆ’iXRy(Ο€/2)=βˆ’i2(111βˆ’1). Multiplying by i gives H. On the sphere: +xβ†¦βˆ’z↦+z, +z↦+x↦+x, as H requires.

InteractiveNielsen–Chuang, Ch. 8: Quantum noise and quantum operations

Noise on the Bloch ball

A qubit that interacts with its surroundings no longer evolves by a unitary. Its evolution is a quantum operation, and for one qubit every such operation squashes and shifts the Bloch ball into an ellipsoid inside it. Pick a channel and watch the ball deform.

The idea

Quantum operation. A map of density operators of the form
E(ρ)=βˆ‘kEkρEk†,βˆ‘kEk†Ek=I.

The Ek are Kraus operators (operation elements). Every such map arises from a unitary interaction with an environment that starts in a fixed state and is then discarded, and conversely. These maps are exactly the trace-preserving, completely positive ones.

On one qubit. Writing ρ=12(I+rβ†’β‹…Οƒβ†’), every quantum operation acts as an affine map r→↦Mrβ†’+cβ†’. The image of the ball is an ellipsoid. The common channels:
  • Bit flip (X with probability p): (x,y,z)↦(x,(1βˆ’2p)y,(1βˆ’2p)z).
  • Phase flip (Z with probability p): (x,y,z)↦((1βˆ’2p)x,(1βˆ’2p)y,z).
  • Depolarising, ρ↦(1βˆ’p)ρ+pI/2: r→↦(1βˆ’p)rβ†’.
  • Amplitude damping (energy loss, |1βŸ©β†’|0⟩ with probability Ξ³), E0=(1001βˆ’Ξ³), E1=(0Ξ³00): (x,y,z)↦(1βˆ’Ξ³x,1βˆ’Ξ³y,Ξ³+(1βˆ’Ξ³)z).
  • Phase damping (loss of coherence without energy loss): (x,y,z)↦(1βˆ’Ξ»x,1βˆ’Ξ»y,z).
Positive is not enough. The map must stay positive when it acts on half of an entangled pair. The transpose ρ↦ρT (a reflection yβ†¦βˆ’y of the ball) maps the ball to itself, but it is not a quantum operation.

Explore

the Bloch sphere its image under the channel input state after each application Β· drag to turn
Channel

Worked example

Alice and Bob share |β00⟩, and Bob's qubit goes through a depolarising channel with parameter p. For which p do they still violate CHSH, and for which p are they still entangled?

  1. Find the shared state.

    The channel replaces Bob's qubit by I/2 with probability p. Since Alice's reduced state is I/2,

    ρ=(1βˆ’p)|Ξ²00⟩⟨β00|+pI4.
  2. What are the CHSH correlations now?

    The I/4 part has E=0 for every pair of settings, so E(a,b)=(1βˆ’p)cos⁑(aβˆ’b) and the best value is S=22(1βˆ’p). This exceeds 2 only when p<1βˆ’1/2β‰ˆ0.293.

  3. Is the state entangled for larger p? Use the partial transpose: a separable state stays positive under it.

    The partial transpose of |Ξ²00⟩⟨β00| is 12SWAP, with eigenvalues 12,12,12,βˆ’12. So the partial transpose of ρ has smallest eigenvalue βˆ’1βˆ’p2+p4, negative exactly when p<2/3. For two qubits this test is also sufficient, so ρ is entangled iff p<2/3.

  4. Put the two thresholds together.

    For 0.293<p<2/3 the pair is entangled but the CHSH test can't show it. Bell violation is a stronger property than entanglement. Its fidelity with |Ξ²00⟩, 1βˆ’3p/4, crosses 1/2 exactly at p=2/3.

Check your understanding

Apply the channel many times. Which channel drives every input to the same pure state?

  1. DepolarisingIt drives everything to the centre, I/2, which is mixed.
  2. Phase flipIt drives each state to the point on the z-axis below or above it, so different inputs end in different places.
  3. Amplitude damping
Amplitude damping with n applications is amplitude damping with Ξ³n=1βˆ’(1βˆ’Ξ³)nβ†’1, whose image is the single point |0⟩. It models a qubit relaxing to its ground state. Set n = 12 in the explorer.

A pure state goes through the depolarising channel with parameter p. What is the purity trρ2 of the output?

  1. 1βˆ’pThat's the length of the output Bloch vector. Purity is (1+|rβ†’|2)/2.
  2. (1+(1βˆ’p)2)/2
  3. 1βˆ’p/2That's the largest eigenvalue, (1+|rβ†’|)/2.
|rβ†’β€²|=1βˆ’p, and trρ2=(1+|rβ†’|2)/2. At p=1 it reaches the minimum 1/2.

The transpose map ρ↦ρT sends every qubit density operator to a density operator. Is it a quantum operation?

  1. Yes: it maps the Bloch ball onto itself.That shows it is positive. Quantum operations must be completely positive.
  2. No: applied to one half of |β00⟩ it produces an operator with a negative eigenvalue.
  3. Yes: it is unitary conjugation by Y.YρY flips both x and z; the transpose flips only y. A reflection is not a rotation.
Transposing Bob's half of |Ξ²00⟩⟨β00| gives 12SWAP, which has eigenvalue βˆ’12. A physical process on Bob's qubit must leave the joint state physical, so the transpose is not one. Unitaries act on the ball as rotations, never as reflections.

Practice

Two flips make a depolariser?Composing channels

Apply a bit flip with probability p and then a phase flip with probability q. Find the combined map on Bloch vectors. For which p,q is it a depolarising channel?

Solution

The scalings multiply: (x,y,z)↦((1βˆ’2q)x,Β (1βˆ’2p)(1βˆ’2q)y,Β (1βˆ’2p)z). Depolarising needs all three factors equal: 1βˆ’2q=1βˆ’2p and (1βˆ’2p)2=1βˆ’2p. So p=q=0 (no noise) or p=q=12 (everything sent to I/2). Otherwise the ellipsoid is squashed most along y.

Kraus operators for depolarising noiseUsing the Paulis

Find Kraus operators for ρ↦(1βˆ’p)ρ+pI/2.

Hint

For every qubit ρ, 14(ρ+XρX+YρY+ZρZ)=I/2.

Solution

Substituting, E(ρ)=(1βˆ’3p4)ρ+p4(XρX+YρY+ZρZ), so

E0=1βˆ’3p/4I,E1=p2X,E2=p2Y,E3=p2Z,

and βˆ‘Ek†Ek=(1βˆ’3p4+3p4)I=I.

From Nielsen and Chuang, Quantum Computation and Quantum Information (10th anniversary ed., Cambridge, 2010)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 8.22Amplitude damping on a general state

For ρ=(abbβˆ—c), show amplitude damping with E0=(1001βˆ’Ξ³), E1=(0Ξ³00) gives (1βˆ’(1βˆ’Ξ³)(1βˆ’a)b1βˆ’Ξ³bβˆ—1βˆ’Ξ³c(1βˆ’Ξ³)).

Hint

Compute E0ρE0† and E1ρE1† separately; use a+c=1.

Solution

E0ρE0†=(ab1βˆ’Ξ³bβˆ—1βˆ’Ξ³c(1βˆ’Ξ³)) and E1ρE1†=(Ξ³c000). The sum has top-left entry a+Ξ³c=a+Ξ³(1βˆ’a)=1βˆ’(1βˆ’Ξ³)(1βˆ’a), which is the claim.

Exercise 8.27Phase damping is a phase flip channel

Phase damping has operation elements E0=diag(1,1βˆ’Ξ»), E1=diag(0,Ξ»); the phase flip channel has E~0=Ξ±I, E~1=1βˆ’Ξ±Z with Ξ±=(1+1βˆ’Ξ»)/2. Find the unitary u with E~k=βˆ‘jukjEj.

Hint

Everything is diagonal, so match the two diagonal entries of each E~k. Write c=1βˆ’Ξ», so Ξ±=(1+c)/2 and 1βˆ’Ξ±=(1βˆ’c)/2.

Solution

The (1,1) entries force u00=Ξ± and u10=1βˆ’Ξ±. The (2,2) entries give u01Ξ»=Ξ±(1βˆ’c) and u11Ξ»=βˆ’1βˆ’Ξ±(1+c). Using Ξ»=(1βˆ’c)(1+c) these simplify to u01=1βˆ’Ξ±, u11=βˆ’Ξ±:

u=(Ξ±1βˆ’Ξ±1βˆ’Ξ±βˆ’Ξ±),

a real orthogonal (hence unitary) matrix.

Exercise 8.30T2≀T1/2

T1 is the decay time of the populations and T2 that of the coherences. Show that for amplitude damping T2=T1/2, and that adding phase damping can only make T2≀T1/2.

Hint

Iterate the result of Exercise 8.22 with 1βˆ’Ξ³=eβˆ’Ξ”t/T1.

Solution

After repeated amplitude damping, the excited population scales as (1βˆ’Ξ³)n and the coherence as (1βˆ’Ξ³)n/2. Writing (1βˆ’Ξ³)n=eβˆ’t/T1, the coherence decays as eβˆ’t/(2T1), so T2=2T1 in terms of timesβ€”i.e. the coherence decay rate is half the population decay rate. (Nielsen–Chuang phrase T1,T2 as rates here, giving "T2=T1/2"; in terms of times this is the familiar T2=2T1.)

Phase damping leaves populations alone and multiplies coherences by a further factor 1βˆ’Ξ»β‰€1 per step, adding a nonnegative rate to the coherence decay. So the coherence rate is at least half the population rate: T2≀2T1 as times (the book's T2≀T1/2 as rates).

InteractiveNielsen–Chuang, Ch. 9: Distance measures for quantum information

Trace distance and fidelity

How different are two quantum states? Trace distance answers operationally: it is the best advantage you can get in telling them apart with one measurement. Fidelity is a generalised overlap. On the Bloch ball both have pictures, and noise can only bring states closer.

The idea

Trace distance. D(ρ,Οƒ)=12tr|Οβˆ’Οƒ|, half the sum of the absolute eigenvalues of Οβˆ’Οƒ. For qubits it is half the Euclidean distance between Bloch vectors: D=12|rβ†’βˆ’sβ†’|.
What it means. D(ρ,Οƒ)=maxPtr(P(Οβˆ’Οƒ)) over projectors P. So if you are handed ρ or Οƒ with probability 12 each, the best measurement guesses right with probability 12+12D. For qubits the best measurement is along rβ†’βˆ’sβ†’.
Fidelity. F(ρ,Οƒ)=trρ1/2σρ1/2. For pure states F=|⟨ψ|Ο•βŸ©|, and F(|ψ⟩,Οƒ)=⟨ψ|Οƒ|ψ⟩. For qubits,
F2=12(1+rβ†’β‹…sβ†’+(1βˆ’|rβ†’|2)(1βˆ’|sβ†’|2)).
Noise only helps confusion. For every trace-preserving quantum operation, D(E(ρ),E(Οƒ))≀D(ρ,Οƒ) and F(E(ρ),E(Οƒ))β‰₯F(ρ,Οƒ). The two measures bound each other:
1βˆ’F ≀ D ≀ 1βˆ’F2,

with the upper bound an equality for pure states.

Explore

The x–z slice of the Bloch ball. Drag ρ and Οƒ . Hollow dots: the states after noise. best measurement axis
Try

Worked example

Compare |0⟩ and |+⟩: find D, F, the best measurement, and what depolarising noise with p=12 does. (Press "|0⟩ vs |+⟩" in the explorer.)

  1. Find the trace distance.

    rβ†’=(0,0,1), sβ†’=(1,0,0), |rβ†’βˆ’sβ†’|=2, so D=2/2β‰ˆ0.707.

  2. Find the fidelity, and check both bounds.

    F=|⟨0|+⟩|=1/2β‰ˆ0.707. Then 1βˆ’Fβ‰ˆ0.293≀0.707, and 1βˆ’F2=1/2β‰ˆ0.707: the upper bound is attained, as it must be for pure states.

  3. What measurement tells them apart best, and how often does it succeed?

    Measure along (rβ†’βˆ’sβ†’)/|rβ†’βˆ’sβ†’|=(βˆ’1,0,1)/2, halfway between |0⟩ and |βˆ’βŸ©; guess |0⟩ on outcome +1. Success probability 12+12β‹…0.707β‰ˆ0.854. Measuring Z instead gives only 0.75.

  4. After depolarising noise with p=12, recompute D and F.

    Both Bloch vectors halve: D′=0.354. With r→′⋅s→′=0 and |r→′|2=|s→′|2=14,

    Fβ€²2=12(1+0+34)=78,Fβ€²β‰ˆ0.935.

    Distance went down and fidelity up, as contractivity says.

Check your understanding

What is D(|0⟩,|1⟩)?

  1. 2The Bloch vectors are 2 apart, but D has a factor 12.
  2. 1
  3. 0.5Orthogonal states are perfectly distinguishable, the maximum.
D ranges from 0 to 1, and D=1 means a single measurement tells the states apart with certainty: here a Z measurement.

Two states have D=0.1. You get one copy of one of them, each with probability 12. What is the best chance of naming it correctly?

  1. 0.1Guessing blindly already gives 0.5.
  2. 0.55
  3. 0.9That would need the states to be nearly orthogonal.
The optimum is 12+12D. Trace distance is the advantage over a coin flip, doubled.

Can some quantum operation make two states more distinguishable?

  1. Yes, a suitable unitary.Unitaries preserve D exactly: they move the two Bloch points rigidly.
  2. Yes, a measurement that sharpens them.A measurement whose result is kept is also a trace-preserving operation, and it obeys the same bound.
  3. No, not if it is trace-preserving.
Contractivity: D(E(ρ),E(Οƒ))≀D(ρ,Οƒ). Processing can't create distinguishability; it can only preserve or lose it. Raise the noise in the explorer and watch D fall.

Practice

Pure versus maximally mixedBoth formulas

Compute D and F for |0⟩ and I/2, and check the bounds 1βˆ’F≀D≀1βˆ’F2.

Solution

D=12|(0,0,1)βˆ’0|=12. F=⟨0|I2|0⟩=1/2β‰ˆ0.707. Bounds: 0.293≀0.5≀0.707, both strict, because I/2 is mixed.

Commuting statesBack to classical distances

Suppose ρ=βˆ‘ipi|i⟩⟨i| and Οƒ=βˆ‘iqi|i⟩⟨i| are diagonal in the same basis. Show that D and F reduce to the classical distances between the distributions p and q.

Solution

Οβˆ’Οƒ=βˆ‘i(piβˆ’qi)|i⟩⟨i|, so D=12βˆ‘i|piβˆ’qi|, the classical total variation distance. And ρ1/2σρ1/2=βˆ‘ipiqi|i⟩⟨i|, so F=βˆ‘ipiqi, the Bhattacharyya overlap. The quantum measures are new only when the states don't commute.

From Nielsen and Chuang, Quantum Computation and Quantum Information (10th anniversary ed., Cambridge, 2010)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 9.6Two trace distances

Find the trace distance between 34|0⟩⟨0|+14|1⟩⟨1| and 23|0⟩⟨0|+13|1⟩⟨1|; then between the first state and 23|+⟩⟨+|+13|βˆ’βŸ©βŸ¨βˆ’|.

Hint

D(ρ,Οƒ)=12βˆ‘|eigenvalues ofΒ Οβˆ’Οƒ|. For qubits it is half the distance between Bloch vectors.

Solution

First pair: both diagonal, so D=12(|34βˆ’23|+|14βˆ’13|)=112.

Second pair: Bloch vectors (0,0,12) and (13,0,0). The distance between them is 14+19=136, so D=1312β‰ˆ0.300.

Exercise 9.12The depolarizing channel is strictly contractive

For E(ρ)=pI/2+(1βˆ’p)ρ, find D(E(ρ),E(Οƒ)) in Bloch terms and show it is strictly less than D(ρ,Οƒ) when ρ≠σ (and p>0).

Hint

What does E do to the Bloch vector?

Solution

E maps r→↦(1βˆ’p)rβ†’. Since D=12|rβ†’βˆ’sβ†’| for qubits,

D(E(ρ),E(Οƒ))=12(1βˆ’p)|rβ†’βˆ’sβ†’|=(1βˆ’p)D(ρ,Οƒ)<D(ρ,Οƒ)

whenever p>0 and r→≠s→.

Exercise 9.13The bit flip channel: contractive, not strictly

Show the bit flip channel ρ↦pρ+(1βˆ’p)XρX is contractive but not strictly contractive, and find its fixed points.

Hint

In Bloch terms, XρX flips the signs of ry and rz.

Solution

The channel maps (rx,ry,rz)↦(rx,(2pβˆ’1)ry,(2pβˆ’1)rz). Since |2pβˆ’1|≀1, distances between Bloch vectors never grow: contractive. But two states differing only in rx keep exactly the same distance, so it is not strictly contractive.

Fixed points (for pβ‰ 1): ry=rz=0, i.e. ρ=(I+rxX)/2 with |rx|≀1: the segment of the x-axis inside the Bloch ball. (For p=1 everything is fixed.)

SimulationNielsen–Chuang, Ch. 10: Quantum error-correction

The three-qubit bit-flip code

You can't copy an unknown qubit, and you can't look at it without disturbing it. Even so, α|0⟩+β|1⟩ can be spread over three qubits so that a single bit flip is found and undone without anyone learning α or β. Flip qubits by hand, then run thousands of noisy rounds.

The idea

Encoding. Ξ±|0⟩+Ξ²|1βŸ©β†¦Ξ±|000⟩+Ξ²|111⟩, by two CNOTs from the data qubit onto two fresh |0⟩s. This is an entangled state, not three copies.
Syndrome. Measure the parities Z1Z2 and Z2Z3. Both |000⟩ and |111⟩ (and their versions with the same qubit flipped) give the same values, so the measurement learns only which qubit, if any, was flipped:
(+,+):Β none,(βˆ’,+):Β qubit 1,(βˆ’,βˆ’):Β qubit 2,(+,βˆ’):Β qubit 3.
When it helps. If each qubit flips independently with probability p, the code fails only when two or more flip:
pL=3p2(1βˆ’p)+p3=3p2βˆ’2p3,

which is smaller than p for every p<12.

General codes. A code with projector P corrects a set of errors {Ei} iff PEi†EjP=Ξ±ijP for a Hermitian matrix (Ξ±ij). Correcting X, Y and Z on a qubit corrects every error on it (errors are discretised by the syndrome measurement). Nesting this code inside a phase-flip version of itself gives Shor's 9-qubit code, which corrects any single-qubit error.

Explore

no code: p with the code: 3p2βˆ’2p3 your simulated runs
One round by hand: flip these qubits

Worked example

Encode 0.6|0⟩+0.8|1⟩. Follow one round with a single error and one with a double error.

  1. Write the encoded state, and the state after an X error on qubit 2.

    0.6|000⟩+0.8|111⟩, and after X2: 0.6|010⟩+0.8|101⟩.

  2. What syndrome is measured, and what is the state afterwards?

    On both terms, qubits 1 and 2 differ and qubits 2 and 3 differ, so (Z1Z2,Z2Z3)=(βˆ’1,βˆ’1) with certainty. Since the outcome was certain, the state is undisturbed: 0.6 and 0.8 are untouched, and nobody learned them.

  3. Correct and decode.

    (βˆ’,βˆ’) points to qubit 2. Applying X2 restores 0.6|000⟩+0.8|111⟩, and reversing the encoder gives 0.6|0⟩+0.8|1⟩.

  4. Now suppose qubits 1 and 2 both flip. What happens?

    The state is 0.6|110⟩+0.8|001⟩, the syndrome is (+,βˆ’), which points to qubit 3. "Correcting" qubit 3 gives 0.6|111⟩+0.8|000⟩: a logical X. The decoded state is 0.8|0⟩+0.6|1⟩, whose overlap with the original is 0.6β‹…0.8+0.8β‹…0.6=0.96. The code has silently made an error; the fidelity happens to be high only because this particular state is close to its own image under X.

Check your understanding

An X error hits qubit 3 of α|000⟩+β|111⟩. What syndrome (Z1Z2,Z2Z3) is measured?

  1. (βˆ’,+)That pattern means qubit 1 disagrees with qubit 2.
  2. (+,βˆ’)
  3. It depends on α and β.Both terms, |001⟩ and |110⟩, have the same parities.
After the error the state is α|001⟩+β|110⟩. Qubits 1 and 2 agree, qubits 2 and 3 differ, in both terms. The syndrome is a fact about the error, not about the encoded data.

Why doesn't measuring Z1Z2 collapse the encoded superposition, when measuring Z1 would?

  1. |000⟩ and |111⟩ have the same Z1Z2 value but opposite Z1 values.
  2. Because two-qubit measurements never disturb states.A Bell measurement disturbs plenty. It's about which eigenspace the state lies in.
  3. It does collapse it, but the correction step undoes that.The correction is a fixed X, which can't restore lost amplitudes.
The encoded state lies entirely inside one eigenspace of Z1Z2, so the measurement has a certain outcome and leaves it alone. Z1 would distinguish |000⟩ from |111⟩, revealing |α|2 versus |β|2 and destroying the superposition.

Can this code correct a phase flip Z1?

  1. Yes, it corrects any single-qubit error.That's Shor's 9-qubit code, not this one.
  2. No: Z1 turns the codeword into another codeword, so the syndrome is trivial.
  3. Yes, by applying Z to all three qubits.The syndrome gives no sign that anything happened, so the decoder wouldn't know to.
Z1(Ξ±|000⟩+Ξ²|111⟩)=Ξ±|000βŸ©βˆ’Ξ²|111⟩: a logical Z, undetectable. To handle phase flips, encode in the |±⟩ basis instead; to handle both, nest the two codes.

Practice

Is it worth it?Numbers

At p=0.1, what is pL and by what factor has the code helped? At what p does the code stop helping?

Solution

pL=3(0.01)βˆ’2(0.001)=0.028, about 3.6 times better than 0.1. Solving 3p2βˆ’2p3=p gives p=12 (and p=0,1); the code helps for all 0<p<12. Check with the slider and "Run".

A small rotation, not a flipErrors are discretised

Instead of a flip, qubit 1 suffers the small rotation eβˆ’iΞ΅X1. Show that the syndrome measurement turns this into either no error or a full X1, and that the code then recovers the state exactly.

Solution

eβˆ’iΞ΅X1|ψL⟩=cos⁑Ρ|ψLβŸ©βˆ’isin⁑ΡX1|ψL⟩. The two terms lie in the syndrome spaces (+,+) and (βˆ’,+). The measurement picks the first with probability cos2⁑Ρ (leaving |ψL⟩) or the second with probability sin2⁑Ρ (leaving X1|ψL⟩, which is then corrected). Either way the result is |ψL⟩.

From Nielsen and Chuang, Quantum Computation and Quantum Information (10th anniversary ed., Cambridge, 2010)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 10.3Two parity checks equal the syndrome measurement

For the three-qubit bit flip code, show that measuring Z1Z2 and then Z2Z3 gives the same statistics and post-measurement states as measuring the four syndrome projectors P0=|000⟩⟨000|+|111⟩⟨111|, P1,P2,P3 (where Pj is P0 with bit j flipped).

Hint

Z1Z2 has projectors (IΒ±Z1Z2)/2. Multiply the projectors of the two measurements.

Solution

The outcome pair (a,b)∈{Β±1}2 occurs with operator Qab=I+aZ1Z22β‹…I+bZ2Z32. The two observables commute, so Qab is a projector, and it projects onto the computational basis states whose bits satisfy parity a on (1,2) and b on (2,3):

  • (+,+): |000⟩,|111⟩ β€” this is P0.
  • (βˆ’,+): |100⟩,|011⟩ β€” P1.
  • (βˆ’,βˆ’): |010⟩,|101⟩ β€” P2.
  • (+,βˆ’): |001⟩,|110⟩ β€” P3.

Since the sequential measurement has measurement operators Qab, its outcome probabilities ⟨ψ|Qab|ψ⟩ and post-measurement states Qab|ψ⟩/β€–β‹…β€– agree with those of the Pj after relabelling.

Exercise 10.4A syndrome measurement that is too nosy

For the three-qubit bit flip code, suppose the syndrome is found by measuring in the full computational basis (eight projectors |ijk⟩⟨ijk|). (1) How does the result diagnose the error? (2) Show recovery works only for computational basis states. (3) What is the minimum fidelity of this procedure?

Hint

The result tells you more than which bit flipped: it also tells you the logical bit, which destroys superpositions.

Solution

(1) The projectors are |ijk⟩⟨ijk|. After at most one flip of |000⟩ or |111⟩, a result with majority value m and minority position j says "bit j flipped" (or no flip if all three agree). Flip it back.

(2) The measurement collapses a|000⟩+b|111⟩ (possibly with a flip) to |000⟩ or |111⟩ with probabilities |a|2,|b|2. Recovery then returns |000⟩ or |111⟩, not the superposition. It is correct only if ab=0.

(3) The output is ρ=|a|2|000⟩⟨000|+|b|2|111⟩⟨111|, with fidelity ⟨ψ|ρ|ψ⟩=|a|4+|b|4. This is smallest at |a|2=|b|2=12: minimum fidelity 1/2, and that is even without any error.

InteractiveNielsen–Chuang, Ch. 11: Entropy and information

Entropy and entanglement

Shannon entropy measures the uncertainty of a random variable; von Neumann entropy does the same for a quantum state. For a pure state of two qubits, the entropy of either half measures how entangled they are. Set the four amplitudes and watch it.

The idea

Shannon entropy. H(p)=βˆ’βˆ‘ipilog2⁑pi bits. For two outcomes, the binary entropy H(p)=βˆ’plog2⁑pβˆ’(1βˆ’p)log2⁑(1βˆ’p), which peaks at 1 bit when p=12.
Von Neumann entropy. S(ρ)=βˆ’tr(ρlog2⁑ρ)=H(Ξ»), the Shannon entropy of the eigenvalues of ρ. S=0 exactly for pure states, and S≀log2⁑d in dimension d.
Two halves of a pure state. If |ψ⟩AB is pure, S(ρA)=S(ρB): both reduced states have the Schmidt coefficients squared as eigenvalues. This common value is the entropy of entanglement, 0 for product states and 1 bit for Bell states.
Quantum oddities. Subadditivity S(A,B)≀S(A)+S(B) holds as classically, but the whole can have less entropy than a part: for a Bell state S(A,B)=0<S(A)=1. Measuring ρ in any basis gives outcomes with Shannon entropy at least S(ρ), with equality in the eigenbasis.

Explore

Binary entropy H(λ). S(ρA) at the smaller eigenvalue λ Shannon entropy of a Z measurement on A
The reduced states in the x–z slice of the Bloch ball. ρA ρB

Worked example

Find the entropy of entanglement of |ψ⟩=15(|00⟩+2|01⟩+2|10⟩), and compare it with the entropy of a Z measurement on qubit A. (It is a preset in the explorer.)

  1. Arrange the amplitudes in a matrix C (rows: A, columns: B) and compute ρA=CC†.

    C=15(1220),ρA=CC†=15(3222).
  2. Find the eigenvalues of ρA.

    Trace 1, determinant (6βˆ’2)/25=4/25. The eigenvalues solve Ξ»2βˆ’Ξ»+425=0: Ξ»=0.8 and 0.2. (Also detρA=|detC|2=(2/5)2.) The Schmidt coefficients are 0.8 and 0.2.

  3. Compute S(ρA).

    S=H(0.2)=βˆ’0.2log2⁑0.2βˆ’0.8log2⁑0.8β‰ˆ0.464+0.258=0.722 bits.

  4. What is the Shannon entropy of a Z measurement on A alone?

    p(A=0)=ρ00=0.6, so H(0.6)β‰ˆ0.971 bits, more than 0.722. The Z basis isn't ρA's eigenbasis (the off-diagonal entry is nonzero), so measuring in it adds uncertainty.

Check your understanding

A pure two-qubit state has S(ρA)=1. What is S(ρAB)?

  1. 2Subadditivity gives an upper bound, S(A,B)≀S(A)+S(B)=2, not the value.
  2. 1The joint state is pure.
  3. 0
Pure states have zero entropy. The whole is perfectly known while each part is maximally uncertain, which has no classical analogue: classically H(X,Y)β‰₯H(X).

Which is more entangled: cos⁑π8|00⟩+sin⁑π8|11⟩, or 12(|00βŸ©βˆ’|01⟩+|10βŸ©βˆ’|11⟩)?

  1. The first.
  2. The second: it has four terms.It factors as |+βŸ©βŠ—|βˆ’βŸ©.
  3. They are equally entangled.The second is a product state, with entropy 0.
The first is already in Schmidt form with Ξ»2=sin2⁑π8β‰ˆ0.146, giving H(0.146)β‰ˆ0.60 bits. The second has amplitude matrix C=12(1βˆ’11βˆ’1) with detC=0, so it is a product.

ρ has eigenvalues 0.9 and 0.1. You measure it in a basis that is not its eigenbasis. The Shannon entropy of the outcomes is

  1. exactly H(0.1)β‰ˆ0.47 bits.That equality holds only in the eigenbasis.
  2. less than 0.47 bits.The eigenbasis is the basis that minimises the outcome entropy.
  3. more than 0.47 bits.
The outcome probabilities are averages of the eigenvalues, pj=βˆ‘i|⟨j|ei⟩|2Ξ»i, which makes them more even unless the basis is the eigenbasis. More even means more entropy. This is how the explorer's gold point stays at or above the blue one.

Practice

Entropy of an ensembleQuantum entropy can be smaller

A source emits |0⟩, |1⟩ or |+⟩, each with probability 13. Compute S(ρ) and compare it with the Shannon entropy log2⁑3 of the source's choice.

Solution

Averaging Bloch vectors, rβ†’=13(0,0,1)+13(0,0,βˆ’1)+13(1,0,0)=(13,0,0). The eigenvalues are (1Β±|rβ†’|)/2=23,13, so S=H(13)β‰ˆ0.918 bits, less than log2⁑3β‰ˆ1.585. Because the states aren't orthogonal, ρ holds less entropy than the label that picked them.

Equal entropiesFrom the Schmidt decomposition

Show that S(ρA)=S(ρB) for every pure state |ψ⟩AB, even when A and B have different dimensions.

Solution

Write |ψ⟩=βˆ‘iΞ»i|iA⟩|iB⟩. Then ρA=βˆ‘iΞ»i2|iA⟩⟨iA| and ρB=βˆ‘iΞ»i2|iB⟩⟨iB|: the same nonzero eigenvalues. Extra zero eigenvalues in the larger system add nothing to the entropy.

From Nielsen and Chuang, Quantum Computation and Quantum Information (10th anniversary ed., Cambridge, 2010)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 11.11Three entropies

Compute S(ρ) for (1000), 12(1111) and 13(2111).

Hint

Find the eigenvalues; S=βˆ’βˆ‘Ξ»log2⁑λ.

Solution

The first two are pure (eigenvalues 1,0; the second is |+⟩⟨+|), so S=0.

The third has trace 1 and determinant 19, so eigenvalues λ±=3Β±56β‰ˆ0.873,0.127. Then S=βˆ’Ξ»+log2⁑λ+βˆ’Ξ»βˆ’log2β‘Ξ»βˆ’β‰ˆ0.550 bits.

Exercise 11.12Quantum entropy below the classical one

Let ρ=p|0⟩⟨0|+(1βˆ’p)|+⟩⟨+|. Compute S(ρ) and compare it with H(p,1βˆ’p).

Hint

Find the eigenvalues from trace and determinant.

Solution

ρ=(1+p21βˆ’p21βˆ’p21βˆ’p2) has trace 1 and determinant p(1βˆ’p)2, so eigenvalues λ±=12(1Β±p2+(1βˆ’p)2) and S(ρ)=H(Ξ»+).

Since p2+(1βˆ’p)2β‰₯(2pβˆ’1)2 (equivalent to p(1βˆ’p)β‰₯0), Ξ»+β‰₯max(p,1βˆ’p), so the eigenvalue distribution is more lopsided than (p,1βˆ’p) and S(ρ)≀H(p), with equality only for p∈{0,1}. Mixing non-orthogonal states costs less entropy than mixing distinguishable ones. (At p=12: Sβ‰ˆ0.60 versus H=1.)

Exercise 11.14Entangled iff S(B|A)<0

For a pure state |AB⟩, show it is entangled iff S(B|A)=S(A,B)βˆ’S(A)<0.

Hint

For a pure joint state, S(A,B)=0 and S(A)=S(B).

Solution

S(A,B)=0 for a pure state, so S(B|A)=βˆ’S(A). This is negative iff S(A)>0, iff ρA is mixed, iff (by Exercise 2.78) |AB⟩ is not a product state, i.e. is entangled.

SimulationNielsen–Chuang, Ch. 12: Quantum information theory

Quantum key distribution

Learning anything about a non-orthogonal state disturbs it. The BB84 protocol turns that into security: an eavesdropper who gains information about the key leaves errors that Alice and Bob can measure. Send qubits with and without Eve on the line.

The idea

BB84. For each round Alice picks a random bit and a random basis, Z or X, and sends |0⟩,|1⟩ or |+⟩,|βˆ’βŸ©. Bob measures in a random basis. Afterwards they announce the bases (not the bits) and keep only the rounds where the bases agree (sifting, about half). They reveal a random sample of the kept bits to estimate the error rate, then use error correction and privacy amplification to distil a shorter secret key.
Information gain causes disturbance. Any interaction that lets Eve learn something about which of two non-orthogonal states was sent must change at least one of them. (If it didn't, Eve could use it to copy or distinguish them, contradicting no-cloning.)
Intercept–resend. If Eve measures a fraction f of the qubits in a random basis and resends what she saw, she picks the wrong basis half the time, and then Bob's sifted bit is random. The error rate in the sifted key is f/4.
Security threshold. The Shor–Preskill proof shows a secret key can be extracted at rate 1βˆ’2H(e) per sifted bit when the error rate is e. This is positive for e≲11%.
Holevo bound. If Alice encodes x in states ρx with probabilities px, the information Bob can obtain by any measurement is at most Ο‡=S(βˆ‘xpxρx)βˆ’βˆ‘xpxS(ρx). For one qubit, χ≀1 bit.

Explore

One column per qubit. Bases: + is Z, Γ— is X. rounds Eve intercepted kept after sifting Bob's bit differs from Alice's

Worked example

Eve intercepts every qubit (f=1), measuring each in a random basis and resending the state she found. Work out the error rate she causes, how much she learns, and how quickly she is caught.

  1. Consider a sifted round (Alice and Bob used the same basis). What happens if Eve guessed that basis too?

    She gets Alice's bit exactly and resends the same state. No error, and Eve knows the bit.

  2. And if Eve used the other basis?

    Her result is random and she resends, say, |+⟩ when Alice sent |0⟩. Bob measures in Alice's basis and gets a random bit: an error with probability 12.

  3. Combine the cases: error rate and Eve's chance of knowing a sifted bit.

    Error rate 12β‹…0+12β‹…12=14. Eve's guess at a sifted bit is right with probability 12β‹…1+12β‹…12=34. If she intercepts only a fraction f of the qubits, the error rate is f/4.

  4. Alice and Bob compare 20 sifted bits. How likely is it that they see no error at all?

    (3/4)20β‰ˆ0.003. Comparing a few dozen bits catches a full intercept–resend attack almost surely. Partial attacks are subtler, which is why the protocol estimates the rate and then distils the key.

Check your understanding

Why does Alice use two bases rather than just |0⟩ and |1⟩?

  1. Orthogonal states can be measured and resent perfectly, so Eve would leave no trace.
  2. To double the key rate.Sifting throws half the rounds away, so two bases lower the raw rate.
  3. Because a single basis would violate the Holevo bound.One bit per qubit in one basis is exactly at the Holevo bound, not beyond it.
Disturbance is forced only for non-orthogonal states. Mixing two conjugate bases means Eve can't know which basis to measure in without knowing Alice's choice, which is revealed only after the qubit has reached Bob.

Eve intercepts every qubit with a randomly chosen basis. What error rate do Alice and Bob see in the sifted key?

  1. 50%She only chooses the wrong basis half the time.
  2. 25%
  3. 12.5%That would be the rate if she intercepted half the qubits.
Wrong basis with probability 12, then a random result for Bob with probability 12 of disagreement. Set the slider to 100% and send 10,000 qubits.

Alice sends one qubit, prepared in any of infinitely many states. How much classical information can Bob extract, at most?

  1. Unlimited: the amplitudes are continuous.Bob can't read amplitudes, only sample outcomes.
  2. 1 bit
  3. 2 bitsThat's superdense coding, which needs a pre-shared entangled pair.
Holevo: χ≀S(ρ)≀log2⁑2=1. A qubit has a continuum of states but carries at most one classical bit.

Practice

A lazy eavesdropperAlways the same basis

Eve intercepts every qubit but always measures in the X basis. What error rate does she cause in the sifted key, and what does she learn?

Solution

In sifted rounds where Alice used Z (half of them), Eve's basis is wrong and Bob errs with probability 12; in rounds with X there is no error. Error rate: 14, the same as before. She learns every X-basis bit exactly and nothing about the Z-basis ones, so after the bases are announced she knows exactly which of her bits are good.

How much key survives?The Shor–Preskill rate

Alice and Bob measure an error rate of 5% in their sifted key. Using the rate 1βˆ’2H(e), what fraction of the sifted bits becomes secret key? What about at 11%?

Solution

H(0.05)β‰ˆ0.286, so the rate is 1βˆ’0.573β‰ˆ0.43: about 43 key bits per 100 sifted bits. At 11%, H(0.11)β‰ˆ0.4999 and the rate is essentially zero. One H(e) pays for error correction and the other for privacy amplification.

From Nielsen and Chuang, Quantum Computation and Quantum Information (10th anniversary ed., Cambridge, 2010)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 12.27How random sampling bounds the errors

In BB84, n of 2n bits are chosen at random as check bits. Suppose ΞΌn of the 2n bits are in error. Show that the probability of seeing fewer than Ξ΄n errors in the check bits while more than (Ξ΄+Ο΅)n errors are in the rest is exp⁑(βˆ’O(Ο΅2n)). Use (2nn)βˆ’1(ΞΌnΞ΄n)((2βˆ’ΞΌ)n(1βˆ’Ξ΄)n) as a bound, the estimate (anbn)β‰ˆ2anH(b/a), and H(x)<1βˆ’2(xβˆ’12)2.

Hint

The check set is a uniformly random half, so the number of errors in it is hypergeometric. The dominating configuration has Ξ΄=(ΞΌβˆ’Ο΅)/2; compare it with the balanced split ΞΌ/2.

Solution

(1) Total errors ΞΌn; a bad event means check errors <Ξ΄n and rest >(Ξ΄+Ο΅)n, so Ξ΄n+(Ξ΄+Ο΅)n<ΞΌn, i.e. the split is at least Ο΅n away from even. The number of ways to pick a check set with exactly kn errors is (ΞΌnkn)((2βˆ’ΞΌ)n(1βˆ’k)n); summing over the at most n+1 bad k and dividing by (2nn) gives the bound, up to a polynomial factor, at k=Ξ΄=(ΞΌβˆ’Ο΅)/2.

(2) The entropy estimate turns the exponent into n[ΞΌH(δμ)+(2βˆ’ΞΌ)H(1βˆ’Ξ΄2βˆ’ΞΌ)βˆ’2], up to O(log⁑n).

(3) Each H is below 1βˆ’2(β‹…βˆ’12)2. With Ξ΄ΞΌβˆ’12=βˆ’Ο΅2ΞΌ and 1βˆ’Ξ΄2βˆ’ΞΌβˆ’12=Ο΅2(2βˆ’ΞΌ), the bracket is at most βˆ’Ο΅22(1ΞΌ+12βˆ’ΞΌ)β‰€βˆ’Ο΅22, since 1ΞΌ+12βˆ’ΞΌβ‰₯1 on [0,2] (worst case ΞΌ=1). So p≀poly(n)2βˆ’Ο΅2n/2=exp⁑(βˆ’O(Ο΅2n)).

(4) The same order follows from a Hoeffding/Chernoff bound for sampling without replacement (Hoeffding's inequality also holds for the hypergeometric distribution): the check-set error fraction concentrates within Ο΅/2 of ΞΌ/2 with probability 1βˆ’2eβˆ’Ξ©(Ο΅2n).

Exercise 12.29The six-state protocol

Design a key distribution protocol using all six eigenstates of X, Y and Z, argue it is secure, and compare its noise and eavesdropping sensitivity with BB84 and B92.

Hint

Run BB84 with three bases instead of two. Ask how much error an intercept–resend attack causes, and what fraction of bits survive sifting.

Solution

Protocol. Alice picks a random basis from {X,Y,Z} and a random bit, and sends the corresponding eigenstate. Bob measures in a random basis from the same three. They announce bases, keep the rounds where the bases agree (one third of them), sacrifice a random subset to estimate the error rate, then do error correction and privacy amplification as in BB84.

Security. As in BB84, the states are drawn from mutually unbiased bases, so any measurement by Eve that gains information disturbs some of them, and the error estimate on the check bits bounds her information. The same entanglement-purification argument applies: the six states are the BB84 states plus the Y pair, and symmetrising over three bases makes the effective channel depolarizing.

Comparison. An intercept–resend attack in a random one of three bases causes a 1/3 error rate on sifted bits (versus 1/4 in BB84), so eavesdropping is easier to detect, and the tolerable noise threshold is higher (about 12.6% versus 11% with one-way post-processing). The cost is efficiency: only 1/3 of rounds survive sifting (versus 1/2). B92 uses only two non-orthogonal states; it is simpler but keeps fewer bits and tolerates much less noise, and is vulnerable to attacks exploiting channel loss.