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.
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
is the north pole, the south pole, and and sit on the equator along and . The common gates are
Explore
Worked example
Find the rotation performed by the gate (first , then ), and what happens if you apply it three times.
Where does send the three Bloch axes , , ?
is a half turn about . A half turn swaps the two axes symmetric about its axis and reverses the one perpendicular to it: , , . Check: and .
And ?
A quarter turn counterclockwise about : , , . Indeed .
Compose them. What does do to the axes, and what rotation is that?
, , . So cycles . A rotation that permutes the axes cyclically fixes the diagonal and turns by a third of a full turn. The cycle is about that axis, so ours, the reverse cycle, is
Try it in the explorer: start at and press H, S three times over. Then compute exactly.
The state goes on the sphere, as the cycle predicts. Three thirds of a turn is the identity rotation, so is a multiple of . Multiplying the matrices gives
The phase 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)?
- and (normalised)These differ by the global factor . Every probability is unchanged by a global phase.
- and (normalised)
- and multiplies the whole state, so it is a global phase.
What is ?
- Exactly
- : eight eighth-turns make a full turn, and is indeed , but is times the phase , and that phase also gets raised to the 8th power.
- and , so is . Keep going.
The Bloch vectors of two pure states make an angle of . What is ?
- Orthogonal states are antipodal ( apart), not perpendicular.
- That's , before squaring.
Practice
Locate a stateFrom amplitudes to the Bloch vector
Find the Bloch vector of .
Hint
For , the Bloch vector is .
Solution
, so , and . Check: . The state is just below the equator, halfway between and .
A square root of NOTRotations by half the angle
Find a unitary with , and describe it on the Bloch sphere.
Hint
is a half turn about , so try a quarter turn about , and fix the phase afterwards.
Solution
. Multiplying by fixes the phase, since :
On the sphere is a quarter turn about . (Rx in the explorer with θ = π/2 does the same rotation, with a different global phase.)
More practice: Nielsen–Chuang, Exercises 4.1, 4.4 and 4.6.
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
Alice measures, gets with probability whatever is, and sends the two bits. Bob applies then and holds .
Watch
- Alice holds an unknown qubit . Two more qubits start in . No branch shows on Bob's side yet.
- and CNOT make the Bell pair . Alice keeps one half, Bob takes the other.
- Alice applies CNOT from to her half of the pair. Bob's branches are now or : only the amplitudes' sizes have moved, not the phase.
- Alice applies to her first qubit. Every branch is now equally likely and holds up to a Pauli: .
- Alice measures and gets . The other branches vanish; Bob holds but doesn't yet know which.
- The two bits reach Bob. He applies , then , and now holds exactly . Alice's copy is gone.
Worked example
Suppose Alice and Bob share instead of , and Alice does exactly the same steps. Which correction must Bob apply for each result?
Write as a one-qubit operation on Bob's half of .
, and then gives . So .
Why can we pretend Bob applied at the very start?
Alice's CNOT, and measurement act only on her two qubits, and acts only on Bob's. Operators on different qubits commute, so the extra can be moved past all of Alice's steps.
So what does Bob hold after Alice reports ?
Up to a sign, . He must undo this with (read right to left: apply first).
Simplify the four corrections.
Using and :
Check : Bob holds 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?
- Then Alice could signal instantly, by choosing and letting Bob measure.
- That's correct only for someone who knows . Bob doesn't.
- The maximally mixed state , whatever is
Is entangled?
- Yes: all four basis states appear.The number of terms depends on the basis. Try to factor it.
- No: it is .
- Yes: it's one of the Bell states.Each Bell state has only two terms in this basis.
Why does Alice apply to 's qubit before measuring?
- Without it, Bob's branch states are just or , and the phase of would be lost in the measurement.
- It is part of making the Bell pair.The Bell pair's acts on Alice's other qubit, earlier in the circuit.
- It only changes a global phase, so it could be skipped.Scrub the animation to just before the : Bob's branches are or , not copies of .
Practice
Back from the Bell basisChange of basis
Express and as combinations of Bell states.
Hint
Add and subtract Bell states that contain the same two basis vectors.
Solution
, so . Similarly , so .
Teleporting entanglementEntanglement swapping
Charlie and Alice share , and Alice and Bob share another . 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 .
Solution
The protocol maps to (after Bob's correction) for each basis state , with the same correction for both terms, since the correction depends only on Alice's outcome. By linearity Charlie and Bob share , though Charlie and Bob never interacted.
More practice: Nielsen–Chuang, Exercises 1.2, 2.69 and 4.33.
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
Explore
Worked example
A qubit is prepared in (the "tilted" preparation in the explorer). Predict its and statistics, then check them against its density matrix.
What are the probabilities in the basis?
and , so .
What is for an measurement?
, so
Find the Bloch vector and confirm .
gives , and . So , and . The -component is , as it should be.
Write and compute .
In the explorer, run 1000 shots in : the frequency should land within about of 0.933.
Check your understanding
Preparation A: or , each with probability . Preparation B: or , each with probability . Can any measurement tell A from B?
- Yes: measure . B always gives a definite outcome.Each member of B has a definite value, but you don't know which member was sent. Try both in the explorer.
- Only a measurement on many copies at once.Even joint measurements on many copies see , which is the same for A and B.
- No: both have .
A qubit has Bloch vector . What is the mean value of the observable ?
- That's the probability of the outcome . The mean is .
- Squaring belongs to amplitudes, not to Bloch components.
You measure on 100 fresh copies of and get 58 zeros. What should you conclude?
- The source is not producing .How big a fluctuation is normal for 100 shots?
- Nothing alarming: the count has standard deviation 5, so 58 is 1.6 standard deviations from 50.
- Earlier measurements disturbed the later copies.Each shot uses a fresh copy, so earlier outcomes have no effect.
Practice
Purity on the Bloch ballPure states live on the surface
Show that for a qubit, and conclude that is pure exactly when .
Hint
, because the Pauli matrices anticommute and square to .
Solution
, and the Paulis are traceless, so . A density operator is pure iff (its eigenvalues are then 1 and 0), i.e. iff .
An ensemble on two axesFrom an ensemble to
A source emits or , each with probability . Find , its Bloch vector, its purity, and the probability of outcome 0 in a measurement.
Solution
Bloch vectors average: . Then
with purity , so the state is mixed. , which matches .
More practice: Nielsen–Chuang, Exercises 2.59, 2.61, 2.71 and 2.72.
Entanglement and Bell's inequality
If every measurement result were fixed in advance by shared local information, one combination of correlations, the CHSH quantity , could never exceed 2. Entangled qubits reach . Turn the four measurement directions and run the experiment.
The idea
where is the average of the product of the two results.
is the largest value quantum mechanics allows (Tsirelson's bound).
Explore
Worked example
The explorer uses . Work out the correlations of the singlet instead, and find its best CHSH value.
Compute , and in the singlet.
multiplies both and by : mean . swaps , turning the singlet into minus itself: mean . maps it to , which is orthogonal to it: mean 0. Likewise .
Expand .
The singlet is perfectly anticorrelated along every common axis.
Evaluate at the settings that give for .
Every correlation changes sign, so . The inequality really bounds : local models satisfy , because . Relabelling Bob's outcomes () turns the singlet's into .
Where exactly does the local argument fail for quantum systems?
It assumes all four values exist in every run. In the quantum experiment only one setting per side is measured, and and don't commute, so there is no joint value of and to plug into the identity.
Check your understanding
Alice and Bob share . Alice measures in some basis of her choice, then Bob measures . Does Alice's choice change the probabilities Bob sees?
- Yes: her measurement collapses his qubit.It collapses to a state that depends on her random outcome. Average over that outcome.
- No: Bob's reduced state is whatever she does.
- Only if she measures too.Then the outcomes are correlated, but Bob's own frequencies are still 50/50.
Point all four directions along (). What is for ?
- 0Every correlation is here, not 0; only the signs in can cancel them.
- 2
- 4One of the four terms enters with a minus sign.
- That needs the directions spread out by steps.
An experiment measures . What has it ruled out?
- Quantum mechanics.Quantum mechanics predicts values up to .
- Every model in which outcomes are fixed by shared local variables and neither side's setting affects the other's result.
- Entanglement between the two qubits.The other way around: unentangled (separable) states always satisfy , so a violation certifies entanglement.
Practice
Four terms, two in disguiseA Schmidt decomposition
Find the Schmidt decomposition and for .
Hint
Group the terms by the first qubit.
Solution
. This is a Schmidt form with , so the state is maximally entangled and . (Its amplitude matrix is , and .)
Product states obey CHSHNo entanglement, no violation
Show that for every product state , whatever the four settings.
Hint
For a product state, . Use .
Solution
With ,
Mixtures of product states inherit the bound, since is linear in .
More practice: Nielsen–Chuang, Exercises 2.75, 2.78 and 2.79.
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
Worked example
Build a reversible circuit that computes (AND of three bits) into a target bit, using Toffoli gates and one scratch bit , and leave the scratch bit clean. Then see why the cleaning matters quantum mechanically.
One Toffoli computes the AND of two bits. How?
Toffoli with gives .
Now get into the target (initially 0).
Toffoli gives . The scratch bit still holds : this is garbage.
Why is the garbage harmful on a quantum computer?
On a superposition of inputs the circuit produces instead of . 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.
Clean up .
Apply Toffoli once more: . Nothing it depends on () has changed, so the uncomputation is exact. The circuit is three Toffolis, and its output is .
Generalise to the AND of bits. How many Toffolis and scratch bits?
Chain the partial ANDs into scratch bits, with the last Toffoli writing into the target: gates. Uncompute the scratch bits in reverse order: more. Total Toffolis and clean scratch bits; for , three Toffolis and one scratch bit, as above.
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 , so it carries bits. The gate erases about bits, so it must dissipate at least per use. The reversible version keeps , erases nothing, and has no such floor.
Check your understanding
A Toffoli gate gets inputs . What is its third output?
- The target starts at 1, so it becomes .
- , the NAND
- Toffoli multiplies the controls; XOR would need two CNOTs.
Why must every gate in a quantum circuit be reversible?
- Closed quantum evolution is unitary, and unitaries are invertible.
- To avoid Landauer heat, which would destroy the qubits.Heat is a practical concern; the requirement is more basic than that.
- Because of the no-cloning theorem.No-cloning forbids copying unknown states; reversibility comes from unitarity itself.
Which of these is known to be true?
- NP BQPOpen, and widely doubted: search gives only a square-root speed-up for unstructured problems.
- Factoring is NP-completeFactoring (as a decision problem) lies in NP ∩ co-NP, which makes NP-completeness unlikely.
Practice
A reversible ORDe Morgan with a Toffoli
Using one Toffoli and some NOT gates, compute into a target bit and leave unchanged.
Hint
.
Solution
NOT and , apply Toffoli onto a target that starts at 1 (giving ), then NOT and 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 : if the output is , otherwise ; the third output is . Input : if the output is , otherwise ; the third output is , and the second is a copy of .
More practice: Nielsen–Chuang, Exercises 3.29, 3.31 and 3.32.
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
Explore
Worked example
Load "Deutsch–Jozsa" in the simulator. It tests whether is constant or balanced with one call to the oracle , here for , built from two CNOTs into the third wire. Work through the circuit by hand.
After on wire 3 and on all three wires, what is the state?
.
What does the oracle do to ?
: phase kickback. So the state becomes
Apply to wires 1 and 2. What is measured?
, so the result is : wires 1 and 2 read with certainty. The simulator shows probability on each of and because wire 3 is .
What would a constant give, and why does this decide the question?
For constant the kickback is a global sign, the first two wires stay , and the final s return . For any balanced , the amplitude of after the final s is . So "00" means constant and anything else means balanced. Remove one CNOT from the oracle (it becomes or , still balanced) and check that 00 still never appears.
Check your understanding
In a CZ gate, which qubit is the control?
- The top one, by convention.Write out its matrix and swap the qubits.
- Either: CZ is symmetric.
- The one in state .Control is a role in the circuit, not a property of the state.
on wire 1 then CNOT 1→2 turns into a Bell state. What if the CNOT comes first and the second?
- The same Bell state.Look at what the CNOT does when its control is .
- The product state .
- A different Bell state.No entangling step acts on a superposition, so no entanglement can appear.
Control in , target in . What does a CNOT produce?
- , unchanged.The target is unchanged. The control is not.
- An entangled state.The target is an eigenvector of , so the output stays a product.
Practice
Three-qubit GHZ stateEntangled, but each pair is not
Give a circuit that makes from . Then trace out qubit 3 and decide whether qubits 1 and 2 are entangled with each other.
Solution
on wire 1, then CNOT 1→2 and CNOT 2→3 (the "GHZ" preset). Tracing out qubit 3 gives , a classical mixture of product states: perfectly correlated, but not entangled. Each single qubit has purity , the minimum.
Kickback from controlled-SReading off an eigenvalue
A controlled- gate has its control in and its target in . What is the output, and how could you tell the phase from a measurement of the control?
Hint
is an eigenvector of . With which eigenvalue?
Solution
, so the output is . Measuring the control in the basis gives with certainty; in the basis it gives each outcome half the time. Phase estimation generalises this: controlled powers of write the eigenphase into a register, and an inverse Fourier transform reads it out.
More practice: Nielsen–Chuang, Exercises 4.13, 4.17 and 4.20.
Fourier transform and period finding
Shor's algorithm turns factoring into finding the period of . 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 and .
The idea
It is unitary and needs only gates (Hadamards and controlled phase rotations), against steps for the classical fast Fourier transform of numbers. The catch: the output amplitudes can't be read, only sampled.
Explore
Worked example
Factor with and counting qubits (). Set the explorer to the same values to follow along.
What is the order of 2 modulo 21? (The quantum computer finds this; we check it by hand.)
. So .
Where are the peaks of ?
Near : . Since 6 doesn't divide 512, the peaks spill onto neighbouring .
Suppose the measurement gives . Expand as a continued fraction and list the convergents.
, so , with convergents
The last convergent with denominator below is , so the candidate is . Check: .
Turn into factors.
is even and . Then and , and .
What if the measurement had given ?
, convergents . The candidate is , but . Here shares the factor 2 with , and reduced to . Trying the multiple works.
Check your understanding
, (order 4), . Which outcomes can occur?
- Any , with peaks near multiples of 64.When divides the cancellation away from the peaks is exact.
- Only , each with probability .
- Only , which gives directly. is uniformly random in , so all four peaks are equally likely.
You measure . What do you learn?
- Nothing: , the candidate order is 1, and you run again.
- That .The order is at most , far below .
- That is a bad choice. (that is, ) has probability about for every .
Why take ?
- The QFT only works when is a perfect square.The QFT works for every .
- Then , which guarantees is a convergent of .
- To make the peaks wider and easier to hit.Larger makes the peaks narrower relative to their spacing.
Practice
The four-point transformQFT by hand
Write the matrix of the QFT for , check that for it is , and show that applying the transform twice sends to .
Solution
With , the entries are :
, which is 1 when and 0 otherwise. So , and .
Exact peaksWhy gives a clean comb
Let divide and . Show that the QFT of is .
Hint
The amplitude of contains the geometric sum .
Solution
The amplitude of is . The sum is if , i.e. , and 0 otherwise. At the amplitude is . The offset only affects phases, so measuring first changes nothing about .
More practice: Nielsen–Chuang, Exercises 5.10, 5.18 and 5.19.
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 steps reach a marked item, and further steps overshoot.
The idea
Explore
Worked example
Search items with one marked item, tracking the actual amplitudes. (Set , in the explorer.)
What is , and what does the formula predict for ?
, so . The success probabilities are . Best is , close to .
Do the first iteration with amplitudes. All 16 start at .
Oracle: the marked amplitude becomes . The mean is . Inversion about the mean: unmarked ; marked . Probability , as predicted.
Do the second and third iterations.
Second: mean ; unmarked , marked , probability . Third: mean ; unmarked , marked , probability .
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 . A classical search with 3 queries succeeds with probability only , or if you guess one of the unchecked items at the end.
Check your understanding
, one marked item. Roughly how many iterations give the best chance of success?
- About 20That's . Search is quadratically faster than classical, not exponentially.
- About 800
- About 500,000That's the average for a classical search.
You run twice the optimal number of iterations. The success probability is then
- close to 1, since extra iterations can't hurt.The iteration is a rotation, and it keeps turning past .
- close to 0.
- about 1/2.After twice the optimum the angle is close to , not .
What does the oracle step alone do to the measurement probabilities?
- It raises the probability of the marked items.It only flips the sign of their amplitudes.
- Nothing: it changes signs, and probabilities are squared magnitudes.
- It sets the marked amplitudes to zero.A unitary can't destroy amplitude; it reflects it.
Practice
Eight itemsChoosing the number of iterations
For and , find , the best number of iterations, and its success probability.
Solution
gives . The angles are for , with probabilities . Best is , at about .
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
, so and after one iteration the angle is : the state is exactly . (With amplitudes: after the oracle the mean is , so unmarked amplitudes become 0.)
More practice: Nielsen–Chuang, Exercises 6.2 and 6.3.
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 to and back. Off resonance it precesses about a tilted axis and never fully flips, which is one way real gates go wrong.
The idea
On resonance a pulse of area (a " pulse") is up to phase, and makes an equal superposition. Shifting the phase of the drive changes to , which gives rotations about any axis in the equatorial plane.
Explore
Worked example
Design a pulse that takes to on a resonantly driven qubit with kHz, and estimate the error if the drive is detuned by .
A drive with phase rotates about . Can it reach from ?
No. A rotation about moves the north pole around the circle in the – plane, through and , never reaching .
Which axis and angle work, and what is the matrix?
A quarter turn about (drive phase ) sends to :
How long is the pulse?
We need , so .
With , how far off is a pulse? (Set Δ/Ω = 0.10 in the explorer.)
The axis tilts by , and the largest possible is . The nominal pulse is also slightly too short for the faster rotation: , giving . So the error is about 1%, second order in .
Check your understanding
On resonance, a pulse is applied to . The result is
- exactly the original state.The Bloch vector comes back, but is not the identity matrix.
- .
- .That (up to phase) is what a pulse does: half a turn about .
The detuning equals the Rabi frequency, . What is the largest any pulse length can give?
- 1, with a long enough pulseOff resonance the oscillation has reduced amplitude, however long you wait.
- 1/2
- 1/4The amplitude is ; don't square it again.
A qubit has coherence time ms and a pulse takes s. Roughly how many sequential gates fit before coherence is mostly lost?
- About 10Divide the two times.
- About 100
- About 10,000Check the units: 1 ms is 1000 μs.
Practice
How far down?The precession cone
With detuning , the Bloch vector starting at the north pole moves on a circle around . Find the lowest it reaches, and check that it agrees with the Rabi formula.
Hint
Rotating by about gives the point on the circle farthest from where it started.
Solution
A half turn sends to , whose -component is . Then , the amplitude in the Rabi formula.
Pulse lengths for an ionUnits
An ion qubit is driven with kHz. How long are its and pulses?
Solution
s and s. A common slip is to use kHz instead of kHz, which gives a time times too long.
More practice: Nielsen–Chuang, Exercises 7.18 and 7.31.
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
The 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.
- Bit flip ( with probability ): .
- Phase flip ( with probability ): .
- Depolarising, : .
- Amplitude damping (energy loss, with probability ), , : .
- Phase damping (loss of coherence without energy loss): .
Explore
Worked example
Alice and Bob share , and Bob's qubit goes through a depolarising channel with parameter . For which do they still violate CHSH, and for which are they still entangled?
Find the shared state.
The channel replaces Bob's qubit by with probability . Since Alice's reduced state is ,
What are the CHSH correlations now?
The part has for every pair of settings, so and the best value is . This exceeds 2 only when .
Is the state entangled for larger ? Use the partial transpose: a separable state stays positive under it.
The partial transpose of is , with eigenvalues . So the partial transpose of has smallest eigenvalue , negative exactly when . For two qubits this test is also sufficient, so is entangled iff .
Put the two thresholds together.
For the pair is entangled but the CHSH test can't show it. Bell violation is a stronger property than entanglement. Its fidelity with , , crosses exactly at .
Check your understanding
Apply the channel many times. Which channel drives every input to the same pure state?
- DepolarisingIt drives everything to the centre, , which is mixed.
- Phase flipIt drives each state to the point on the -axis below or above it, so different inputs end in different places.
- Amplitude damping
A pure state goes through the depolarising channel with parameter . What is the purity of the output?
- That's the length of the output Bloch vector. Purity is .
- That's the largest eigenvalue, .
The transpose map sends every qubit density operator to a density operator. Is it a quantum operation?
- Yes: it maps the Bloch ball onto itself.That shows it is positive. Quantum operations must be completely positive.
- No: applied to one half of it produces an operator with a negative eigenvalue.
- Yes: it is unitary conjugation by . flips both and ; the transpose flips only . A reflection is not a rotation.
Practice
Two flips make a depolariser?Composing channels
Apply a bit flip with probability and then a phase flip with probability . Find the combined map on Bloch vectors. For which is it a depolarising channel?
Solution
The scalings multiply: . Depolarising needs all three factors equal: and . So (no noise) or (everything sent to ). Otherwise the ellipsoid is squashed most along .
Kraus operators for depolarising noiseUsing the Paulis
Find Kraus operators for .
Hint
For every qubit , .
Solution
Substituting, , so
and .
More practice: Nielsen–Chuang, Exercises 8.22, 8.27 and 8.30.
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
with the upper bound an equality for pure states.
Explore
Worked example
Compare and : find , , the best measurement, and what depolarising noise with does. (Press " vs " in the explorer.)
Find the trace distance.
, , , so .
Find the fidelity, and check both bounds.
. Then , and : the upper bound is attained, as it must be for pure states.
What measurement tells them apart best, and how often does it succeed?
Measure along , halfway between and ; guess on outcome . Success probability . Measuring instead gives only .
After depolarising noise with , recompute and .
Both Bloch vectors halve: . With and ,
Distance went down and fidelity up, as contractivity says.
Check your understanding
What is ?
- 2The Bloch vectors are 2 apart, but has a factor .
- 1
- 0.5Orthogonal states are perfectly distinguishable, the maximum.
Two states have . You get one copy of one of them, each with probability . What is the best chance of naming it correctly?
- 0.1Guessing blindly already gives 0.5.
- 0.55
- 0.9That would need the states to be nearly orthogonal.
Can some quantum operation make two states more distinguishable?
- Yes, a suitable unitary.Unitaries preserve exactly: they move the two Bloch points rigidly.
- Yes, a measurement that sharpens them.A measurement whose result is kept is also a trace-preserving operation, and it obeys the same bound.
- No, not if it is trace-preserving.
Practice
Pure versus maximally mixedBoth formulas
Compute and for and , and check the bounds .
Solution
. . Bounds: , both strict, because is mixed.
Commuting statesBack to classical distances
Suppose and are diagonal in the same basis. Show that and reduce to the classical distances between the distributions and .
Solution
, so , the classical total variation distance. And , so , the Bhattacharyya overlap. The quantum measures are new only when the states don't commute.
More practice: Nielsen–Chuang, Exercises 9.6, 9.12 and 9.13.
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, 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
which is smaller than for every .
Explore
Worked example
Encode . Follow one round with a single error and one with a double error.
Write the encoded state, and the state after an error on qubit 2.
, and after : .
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 with certainty. Since the outcome was certain, the state is undisturbed: and are untouched, and nobody learned them.
Correct and decode.
points to qubit 2. Applying restores , and reversing the encoder gives .
Now suppose qubits 1 and 2 both flip. What happens?
The state is , the syndrome is , which points to qubit 3. "Correcting" qubit 3 gives : a logical . The decoded state is , whose overlap with the original is . 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 .
Check your understanding
An error hits qubit 3 of . What syndrome is measured?
- That pattern means qubit 1 disagrees with qubit 2.
- It depends on and .Both terms, and , have the same parities.
Why doesn't measuring collapse the encoded superposition, when measuring would?
- and have the same value but opposite values.
- Because two-qubit measurements never disturb states.A Bell measurement disturbs plenty. It's about which eigenspace the state lies in.
- It does collapse it, but the correction step undoes that.The correction is a fixed , which can't restore lost amplitudes.
Can this code correct a phase flip ?
- Yes, it corrects any single-qubit error.That's Shor's 9-qubit code, not this one.
- No: turns the codeword into another codeword, so the syndrome is trivial.
- Yes, by applying to all three qubits.The syndrome gives no sign that anything happened, so the decoder wouldn't know to.
Practice
Is it worth it?Numbers
At , what is and by what factor has the code helped? At what does the code stop helping?
Solution
, about 3.6 times better than 0.1. Solving gives (and ); the code helps for all . Check with the slider and "Run".
A small rotation, not a flipErrors are discretised
Instead of a flip, qubit 1 suffers the small rotation . Show that the syndrome measurement turns this into either no error or a full , and that the code then recovers the state exactly.
Solution
. The two terms lie in the syndrome spaces and . The measurement picks the first with probability (leaving ) or the second with probability (leaving , which is then corrected). Either way the result is .
More practice: Nielsen–Chuang, Exercises 10.3 and 10.4.
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
Explore
Worked example
Find the entropy of entanglement of , and compare it with the entropy of a measurement on qubit . (It is a preset in the explorer.)
Arrange the amplitudes in a matrix (rows: , columns: ) and compute .
Find the eigenvalues of .
Trace 1, determinant . The eigenvalues solve : and . (Also .) The Schmidt coefficients are and .
Compute .
bits.
What is the Shannon entropy of a measurement on alone?
, so bits, more than 0.722. The basis isn't 's eigenbasis (the off-diagonal entry is nonzero), so measuring in it adds uncertainty.
Check your understanding
A pure two-qubit state has . What is ?
- 2Subadditivity gives an upper bound, , not the value.
- 1The joint state is pure.
- 0
Which is more entangled: , or ?
- The first.
- The second: it has four terms.It factors as .
- They are equally entangled.The second is a product state, with entropy 0.
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
- exactly bits.That equality holds only in the eigenbasis.
- less than 0.47 bits.The eigenbasis is the basis that minimises the outcome entropy.
- more than 0.47 bits.
Practice
Entropy of an ensembleQuantum entropy can be smaller
A source emits , or , each with probability . Compute and compare it with the Shannon entropy of the source's choice.
Solution
Averaging Bloch vectors, . The eigenvalues are , so bits, less than . Because the states aren't orthogonal, holds less entropy than the label that picked them.
Equal entropiesFrom the Schmidt decomposition
Show that for every pure state , even when and have different dimensions.
Solution
Write . Then and : the same nonzero eigenvalues. Extra zero eigenvalues in the larger system add nothing to the entropy.
More practice: Nielsen–Chuang, Exercises 11.11, 11.12 and 11.14.
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
Explore
Worked example
Eve intercepts every qubit (), 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.
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.
And if Eve used the other basis?
Her result is random and she resends, say, when Alice sent . Bob measures in Alice's basis and gets a random bit: an error with probability .
Combine the cases: error rate and Eve's chance of knowing a sifted bit.
Error rate . Eve's guess at a sifted bit is right with probability . If she intercepts only a fraction of the qubits, the error rate is .
Alice and Bob compare 20 sifted bits. How likely is it that they see no error at all?
. 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 and ?
- Orthogonal states can be measured and resent perfectly, so Eve would leave no trace.
- To double the key rate.Sifting throws half the rounds away, so two bases lower the raw rate.
- 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.
Eve intercepts every qubit with a randomly chosen basis. What error rate do Alice and Bob see in the sifted key?
- 50%She only chooses the wrong basis half the time.
- 25%
- 12.5%That would be the rate if she intercepted half the qubits.
Alice sends one qubit, prepared in any of infinitely many states. How much classical information can Bob extract, at most?
- Unlimited: the amplitudes are continuous.Bob can't read amplitudes, only sample outcomes.
- 1 bit
- 2 bitsThat's superdense coding, which needs a pre-shared entangled pair.
Practice
A lazy eavesdropperAlways the same basis
Eve intercepts every qubit but always measures in the basis. What error rate does she cause in the sifted key, and what does she learn?
Solution
In sifted rounds where Alice used (half of them), Eve's basis is wrong and Bob errs with probability ; in rounds with there is no error. Error rate: , the same as before. She learns every -basis bit exactly and nothing about the -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 , what fraction of the sifted bits becomes secret key? What about at 11%?
Solution
, so the rate is : about 43 key bits per 100 sifted bits. At 11%, and the rate is essentially zero. One pays for error correction and the other for privacy amplification.
More practice: Nielsen–Chuang, Exercises 12.27 and 12.29.