Chap 2. Quantum computing review
约 4586 字大约 15 分钟
2025-09-24
Quantum Circuit
Circuit model for classical computation
A universal computation model, equivalent to Turing machine
A circuit consists of:
Wires: represent bits
Gates: represent logical operations on bits
Universal gate sets:
AND, OR, NOT and COPY (FANOUT)
Can construct
any Boolean function {0,1}n→{0,1}m
any decision problem {0,1}n→{0,1}
Universal gate sets is not unique
- only NAND and COPY (FANOUT) gates

Circuit size: number of elementary gates ~ circuit width × circuit depth
Usually, problem considered to be efficiently solvable if circuit size polynomial to input size
Circuit model for quantum computation
Use a set of universal gates to implement arbitrary desired function f:{0,1}n→{0,1}m
Construct unitary U such that U∣x⟩=∣f(x)⟩ (∀x∈{0,1}n)
- Unfortunately, usually such unitary does not exist (because f is usually not reversible)
Quantum computer unable to perform simplest computation?
- Solution: use ancilla register to keep reversibility U∣x⟩∣y⟩=∣x⟩∣f(x)⊕y⟩
Similarly, for 1-bit addition f(x,y)=x⊕y
- U∣x⟩∣y⟩∣z⟩=∣x⟩∣y⟩∣x⊕y⊕z⟩
Fix all initial qubit states to ∣0⟩, all measurement to be computational basis
Other fixed initial states can be absorbed into unitary
If algorithm accepts unknown input quantum states, we can initialize first few qubits as input state, other ancilla qubits in ∣0⟩

Commonly used elementary gates
Single-qubit gate
Pauli gates: X,Y,Z
Hadamard gate: H
Phase gate: S=[100i]
π/8 gate: T=[100eiπ/4]
Simple identities
HXH=Z,HZH=X
H2=I,S2=Z,T2=S
Single-qubit rotation
General rotation around unit vector n=[nx,ny,nz]
Define σn=nxσx+nyσy+nzσz satisfying σn2=I
R(n,θ)=e−iθσn/2=Icos2θ−iσnsin2θ
All single-qubit gates can be expressed as some rotation (up to global phase) E.g.
H=R(2x^+z^,π)eiπ/2
Two-qubit gate
controlled-not (CNOT): flip target if control is ∣1⟩
∣00⟩→∣00⟩,∣01⟩→∣01⟩,∣10⟩→∣11⟩,∣11⟩→∣10⟩
CNOT=1000010000010010

controlled phase flip (CPF) or controlled-Z (CZ)
∣00⟩→∣00⟩,∣01⟩→∣01⟩,∣10⟩→∣10⟩,∣11⟩→−∣11⟩
CZ=100001000010000−1

Simple circuit identities

SWAP gate
∣00⟩→∣00⟩,∣01⟩→∣10⟩,∣10⟩→∣01⟩,∣11⟩→∣11⟩
SWAP=1000001001000001

multi-qubit gate
n-qubit Toffoli gate (Cn−1-NOT)

Fredkin gate (controlled SWAP, CSWAP)

Universality
Consider n qubits and a set S of unitary gates acting on them.
S is universal if ∀V∈U(2n) and ∀δ>0, there exists finite gate sequence {gi∈S}(i=1,...,m) and global phase ϕ such that
∥V−eiϕgmgm−1...g1∥≤δ
Any unitary V can be approximated to any accuracy by universal gate set.
Examples
All single-qubit gates and CNOT gates between all pairs of qubits
H, S, T and CNOT is universal
Solovay-Kitaev theorem
Poly-log O(logc(1/δ)) gates from a discrete universal gate set is sufficient to approximate any unitary gates under constant dimension to accuracy ϵ>0.
Efficiently approximation in terms of accuracy
There exist n-qubit gates that cannot be decomposed into a polynomial number of elementary gates.
- Inefficient in terms of number of qubits
Some commonly used decompositions
Single-qubit gate
U=eiαRz(β)Ry(γ)Rz(δ)
where α,β,γ,δ∈R, eiα is irrelevant global phase
- Decompose general rotation into rotations around two axes
- Similar to Euler angles in 3D space
Purpose?
Continuous rotation into more continuous rotations
Convenient for current experiment without QEC
Adjust rotation angle by laser or microwave strength or duration, no additional experimental difficulty
Much more efficient than long sequence of H,S,T gates
For decomposing controlled single-qubit gate into single-qubit and CNOT


