Introduction to quantum circuits, the standard model of quantum computation. How to represent quantum algorithms as sequences of gates, and how to visualize them with the circuit diagram notation.
A classical computer is built from logic gates (AND, OR, NOT, NAND…). A quantum computer is built from quantum gates — unitary matrices acting on qubits. Before asking "what can we compute?", we must ask: how many different gates do we actually need?
Definition — Universality
A set of quantum gates is called universal if any unitary transformation U (of any size) can be approximated with arbitrary precision using only gates from that set.
Think of it like LEGO: no matter how complex the structure, a small set of brick types is enough to build anything.
Classical analogy: In classical computing the NAND gate alone is universal — every logic function (AND, OR, XOR, full adder, …) can be built exclusively from NAND gates. This is why CPU designers only need to implement one primitive.
Theorem — Universal Gate Set for Quantum Computing
The set {H, S, T, CNOT} is universal for quantum computation.
H = Hadamard,
S = Phase (π/2),
T = π/8 gate,
CNOT = controlled-NOT
Any unitary U acting on n qubits can be approximated to error ε using O(poly(n, log(1/ε))) gates from this set.
Note — the Clifford group: The smaller set {H, S, CNOT} generates the so-called Clifford group — a very important subgroup of unitaries. Clifford circuits are efficiently simulable on classical computers (Gottesman–Knill theorem), so they are NOT computationally universal. Adding the T gate breaks this simulability and makes the set universal.
How a Quantum Computer Works
Every quantum computation follows the same three-step recipe:
Quantum Computation Protocol
Prepare all qubits in the computational basis state |0⟩⊗ⁿ = |00…0⟩
Apply a sequence of quantum gates (together forming a unitary U)
Measure in the computational basis {|0⟩, |1⟩}
So at the highest level, a quantum computer is just:
|0⟩ ──┐┐──[M]
|0⟩ ──┤ U ├──[M]
|0⟩ ──┘┘──[M]
Input: |0⟩^⊗n — one big unitary U — then measure everything
The entire quantum algorithm is encoded in how U is decomposed into elementary gates. This is the art of quantum circuit design.
The decomposition U ≈ G₁G₂G₃… (product of elementary gates) is analogous to how a classical program is compiled into CPU instructions. Universality guarantees that this decomposition always exists.
Gate set visualizer — hover over a gate to see its matrix and effect on |0⟩ and |1⟩
Ex 1.1Universal gate set
Which of the following sets is universal for quantum computation? Type the letter: A) {H, CNOT} B) {H, S, T, CNOT} C) {H, S, CNOT} D) {X, Y, Z}
Answer:
The set {H,S,CNOT} generates only the Clifford group — efficient to simulate classically. You need the T gate to break that and achieve full universality.
Ex 1.2Steps of quantum computation
In what state do we always prepare the qubits at the start of a quantum computation?
Answer:
All qubits start in the ground state — the first basis vector |0⟩. This is the standard initialization for quantum hardware.
Section 02
Computing Boolean Functions
Classical computers exist to evaluate Boolean functions: given n input bits, produce m output bits. Formally:
Boolean Function
A Boolean function is a map:
f : {0,1}ⁿ → {0,1}ᵐ
It can always be represented by a truth table listing all 2ⁿ input combinations and the corresponding outputs.
Example for n=3, m=2:
x
f(x)
000
01
001
00
⋮
⋮
Can a quantum computer evaluate f?
We want a unitary U that, given |x⟩ (an n-qubit state), produces |f(x)⟩. Naively:
|x⟩ ─[Uᶠ]─ |f(x)⟩
n qubits in → m qubits out
Problem: U must be unitary (invertible), which means it maps n+m qubits to n+m qubits with the same dimension. But if f is not injective (many-to-one), this direct encoding is NOT invertible — hence not unitary!
The Oracle Construction
The standard solution is to keep a copy of the input and add a separate m-qubit output register initialised to |0⟩:
Quantum Oracle U_f
Input state:|0⟩^⊗m ⊗ |x⟩ — n qubits for x, m ancilla qubits set to 0
Apply Uᶠ:|0⟩|x⟩──→|f(x)⟩|x⟩
Inverse:U_f† maps |f(x)⟩|x⟩ back to |0⟩|x⟩, so U_f is unitary ✓
The output register holds |f(x)⟩ and the input register still holds |x⟩. Both are preserved.
|0⟩⊗m|x⟩
──[Uᶠ]──
|f(x)⟩|x⟩
──[Uᶠ†]──
|0⟩⊗m|x⟩
Note: If we measure after applying U_f, we obtain both f(x) and x in binary representation. The input register is always recoverable, confirming invertibility.
The oracle construction is a key design pattern in quantum computing. It appears in Deutsch–Jozsa, Grover's, and Shor's algorithms. The trick of "copy x into the output, compute f(x) in a fresh register" converts any function into a unitary gate.
Ex 2.1Why keep the input?
Why can't we just map |x⟩ → |f(x)⟩ directly in a quantum circuit? Type "not injective" or "not invertible".
Answer:
Unitary matrices are bijections — they must be invertible. If f sends two different inputs to the same output, U_f would not be invertible. The oracle construction fixes this by keeping x.
Ex 2.2Oracle action
What state does U_f produce when applied to |0⟩|x⟩ ? (write as ket notation, e.g. |f(x)⟩|x⟩)
Answer:
Section 03
Quantum Parallelism
Here is the key quantum advantage: if we put the input register into a superposition before applying U_f, the oracle evaluates f on all inputs simultaneously. This is quantum parallelism.
1-qubit example
Start with |0⟩, apply Hadamard to create |+⟩ = (|0⟩+|1⟩)/√2, then run U_f:
Initial:|0⟩|0⟩
After H⊗I:|ψ₁⟩ = |+⟩|0⟩ = (|0⟩+|1⟩)/√2 ⊗ |0⟩ = (|00⟩+|10⟩)/√2
After Uᶠ:|ψ₂⟩ = Uᶠ|ψ₁⟩ = (|f(0)⟩|0⟩ + |f(1)⟩|1⟩) / √2
We have computed f(0) and f(1) in a single application of U_f!
Caveat: If we measure this state, we obtain only one result — either |f(0)⟩ or |f(1)⟩ with equal probability. The parallelism is real, but extracting all 2ⁿ values at once is impossible. Clever quantum algorithms exploit the superposition before measuring.
Superposition of 2 qubits
Apply Hadamard to each qubit independently:
Start:|0⟩ ⊗ |0⟩
H on each:H|0⟩ ⊗ H|0⟩ = |+⟩ ⊗ |+⟩
Expand:|++⟩ = (|00⟩+|01⟩+|10⟩+|11⟩) / 2
In vector:1/2
|++⟩ = 1/2
1
1
1
1
= superposition of ALL 4 basis states
The corresponding unitary is U = H⊗H:
U = H ⊗ H =
1/√2
1/√2
1/√2
−1/√2
⊗
1/√2
1/√2
1/√2
−1/√2
= 1/2
1
1
1
1
1
−1
1
−1
1
1
−1
−1
1
−1
−1
1
Worked example: f(q₀,q₁) = q₀ ⊕ q₁
Let f be the XOR of the two input bits. The oracle maps |q₀⟩|q₁⟩|0⟩ → |q₀⟩|q₁⟩|q₀⊕q₁⟩ (two CNOT gates).
Step a — U_f:Apply two CNOTs: q₀ → ancilla and q₁ → ancilla gives |q₀⊕q₁⟩ in ancilla
With H⊗H⊗I:|ψ⟩ = Uᶠ|0++⟩ = (|000⟩+|101⟩+|110⟩+|011⟩) / 2
Step b — restore:Apply U_f† (same circuit, since CNOT² = I) to reset ancilla to |0⟩
Key property used: CNOT² = I (applying CNOT twice returns to the original state). This is why the circuit for U_f† is just the reverse of U_f for CNOT-based oracles.
Superposition of n qubits
The pattern generalises: applying H to every qubit in |0⟩⊗ⁿ gives an equal superposition of all 2ⁿ basis states.
n-qubit Hadamard superposition
Start:|0⟩⊗ⁿ = |0⟩⊗|0⟩⊗…⊗|0⟩ (n times)
Apply H⊗ⁿ:|+⟩⊗ⁿ = (|0⟩+|1⟩)/√2 ⊗ … ⊗ (|0⟩+|1⟩)/√2
Expand:= (1/√2)ⁿ · (|00…0⟩ + |00…1⟩ + … + |11…1⟩)
Compact:= 1/2^(n/2) · Σₗ₌₀^(2ⁿ−1) |ℓ⟩
where |ℓ⟩ means |binary representation of the integer ℓ⟩. For example, |3⟩ = |011⟩ for n=3.
Drag the slider to set n — see how many basis states are in superposition after H⊗ⁿ
2qubits → 4 states
Ex 3.1Superposition count
If you apply H to each of 5 qubits (all starting in |0⟩), how many basis states are in the resulting superposition?
Answer:
The number of basis states is 2ⁿ. For n=5: 2⁵ = 32.
Ex 3.2Amplitude in |+⟩⊗n
In the state H⊗³|000⟩, what is the amplitude of each basis state |ℓ⟩? (give exact value, e.g. 1/2)
Answer:
The amplitude is (1/√2)³ = 1/(2√2) ≈ 0.354. All 8 states have equal amplitude, and |amplitude|² × 8 = 1 ✓
Section 04
Transforming a State into Another
We know how to build specific gates like H, X, Z. But given any two quantum states |ψ⟩ and |φ⟩, can we always find a unitary that maps one to the other? Yes — and here is the constructive proof.
Theorem
Given any two unit vectors |ψ⟩ and |φ⟩ in ℂᴺ, there always exists a unitary U such that U|ψ⟩ = |φ⟩.
Proof (constructive)
Step 1Build two orthonormal bases. Using Gram–Schmidt, extend |ψ⟩ to a full basis {|ψ₀⟩, |ψ₁⟩, …, |ψ_{N−1}⟩} with |ψ₀⟩ = |ψ⟩. Similarly extend |φ⟩ to {|φ₀⟩, |φ₁⟩, …, |φ_{N−1}⟩} with |φ₀⟩ = |φ⟩.
Step 2Construct U. Define:
U = Σₗ |φₗ⟩⟨ψₗ|
This is a sum of outer products: each basis vector |ψₗ⟩ is mapped to the corresponding |φₗ⟩.
Orthonorm.:⟨φₗ|φₘ⟩ = δₗₘ (1 if l=m, 0 otherwise, since {|φₗ⟩} is orthonormal)
Result:U†U = Σₗ |ψₗ⟩⟨ψₗ| = I
Why does Σₗ |ψₗ⟩⟨ψₗ| = I ? This is the completeness relation (resolution of identity). Any vector |Φ⟩ can be expanded as |Φ⟩ = Σₗ cₗ|ψₗ⟩ with cₗ = ⟨ψₗ|Φ⟩. Therefore:
This proof is constructive — it tells you how to build U explicitly. In practice, the Gram–Schmidt step is done numerically, and the resulting U is decomposed into gates. This is the basis of quantum state preparation algorithms.
Ex 4.1Completeness relation
If {|ψₗ⟩} is an orthonormal basis, what does Σₗ |ψₗ⟩⟨ψₗ| equal? (Write the symbol)
Answer:
The sum of outer products of any orthonormal basis equals the identity matrix I. This is the completeness relation, fundamental to quantum mechanics.
Section 05
Generating an Arbitrary State α|0⟩ + β|1⟩ from |0⟩
Section 4 gave a general existence proof. Now let's be explicit for the 1-qubit case: given |0⟩, build the gate U that produces any target state |φ⟩ = α|0⟩ + β|1⟩.
Comparing with |ψ⟩ = α|0⟩ + β|1⟩: we need cos(θ/2) = |α| and e^{j(φ−π/2)} sin(θ/2) = β. This gives θ and φ in terms of α, β. Any single-qubit state is reachable with just two real parameters!
Bloch sphere projection — adjust θ (polar) and φ (azimuthal) to generate any qubit state
60°90°
Ex 5.1Find θ for |+⟩
The state |+⟩ = (|0⟩+|1⟩)/√2 has α = β = 1/√2. Using U(φ,θ)|0⟩ = cos(θ/2)|0⟩ + …|1⟩, what value of θ (in degrees) gives cos(θ/2) = 1/√2?
θ =
cos(θ/2) = 1/√2 means θ/2 = 45°, so θ = 90°. This is the "equator" of the Bloch sphere.
Ex 5.2Find θ and φ for a given state (from the notes)
Find θ and φ (in degrees) to generate |ψ⟩ = 0.8|0⟩ + 0.6 e^{j5π/3}|1⟩. Note: cos(θ/2) = 0.8 and the relative phase.
θ ≈φ ≈
cos(θ/2)=0.8 → θ/2=arccos(0.8)≈36.87° → θ≈73.7°≈73°. For φ: the relative phase is e^{j(φ−π/2)} = e^{j5π/3} → φ−π/2 = 5π/3 → φ = 5π/3+π/2 = 13π/6 ≈ 420°.
Section 06
The No-Cloning Theorem
In classical computing, copying a bit is trivial: just read it and write the same value elsewhere. Quantum mechanics forbids this for unknown states — a deep and surprising result.
No-Cloning Theorem
There is no unitary operation U that can copy an arbitrary unknown quantum state. That is, there is no U such that U|ψ⟩|0⟩ = |ψ⟩|ψ⟩ for all states |ψ⟩.
Proof by contradiction (reductio ad absurdum)
Suppose — for contradiction — that such a cloning unitary U exists.
Assumption:∃ U such that U|ψ⟩|0⟩ = |ψ⟩|ψ⟩ for ALL |ψ⟩
Reason:Unless α=0 or β=0 (i.e., |ψ⟩ is already a basis state), these are different states.
Conclusion:Such U cannot exist. ∎
What if |ψ⟩ is known? The theorem only applies to unknown states. If you already know α and β, you can simply prepare a fresh qubit in the state |ψ⟩ by the state-preparation procedure of Section 5. The constraint is on blind copying.
The no-cloning theorem is the quantum-mechanical reason why quantum communication is fundamentally more secure than classical: an eavesdropper cannot copy a qubit without disturbing it (because no cloning unitary exists). This underpins quantum cryptography (BB84 protocol).
Ex 6.1Key step in the proof
In the no-cloning proof, what property of U is used to distribute it over α|0⟩ + β|1⟩ ? (one word)
Answer:
U is linear: U(α|0⟩+β|1⟩)|0⟩ = αU|0⟩|0⟩ + βU|1⟩|0⟩. Linearity forces the cross terms to vanish — the same linearity that makes cloning impossible.
Ex 6.2Cloning basis states
Is it possible to "clone" the state |0⟩? That is, can we build a circuit that maps |0⟩|0⟩ → |0⟩|0⟩? (yes/no)
Answer:
Yes! If the state is known (e.g., |0⟩ or |1⟩), you can prepare a second copy. The identity gate does it for |0⟩. The theorem only forbids cloning of UNKNOWN arbitrary superpositions.
Section 07
Measuring Two Qubits in the Bell Basis
Until now we have always measured in the computational basis {|00⟩, |01⟩, |10⟩, |11⟩}. But we can also measure in the Bell basis {|Φ⁺⟩, |Φ⁻⟩, |Ψ⁺⟩, |Ψ⁻⟩}, which is the natural basis for entangled states. This operation is called a Bell measurement and is the heart of quantum teleportation.
What is a Bell Measurement?
Bell Measurement — the idea
A Bell measurement is a joint measurement of two qubits that tells you which Bell state they were in, collapsing the state to that Bell state. The outcome is always one of four possibilities: |Φ⁺⟩, |Φ⁻⟩, |Ψ⁺⟩, or |Ψ⁻⟩ — communicated as two classical bits "00", "01", "10", "11".
Step 1 — Recall the Four Bell States
These are the maximally entangled two-qubit states we met in the previous note. Think of them as four "types" of entanglement, each with a unique signature:
|Φ⁺⟩ — "same, plus"
(|00⟩ + |11⟩) / √2
Both match — 00 or 11
|Φ⁻⟩ — "same, minus"
(|00⟩ − |11⟩) / √2
Both match — opposite phase
|Ψ⁺⟩ — "opposite, plus"
(|01⟩ + |10⟩) / √2
Always different — 01 or 10
|Ψ⁻⟩ — "opposite, minus"
(|01⟩ − |10⟩) / √2
Always different — opposite phase
Step 2 — The Bell Measurement Circuit
We cannot directly measure in the Bell basis in hardware — real devices only measure in the computational basis {|00⟩, |01⟩, |10⟩, |11⟩}. So the strategy is:
Strategy: Change basis THEN measure
Apply an inverse Bell circuit (CNOT followed by H on the first qubit) to rotate the Bell basis into the computational basis, then measure in the standard way. The computational outcome tells you which Bell state you had.
Bell Measurement Circuit
qubit 1 ──●──H──M── x
│
qubit 2 ─⊕───────M── y
Order: CNOT first (qubit 1 controls qubit 2), then H on qubit 1, then measure both. Outcomes: x, y ∈ {0,1}.
Step 3 — What happens to each Bell state?
Let's trace each Bell state through the circuit carefully. We'll track: input → after CNOT → after H → measured outcome.
The elegance of the Bell basis: the Born rule works exactly the same way as in the computational basis — the probability of each outcome is the squared magnitude of the amplitude of the corresponding Bell state. The basis change circuit does all the hard work of "translating" the state before measurement.
Bell measurement simulator — click a Bell state to trace it through the circuit and see the outcome
Ex 7.1Bell circuit gates — order matters!
The Bell measurement circuit applies two gates before the standard measurement. What is the correct order? Write "CNOT then H" or "H then CNOT".
Order:
Look at the circuit diagram above: the ● (control dot on qubit 1) and ⊕ (target on qubit 2) form the CNOT — it comes first. Then H is applied on qubit 1 only. Finally both are measured.
Ex 7.2Identify the Bell state from an outcome
A Bell measurement gives outcome "10". Which Bell state was the system in before measurement?
Bell state:
Ex 7.3Probability in a Bell superposition
A state is |Ψ⟩ = (1/2)|Φ⁺⟩ + (√3/2)|Ψ⁻⟩. What is the probability of getting outcome "11" (detecting |Ψ⁻⟩)?
P("11") =
P("11") = |δ|² where δ is the coefficient of |Ψ⁻⟩. Here δ = √3/2, so P = (√3/2)² = 3/4 = 0.75.
Section 08
Quantum Teleportation
Quantum teleportation is one of the most striking results in quantum information. It answers a puzzling question: can we transmit a quantum state — an unknown qubit — without physically sending the qubit itself?
The Goal
Alice holds an unknown qubit |ψ⟩ = α|0⟩ + β|1⟩. She wants to send the state |ψ⟩ to Bob, who is far away. She does NOT know α and β (and by the no-cloning theorem she cannot measure them without destroying the state). She can only send classical bits (phone calls, emails...). Can she do it?
Yes — if they share an entangled pair first! Using one pre-shared Bell pair and just 2 classical bits of communication, Alice can transfer the full quantum state |ψ⟩ to Bob. No qubit physically travels. This is quantum teleportation.
What We Need (Resources)
🔗
1 Bell pair
|Φ⁺⟩ shared between Alice and Bob before the protocol
📡
2 classical bits
Alice sends x, y ∈ {0,1} over a classical channel
⚙️
Bob's correction
Bob applies at most X and Z based on (x, y)
The Three Steps of the Protocol
1
Share a Bell pair. Alice and Bob meet (or use a quantum channel) and create the entangled pair |Φ⁺⟩ = (|00⟩+|11⟩)/√2. Alice keeps qubit q₀ and Bob keeps qubit q₁. They can now be light-years apart.
2
Alice performs a Bell measurement. Alice has the state |ψ⟩ to send plus her half q₀ of the Bell pair. She applies the Bell measurement circuit (CNOT + H + measure) to these two qubits and gets a 2-bit outcome (x, y) ∈ {00, 01, 10, 11}. She sends (x, y) to Bob via a classical channel.
3
Bob applies a correction gate. Based on the 2 bits (x, y) he received, Bob applies a simple correction (I, Z, X, or XZ) to his qubit q₁. After the correction, q₁ is in the state |ψ⟩ — the teleportation succeeded!
The Complete Teleportation Circuit
Here is the full circuit with all three qubits. Read it left to right. The dashed vertical lines mark the three stages of the protocol.
Full Teleportation Circuit
① Share Bell pair
② Alice measures
③ Bob corrects
|ψ⟩ = α|0⟩+β|1⟩
H
M
x
q₀ → Alice Bell pair
H
⊕
M
y
q₁ → Bob Bell pair
⊕
Xif x=1
Zif y=1
|ψ⟩
|ψ₀⟩
|ψ₁⟩ after CNOT+H
|ψ₂⟩ after correction
Classical communication (x, y) from Alice to Bob shown as dashed lines. Bob's correction uses at most two gates.
Step-by-Step Calculation
Let's trace the mathematics carefully. Alice has |ψ⟩ = α|0⟩ + β|1⟩ to teleport. The three qubits are ordered as (q_in, q₀, q₁).
How to read this: The state |ψ₁⟩ is a superposition of all four possible outcomes. The first two qubits (Alice's) are in a superposition of "00", "01", "10", "11". For each outcome, Bob's qubit q₁ is in a different state — shown by the coloured expressions. Alice's measurement collapses everything to one of these four terms.
The Four Possible Outcomes and Corrections
After Alice's Bell measurement she gets one of four results. For each, Bob's qubit is in a specific state that differs from |ψ⟩ by at most a simple gate:
"00"
Bob's qubit: α|0⟩ + β|1⟩
This is already |ψ⟩ — no correction needed!
Apply: I
"01"
Bob's qubit: α|0⟩ − β|1⟩ = Z|ψ⟩
Phase is flipped — Z gate corrects it (Z²=I)
Apply: Z
"10"
Bob's qubit: α|1⟩ + β|0⟩ = X|ψ⟩
Bit is flipped — X gate corrects it (X²=I)
Apply: X
"11"
Bob's qubit: α|1⟩ − β|0⟩ = XZ|ψ⟩
Both flipped — apply Z first then X (or ZX, up to global phase)
Apply: ZX
The resource equation: 1 Bell pair + 2 classical bits = 1 qubit transferred. This is tight — you cannot teleport a qubit with fewer resources. Quantum teleportation turns entanglement (a non-classical resource) into a quantum communication channel.
Teleportation simulator — set |ψ⟩ with θ and φ, simulate Alice's Bell measurement, and watch Bob apply corrections
60°45°
Common Misconceptions
Does teleportation violate the no-cloning theorem? No! After teleportation, Alice's original qubit is destroyed (it was measured and collapsed). The state |ψ⟩ is not duplicated — it has moved. The original is gone; the copy appears at Bob's end.
Does teleportation violate special relativity (faster than light)? No! Alice must send the 2 classical bits (x, y) to Bob via a classical channel, which travels at most at the speed of light. Without those bits, Bob's qubit is in a completely mixed state — he cannot extract |ψ⟩ from it alone. The quantum channel carries no usable information until the classical bits arrive.
What exactly is being "teleported"? The quantum state |ψ⟩ — encoded in the two complex numbers α and β. This is an infinite amount of classical information (two arbitrary real numbers), yet only 2 classical bits + 1 entangled pair are needed! The trick: we don't need to learn α and β, we just need to transfer them. Entanglement enables this "wholesale" transfer without knowledge of the contents.
Ex 8.1Classical bits needed
How many classical bits does Alice send to Bob in the teleportation protocol? Why is that the minimum?
Number of bits:
Alice measures 2 qubits, getting 2 bits x and y. There are 4 possible outcomes (00, 01, 10, 11) requiring 2 bits to distinguish. Bob needs to know which of the 4 corrections to apply — he needs both bits.
Ex 8.2Bob's correction gate
Alice's Bell measurement gives outcome (x=1, y=0), i.e., "10". What gate should Bob apply to his qubit to recover |ψ⟩? Use the correction table above.
Bob applies:
Ex 8.3Why doesn't teleportation clone?
After teleportation succeeds, how many qubits are in the state |ψ⟩? Alice's original or Bob's copy — or both?
Qubits in state |ψ⟩:
Section 09
Quantum State Tomography
Suppose we have a quantum device that repeatedly produces qubits all in the same unknown pure state |ψ⟩ = α|0⟩ + β|1⟩. Can we figure out α and β just by measuring? This process is called quantum state tomography.
The problem
Given many identical copies of an unknown qubit state |ψ⟩ = α|0⟩ + β|1⟩, estimate the complex amplitudes α and β from measurement statistics alone.
Step 0 — Simplify the parametrisation
α and β are complex numbers, so naively we have 4 real parameters. But two constraints reduce this:
Constraint 1:Normalisation: |α|² + |β|² = 1 → only 3 independent real parameters
Constraint 2:Global phase is unobservable — we can always choose α ∈ ℝ, α ≥ 0 without loss of generality
Here is why: write the general state as γ|0⟩ + δ|1⟩ with γ, δ ∈ ℂ. Factor out the phase of γ:
Drop global:≡ α |0⟩ + β |1⟩ with α = |γ| ∈ ℝ and β = β_R + jβ_I ∈ ℂ
So we have exactly 3 real unknowns: α (real, ≥ 0), β_R = Re(β), β_I = Im(β), linked by α² + β_R² + β_I² = 1. We need 3 independent measurements to recover all three.
Measurement 1 — Z basis (standard measurement)
Measure the observable L_Z = Z (Pauli-Z). This distinguishes |0⟩ from |1⟩ directly.
Circuit:|ψ⟩ ──[M]── repeat N times, count N₀ outcomes of "0"
Born rule:P("0") = |α|² = |⟨0|ψ⟩|²
Frequency:P("0") ≈ N₀/N (frequentist estimate for large N)
Since α ∈ ℝ:α = √(N₀/N) and |β| = √(1 − N₀/N)
This first measurement pins down α exactly (given enough shots N). All subsequent measurements can use this estimated α.
Measurement 2 — X basis (after Hadamard)
To extract β_R, we measure in the X (Hadamard) basis. Apply H before measuring in the Z basis:
Circuit:|ψ⟩ ──[H]──[M]──
H rotates:H maps |+⟩ → |0⟩ and |−⟩ → |1⟩, so measuring in X basis = measuring {|+⟩,|−⟩}
After H:H|ψ⟩ = α|+⟩ + β|−⟩ = (α+β)/√2|0⟩ + (α−β)/√2|1⟩
To extract β_I, we measure in the Y basis. The eigenstates of Y are |+j⟩ = (|0⟩+j|1⟩)/√2 and |−j⟩ = (|0⟩−j|1⟩)/√2. We need a circuit that maps these to |0⟩ and |1⟩.
All three formulas have the same structure: β_R and β_I are obtained by the same formula (2N₀/N−1)/(2α), just with different measurement circuits. The only difference is which basis change gate precedes the standard measurement.
Summary — The three measurements
Step
Circuit (before M)
P("0")
Estimated quantity
1 — Z basis
──[M]
|α|² = α²
α = √(N₀/N)
2 — X basis
──[H]──[M]
(1 + 2αβ_R)/2
β_R = (2N₀/N−1)/(2α)
3 — Y basis
──[S†]──[H]──[M]
(1 + 2αβ_I)/2
β_I = (2N₀/N−1)/(2α)
How many copies do we need? Each measurement is a Bernoulli trial with variance p(1−p)/N. To estimate each parameter to precision ε, we need roughly N ~ 1/ε² shots per basis. For three bases, total shots ≈ 3/ε². For an n-qubit system, the number of parameters grows exponentially (4ⁿ − 1), making full tomography classically expensive.
Tomography simulator — set the true state with θ and φ, then simulate N=2000 measurements per basis
70°120°
Ex 9.1Number of real parameters
A general qubit state |ψ⟩ = α|0⟩ + β|1⟩ has how many independent real parameters once we fix α ∈ ℝ and use normalisation? (enter a number)
Answer:
α ∈ ℝ gives 1 parameter. β = β_R + jβ_I gives 2 more. Normalisation α²+β_R²+β_I²=1 is already used to set the scale — it doesn't reduce the count further. Total: 3.
Ex 9.2Estimating α
In N=1000 Z-basis measurements we observe N₀ = 640 outcomes of "0". What is the estimate for α? (give 2 decimal places, e.g. 0.80)
α ≈
α = √(N₀/N) = √(640/1000) = √0.64 = 0.80.
Ex 9.3Estimating β_R
Using α = 0.80 from Ex 9.2, in N=1000 X-basis measurements we observe N₀ = 620. What is the estimate for β_R? (give 2 decimal places)