Multi-controlled single-qubit gate

Toffoli gate

Construct multi-controlled single-qubit gate

Quantum computer can efficiently simulate classical computer
NAND and COPY are universal for classical computation
Quantum computer can simulate NAND and COPY (in reversible way)
So any function that can be efficiently computed by classical computer can also be efficiently computed by quantum computer
Algorithm: Given efficiently computable classical function f as input, generate quantum circuit for unitary Uf using polynomial number of elementary gates as output, s.t. Uf∣x⟩∣y⟩=∣x⟩∣f(x)⊕y⟩
- Construct polynomial classical circuit for f using NAND and COPY
- Map classical NAND and COPY to quantum version with help of ancilla qubits
- Reverse intermediate steps to disentangle ancilla qubits
- Decompose quantum NAND and COPY into constant number of elementary gates
Quantum computer at least as powerful as classical computer, but large constant overhead
Examples:



Measurement
Quantum state destroyed after measurement, so to reuse qubits, need to reset them to ∣0⟩
Example: stabilizer measurement for QEC
∣ϕ+⟩ is simultaneous eigenstate of X1X2 and Z1Z2 with eigenvalue +1
How to verify this in circuit (without destroying state)?

Quantum Algorithm
Universal quantum computer at least as efficient as classical computer
Some problems, like Grover’s algorithm, proved quadratic speedup
Some problems, like Shor’s algorithm, exponential speedup compared with best-known classical algorithm (but do not know if better classical algorithm exists)
Use unitary gate U to implement arbitrary desired function f:{0,1}n→{0,1}m
U∣x⟩∣y⟩=∣x⟩∣f(x)⊕y⟩
U∣x⟩∣0⟩=∣x⟩∣f(x)⟩
Suppose qubits in superposition states
∣ψ⟩=i∑ψi∣i⟩
Run same circuit for one time
U∣ψ⟩=i∑ψiU∣i⟩
Effectively apply U to all basis simultaneously
But only one measurement outcome
Generally require quantum state tomography: exponential cost, no speedup
For certain problems, we can find clever way to increase probability of getting desired outcome through interference between different states
So intuitively many quantum algorithms shall look like

Quantum parallelism
Deutsch Algorithm
Problem: Given f:{0,1}→{0,1}. Want to decide if f(0)=f(1) or not.
Motivation
Although input and output are simple, evaluation process can be complicated.
Example: f(n) can be the number of solutions modulo two to the equation Jn(x)=sinn+1(x) between x∈[10,20].
Want to reduce the number of calls as much as possible.
Classical Approach
Evaluate f(0) and f(1) and compare them.
Requires two function calls in terms of query complexity.
Quantum Approach
Only one function call is needed.
Construct unitary Uf for the reversible version of function f.

Algorithm

Observation
Uf∣x⟩∣−⟩=∣x⟩2∣f(x)⟩−∣1⊕f(x)⟩=(−1)f(x)∣x⟩∣−⟩
Uf∣+⟩∣−⟩=2(−1)f(0)∣0⟩+(−1)f(1)∣1⟩∣−⟩
Finally observe first qubit can determine if f(0)=f(1) or not.
Deutsch-Jozsa algorithm
Generalize to n qubits.
Given f:{0,1}n→{0,1}, want to decide if f is constant or balanced (half 0, half 1).
Classical: in worst case, need 2n−1+1 function calls.
Quantum: only one function call is needed.

Input state: equal superposition of all computational basis states.
H⊗n∣0⟩⊗n=2n1x=0∑2n−1∣x⟩
After function call
Uf(2n1x=0∑2n−1∣x⟩)∣−⟩=2n1x=0∑2n−1(−1)f(x)∣x⟩∣−⟩
Finally observe first n qubits can determine if f is constant or balanced.
If constant, always measure ∣0⟩⊗n
If balanced, never measure ∣0⟩⊗n (consider projecting on the equal superposition state above)
Remark: if probabilistic classical algorithm is allowed, log(1/ϵ) calls is sufficient, independent of n. Then quantum approach's improvement for average performance is not significant.
Bernstein-Vazirani algorithm
Given f:{0,1}n→{0,1} with promise that there exists a hidden string s∈{0,1}n such that f(x)=s⋅x=s1x1⊕s2x2⊕...⊕snxn (mod 2 inner product). Want to find s.
Classical: impossible to get s using less than n function calls.
Quantum: only one function call is needed. (Exactly same circuit as Deutsch-Jozsa)
After function call
Uf(2n1x=0∑2n−1∣x⟩)∣−⟩=2n1x=0∑2n−1(−1)s⋅x∣x⟩∣−⟩
Finally observe first n qubits can determine s.
H⊗n(2n1x=0∑2n−1(−1)s⋅x∣x⟩)=H⊗n(H⊗n∣s⟩)=∣s⟩
Grover's search algorithm
Search problem
Structured search: binary search in sorted list, O(logN)
Unstructured search: search in unsorted list, O(N)
Above examples: data are stored in database: check if stored elements are target
Variant: elements not stored, but computed by function.
Task: Given fω:{0,1}n→{0,1} satisfying
fω(x)={10x=ωx=ω
Want to find ω, which is called solution to this search problem.
It's unstructured search, classical complexity: O(N),N=2n.
Again, unitary gate Ufω as oracle.
Ufω∣x⟩∣−⟩=(−1)fω(x)∣x⟩∣−⟩
Omit ancilla qubit for simplicity
Uω∣x⟩=(−1)fω(x)∣x⟩
Again, initialize equal superposition state
∣S⟩=2n1x=0∑2n−1∣x⟩
and apply the oracle, and measure in computational basis

where US is defined to add phase π for ∣S⟩, and leave orthogonal states unchanged.
How does Grover's algorithm work?
Only consider 2-dim subspace spanned by ∣ω⟩ and
∣σ⟩=2n−11x=ω∑∣x⟩
initial state is
∣S⟩=2n1∣ω⟩+1−2n1∣σ⟩

Uω is reflection about ∣σ⟩ axis, and US is reflection about ∣S⟩ axis.
sinθ=2n1
Need T iterations for final state close to ∣ω⟩ axis
(2T+1)θ≈π/2,T≈4π2n−21=O(N)
Choose T to be closest integer, the prob. to get incorrect result is O(θ2), exponentially small.
Quadratic speedup for brutal-force search algorithm of NP problems, although still exponential.
Shor's factoring algorithm
RSA crypto system
Security relies on difficulty to compute private key from public key.
Choose two large random prime numbers p,q.
n=pq,φ(n)=(p−1)(q−1)
Choose small integer e>1 s.t.
gcd(e,φ(n))=1
Calculate multiplicative inverse of e module φ(n)
ed≡1modφ(n)
Public key: (n,e), private key: (n,d).
Encryption: given plaintext m∈{0,1,...,n−1}
c≡memodn
Decryption: given cipher text c∈{0,1,...,n−1}
m≡cdmodn
Factor n-bit large integer by brutal-force: O(2n/2) using best-known classical algorithm.
Factoring can be reduced to order-finding problem.
Randomly choose 1<a<L. If gcd(a,L)=1, it is a factor of L.
If gcd(a,L)=1, find smallest r s.t.
ar≡1modL
If r is even and ar/2≡−1modL (w.p. O(1)), then
gcd(ar/2−1,L)
is a non-trivial factor of L.
Remaining problem is to find order of a modulo L.
Define function
f(x)=axmodL
which is periodic with period r.
Quantum algorithm for period-finding
Integer power f(x) in log2x time by classical computer, which gives us efficient circuit for Uf.
n qubit input N≡2n>r, and m qubit output 2m>L.
Uf(N1x=0∑N−1∣x⟩A∣0⋯0⟩B)=N1x=0∑N−1∣x⟩A∣f(x)⟩B
Measure B, conditioned on outcome f(x0), A collapses to
M1j=0∑M−1∣x0+jr⟩A,M=⌊(N−x0−1)/r⌋+1
where x0 is uniformly distributed in {0,1,...,r−1}.
but how to extract r?
Quantum Fourier Transform (QFT)
QFT
x∑f(x)∣x⟩→y∑g(y)∣y⟩=N1y∑(x∑f(x)e2πixy/N)∣y⟩
That is
∣x⟩→∣ϕx⟩≡N1y∑e2πixy/N∣y⟩
ϕx are orthonormal basis.
Circuit

Gate complexity: O(n2)=O(log2N) due to constant # of gates for each controlled rotation.
Apply QFT to A (after first measurement)
M1j=0∑M−1∣x0+jr⟩A→MN1y=0∑N−1(j=0∑M−1e2πi(x0+jr)y/N)∣y⟩A
If N is multiple of r, then M=N/r.
=r1k=0∑r−1e2πix0k/r∣kN/r⟩A
Measuring A gives y=kN/r with equal probability for k=0,1,...,r−1. Repeat few times and take gcd to get N/r.
If N is not multiple of r, the probability to get y is
Prob(y)=MN1j=0∑M−1e2πi(x0+jr)y/N2=MN1sin2(πry/N)sin2(πMry/N)
which is sharply peaked at y satisfying ry/N is close to integer.
Quantum Error Correction
Above algorithms assume perfect state preparation, gates and measurements.
In practice
Currently, possible, but very challenging, to achieve error rate below 0.1%.
Not sufficient for applications like Shor's algorithm on 1000 qubits.
One exception is topological quantum computer, but lacks experimental progress.
Therefore it's necessary to perform QEC.
Assuming perfect operations, how to deal with existing errors?
Assuming faulty operations, is QEC still possible?
Encode small number of logical qubits into large number of physical qubits.
Will error correction operations introduce more errors?
Threshold theorem:
There exists a threshold pth>0 s.t., if error for elementary components are below pth, then arbitrarily large quantum computation can be achieved at any desired accuracy by concatenating QEC codes.
Best-known threshold: about 1% for surface code.
E.g. factor 1000-bit integer
2000 logical qubits with error rate below 10−9.
or 106 physical qubits with error rate below 10−4.
Classical error correction
Repetition Code: Encode each bit multiple times to reduce error probability.
Suppose each bit has a small probability p≪1 to be flipped during storage.
Assume independent error on different bits.
Encode into 00⋯0 and 11⋯1 with length 2t+1.
Error rate suppressed to O(pt+1).
Need t+1 bit flipped to change majority vote.
Sources of Errors:
Imperfect gate operation during computation.
Interaction with environment during storage.
Modern Classical Computers:
Error rates are extremely low.
Estimated to be 1 bit error in 4GB data in 24 hours at sea level near Earth's surface.
Usually not considered for daily usage.
If error occurs, just run the program again.
Quantum Computers:
Error correction is more important due to higher error rates.
Potential difficulties in generalizing classical error correction to quantum systems:
No-cloning theorem: Unable to copy unknown quantum states, making it challenging to encode repetition codes.
Measurement destroys quantum states: Decoding errors and correcting them without destroying the quantum state is non-trivial.
Continuous quantum errors: Unlike classical errors which are discrete, quantum errors are continuous. Correcting continuous errors without introducing new inaccuracies is a significant challenge.
Importance of independent error assumption:
In classical repetition codes, if all bits flip together at an error rate p, correction becomes impossible.
Similar issues arise in quantum error correction.
QEC code
3-qubit code
A toy model to show important properties of QEC
Use 2-dim subspace of 3 physical qubits to encode 1 logical qubit.
∣0⟩L=∣000⟩,∣1⟩L=∣111⟩
A logical qubit ∣ψ⟩L=α∣0⟩L+β∣1⟩L encoded as
∣ψ⟩L=α∣000⟩+β∣111⟩

First problem solved: Although unable to copy unknown state, we can copy in computational basis.
How does this code work
Suppose bit-flip error X occurs on qubit 1.
X1∣ψ⟩L=α∣100⟩+β∣011⟩
Subspace for error X1 spanned by {∣100⟩,∣011⟩} is orthogonal to logical space spanned by {∣000⟩,∣111⟩}.
Similarly, subspace spanned by X2 and X3 are also orthogonal to each other.
In principle, I, X1, X2, X3 can be distinguished by projective measurement.
How to detect error?
Do not measure in computational basis and make majority vote (destroys quantum state).
Mathematically, want projective measurement for PI, PX1, PX2, PX3
They are simultaneous eigenstates of Z1Z2 and Z2Z3 with different eigenvalues.
Error Z1Z2 Z2Z3 I +1 +1 X1 -1 +1 X2 -1 -1 X3 +1 -1 Therefore if we measure Z1Z2 and Z2Z3 (non-demolition), four possible outcomes correspond to four possible subspaces.
Further apply corresponding Xi to correct error.
Second problem solved: just measure subspaces without revealing information about logical qubit.
But actual errors are continuous
E.g. small rotation RX1(θ) on qubit 1
RX1(θ)∣ψ⟩L=cos2θ(α∣000⟩+β∣111⟩)−isin2θ(α∣100⟩+β∣011⟩)
Just regard it as discrete I, X1, X2, X3 errors and perform stabilizer measurement.
w.p. cos2(θ/2), project to logical space, no error.
w.p. sin2(θ/2), project to subspace for X1 error, then correct it.
Third problem solved: syndrome measurement projects continuous errors into discrete ones, which in principle can be corrected perfectly.
We want them to have distinct error syndromes
Two-qubit error X1X3 has same syndrome as X2.
If we correct it by applying X2, it becomes logical error XL.
Similar situation also occurs for classical 3-bit repetition code: unable to correct two-bit errors.
Assumptions about errors: rare and independent on different qubits, then P(XiXj)≈p2≪P(Xi)≈p.
However 3-qubit code cannot correct all possible single-qubit errors
E.g. phase-flip error Z1 on qubit 1
Z1∣ψ⟩L=α∣000⟩−β∣111⟩
Subspace spanned by {∣000⟩,∣111⟩} is invariant under Zi.
Therefore cannot distinguish I, Z1, Z2, Z3 by syndrome measurement.
H changes X and Z bases
- {∣+++⟩,∣−−−⟩} stabilized by X1X2 and X2X3 can correct single Z error, but not X error.
9-qubit Shor code
Concatenation of these two codes to correct both X and Z errors
∣0⟩L=2∣000⟩+∣111⟩⊗2∣000⟩+∣111⟩⊗2∣000⟩+∣111⟩
∣1⟩L=2∣000⟩−∣111⟩⊗2∣000⟩−∣111⟩⊗2∣000⟩−∣111⟩
Encode 1 logical qubit into 9 physical qubits, need 8 independent stabilizers
Low level: Z1Z2, Z2Z3, Z4Z5, Z5Z6, Z7Z8, Z8Z9 to correct X errors
High level: (X1X2X3)(X4X5X6), (X4X5X6)(X7X8X9) to correct Z errors
No need to distinguish Z1,Z2,Z3, same error syndrome corrected by same recovery operation, e.g. Z1 or Z1Z2Z3.
Single Y error has unique syndrome. Or regard Yi=iXiZi and correct separately.
Project continuous errors into discrete I,X,Y,Z, then arbitrary αI+βX+γY+δZ error on one qubit can be corrected.
Alternative understanding: Shor code is distance-3, thus require 3-qubit Pauli operation to turn one logical state to another. In logical space, there are no overlap between possible states after one single-qubit error.
In general, QEC code with distance d=2t+1 can correct arbitrary t-qubit errors.
Encode k logical qubits into n physical qubits, denoted as [[n,k,d]] code. Shor is [[9,1,3]] code.
Commonly used QEC codes
[[5,1,3]] code: smallest code to correct single-qubit errors.
[[7,1,3]] Steane code: Separated X and Z stabilizers.
[[25,1,9]] code by concatenating two [[5,1,3]] codes (replace each physical qubit of outer code by inner code) to correct up to 4-qubit errors.
In general [[n1n2,1,d1d2]] code by concatenating [[n1,1,d1]] and [[n2,1,d2]] codes.
Fault-tolerant Quantum Computation
Logical qubits encode into block of physical qubits.
State preparation, logical gates, measurement directly on encoded blocks.
Insert QEC operations before and after each logical gate (prevent error accumulation and propagation).
Fault-tolerant: For [[n,1,2t+1]] code, if each elementary (physical) operation has error rate below p≪1, then a logical operation is fault-tolerant if any O(pt) events can cause at most t errors in each block for logical qubit.
- The main idea is putting all FT operations (preparation, gate, measurement, QEC) together, any events with ≤t failures do not lead to error in final output, thus suppressing error rate to O(pt+1).
Example: fault-tolerant measurement
Start from non-demolition measurement

Measure multi-qubit Pauli operator, not FT.

X error propagates to all physical qubits.
Z error leads to incorrect outcome.
To prevent error propagates to multiple physical qubits, use multiple ancilla in GHZ states. Still not fully FT.

- If error occurs in preparation step, it still propagates.
Solution: add verification stage between preparation and non-demolition measurement stages.

Repeat preparation-verification until no error detected.
Single-failure events lead to at most one error on physical qubits, but possibly wrong measurement outcome.
Denote this whole process as FTsubMeas (sub-measurement)
Remaining problem: possibly incorrect outcome.
For non-demolition measurement, ideally logical state projected to eigenstate after measurement.
Measure for multiple times and make majority vote.
Insert fault-tolerant QEC between sub-measurements to correct single-qubit physical errors. For distance-d code, apply d FTsubMeas subroutines.
Example: fault-tolerant QEC
FT measurement of error syndromes
We only care about "current" error syndrome.

Repeated until last two rounds give same error syndrome.
FT correction
Same as FT single-qubit gate.
By definition, tensor product of single-qubit gates on physical qubits is directly fault-tolerant
For example, for Steane code
ZL=Z1⋯Z7,XL=X1⋯X7
HL=H1⋯H7,SL=S1†⋯S7†
We can verify
HLZLHL=XL,HLXLHL=ZL
SLZLSL†=ZL,SLXLSL†=YL
We say that these gates are transversal.
Example: fault-tolerant two-qubit gate
Generalize to transversal gate for multiple logical qubits: pairwise multi-qubit gates on physical qubits from different logical qubits.
Transversal logical two-qubit CNOT gate for Steane code.
CNOTabL=CNOTa1b1⋯CNOTa7b7
We can verify
CNOTabLXaLCNOTabL=XaLXbL,CNOTabLZaLCNOTabL=ZaL
CNOTabLXbLCNOTabL=XbL,CNOTabLZbLCNOTabL=ZaLZbL
Remark
Not all logical gates can be implemented transversally.
Theorem: A transversal gate set cannot be universal.
For Steane code, we have transversal gate HL, SL, CNOTL, but not TL. Need a different way to implement.
Theorem: There exists a threshold pth for fault-tolerant quantum computing. If physical operations all have error rates below p<pth, then for any ideal quantum circuit C and any desired accuracy ϵ>0, there exists physical quantum circuit C′ to simulate output of C with error rate below ϵ. Overhead of C′ is O(polylog(∣C∣/ϵ)) where ∣C∣ is size of circuit C.
Implicit assumption that different quantum operations on different qubits can be performed in parallel, or that storage lifetime is infinite.
Otherwise, when encoding into higher level, we increase idling time of other physical qubits, during which QEC cannot be performed.
Threshold about pth=1/c with c being number of pairs of positions where two physical errors can lead to logical error.
For Steane code c∼104, threshold pth about 10−5∼10−4.
To date, best-known threshold is about 1% for surface code.