Quantum Computing Past Paper
Lecture 1: Bits and qubits
Given a complex number c = a + b i c = a + b i c = a + bi , where a , b ∈ R a, b \in \mathbb{R} a , b ∈ R ,
its norm is defined as ∣ c ∣ = c ∗ c = a 2 + b 2 |c| = c^* c = \sqrt{a^2 + b^2} ∣ c ∣ = c ∗ c = a 2 + b 2 , where c ∗ c^* c ∗ is the complex conjugate of c c c .
its square is defined as c 2 = ( a + i b ) 2 = a 2 − b 2 + 2 a b i c^2 = (a + ib)^2 = a^2 - b^2 + 2ab i c 2 = ( a + ib ) 2 = a 2 − b 2 + 2 abi .
Valid qubit state ∣ ψ ⟩ = a ∣ 0 ⟩ + b ∣ 1 ⟩ | \psi \rangle = a |0 \rangle + b |1 \rangle ∣ ψ ⟩ = a ∣0 ⟩ + b ∣1 ⟩ , where ∣ a ∣ 2 + ∣ b ∣ 2 = 1 |a|^2 + |b|^2 = 1 ∣ a ∣ 2 + ∣ b ∣ 2 = 1 .
Lecture 2: Linear algebra
Inner product ⟨ ψ ∣ × ∣ ϕ ⟩ = ⟨ ψ ∣ ϕ ⟩ = ∑ i = 1 n ψ i ∗ ϕ i \langle \psi | \times | \phi \rangle = \langle \psi | \phi \rangle = \sum_{i=1}^n \psi_i^* \phi_i ⟨ ψ ∣ × ∣ ϕ ⟩ = ⟨ ψ ∣ ϕ ⟩ = ∑ i = 1 n ψ i ∗ ϕ i . Outer product ∣ ψ ⟩ ⟨ ϕ ∣ = ∑ i = 1 n ∑ j = 1 n ψ i ϕ j ∗ ∣ i ⟩ ⟨ j ∣ | \psi \rangle \langle \phi | = \sum_{i=1}^n \sum_{j=1}^n \psi_i \phi_j^* |i \rangle \langle j| ∣ ψ ⟩ ⟨ ϕ ∣ = ∑ i = 1 n ∑ j = 1 n ψ i ϕ j ∗ ∣ i ⟩ ⟨ j ∣ .
Tensor / Kronecker product ∣ ψ ⟩ ⊗ ∣ ϕ ⟩ = ∣ ψ 1 ϕ , ψ 2 ϕ , . . . , ψ n ϕ ⟩ | \psi \rangle \otimes | \phi \rangle = | \psi_1 \phi, \psi_2 \phi, ... ,\psi_n \phi \rangle ∣ ψ ⟩ ⊗ ∣ ϕ ⟩ = ∣ ψ 1 ϕ , ψ 2 ϕ , ... , ψ n ϕ ⟩ ,
A ⊗ B = [ a 11 B ⋯ a 1 n B ⋮ ⋱ ⋮ a m 1 B ⋯ a m n B ] . A \otimes B = \begin{bmatrix}
a_{11}B & \cdots & a_{1n}B \\
\vdots & \ddots & \vdots \\
a_{m1}B & \cdots & a_{mn}B
\end{bmatrix}.
A ⊗ B = a 11 B ⋮ a m 1 B ⋯ ⋱ ⋯ a 1 n B ⋮ a mn B .
Hadamard / Element-wise product ∣ ψ ⟩ ∘ ∣ ϕ ⟩ = ∣ ψ ⟩ ⊙ ∣ ϕ ⟩ = ∣ ψ ϕ ⟩ = ∣ ψ 1 ϕ 1 , ψ 1 ϕ 2 , . . . , ψ n ϕ n ⟩ | \psi \rangle \circ | \phi \rangle = | \psi \rangle \odot | \phi \rangle = | \psi \phi \rangle = | \psi_1 \phi_1, \psi_1 \phi_2, ... ,\psi_n \phi_n \rangle ∣ ψ ⟩ ∘ ∣ ϕ ⟩ = ∣ ψ ⟩ ⊙ ∣ ϕ ⟩ = ∣ ψ ϕ ⟩ = ∣ ψ 1 ϕ 1 , ψ 1 ϕ 2 , ... , ψ n ϕ n ⟩ ,
A ∘ B = A ⊙ B = [ a 11 b 11 ⋯ a 1 n b 1 n ⋮ ⋱ ⋮ a m 1 b m 1 ⋯ a m n b m n ] . A \circ B = A \odot B =
\begin{bmatrix}
a_{11}b_{11} & \cdots & a_{1n}b_{1n} \\
\vdots & \ddots & \vdots \\
a_{m1}b_{m1} & \cdots & a_{mn}b_{mn}
\end{bmatrix}.
A ∘ B = A ⊙ B = a 11 b 11 ⋮ a m 1 b m 1 ⋯ ⋱ ⋯ a 1 n b 1 n ⋮ a mn b mn .
Eigenvalues λ i \lambda_i λ i / (normalised) eigenvectors ∣ v i ⟩ |v_i \rangle ∣ v i ⟩ U ∣ v i ⟩ = λ i ∣ v i ⟩ \boxed{U |v_i \rangle = \lambda_i |v_i \rangle} U ∣ v i ⟩ = λ i ∣ v i ⟩ , for unitary matrix U U U .
y2024p9q11 (b) , y2023p9q11 (d.i) , y2020p9q14 (b)
for 4x4 matrix, use block matrix representation.
U = T ⊗ H U = T \otimes H U = T ⊗ H , U ∣ v i ⟩ = λ i ∣ v i ⟩ U | v_i \rangle = \lambda_i | v_i \rangle U ∣ v i ⟩ = λ i ∣ v i ⟩ , we can decompose it into two eigenvalue problems, for any matrix T T T and H H H ,
T ∣ v t ⟩ = λ t ∣ v t ⟩ T | v_t \rangle = \lambda_t | v_t \rangle T ∣ v t ⟩ = λ t ∣ v t ⟩ , H ∣ v h ⟩ = λ h ∣ v h ⟩ H | v_h \rangle = \lambda_h | v_h \rangle H ∣ v h ⟩ = λ h ∣ v h ⟩
( T ⊗ H ) ( ∣ v t ⟩ ⊗ ∣ v h ⟩ ) = ( T ∣ v t ⟩ ) ⊗ ( H ∣ v h ⟩ ) = ( λ t ∣ v t ⟩ ) ⊗ ( λ h ∣ v h ⟩ ) = ( λ t λ h ) ( ∣ v t ⟩ ⊗ ∣ v h ⟩ ) (T \otimes H)(| v_t \rangle \otimes | v_h \rangle) = (T | v_t \rangle) \otimes (H | v_h \rangle) = (\lambda_t | v_t \rangle) \otimes (\lambda_h | v_h \rangle) = (\lambda_t \lambda_h)(| v_t \rangle \otimes | v_h \rangle) ( T ⊗ H ) ( ∣ v t ⟩ ⊗ ∣ v h ⟩) = ( T ∣ v t ⟩) ⊗ ( H ∣ v h ⟩) = ( λ t ∣ v t ⟩) ⊗ ( λ h ∣ v h ⟩) = ( λ t λ h ) ( ∣ v t ⟩ ⊗ ∣ v h ⟩) .
Hence, ∣ v i ⟩ = ∣ v t ⟩ ⊗ ∣ v h ⟩ | v_i \rangle = | v_t \rangle \otimes | v_h \rangle ∣ v i ⟩ = ∣ v t ⟩ ⊗ ∣ v h ⟩ and λ i = λ t λ h \lambda_i = \lambda_t \lambda_h λ i = λ t λ h .
For diagonalisable matrix, spectral decomposition U = ∑ i = 1 n λ i ∣ v i ⟩ ⟨ v i ∣ U=\sum_{i=1}^n \lambda_i |v_i \rangle \; \langle v_i | U = ∑ i = 1 n λ i ∣ v i ⟩ ⟨ v i ∣ .
Unitary ∩ \cap ∩ Hermitian: A 2 = I A^2=I A 2 = I (self-inverse), e.g. X , Y , Z , H X, Y, Z, H X , Y , Z , H .
⊆ \subseteq ⊆ Unitary A † A = I A^{\dagger}A = I A † A = I ⟹ \implies ⟹ A − 1 = A † A^{-1} = A^{\dagger} A − 1 = A † (unique inverse) ∨ \lor ∨ Hermitian A = A † A=A^{\dagger} A = A † (self-adjoint).
⊆ \subseteq ⊆ normal matrices A † A = A A † A^{\dagger}A = AA^{\dagger} A † A = A A † .
Lecture 3: Quantum mechanics postulates
Superposition Hadamard gate H H H ,
H ∣ x ⟩ = 1 2 ( ∣ 0 ⟩ + e i π x ∣ 1 ⟩ ) = 1 2 [ ∣ 0 ⟩ + ( − 1 ) x ∣ 1 ⟩ ] , since e i π x = ( − 1 ) x . = 1 2 ∑ z ∈ { 0 , 1 } ( − 1 ) x ⋅ z ∣ z ⟩ . \begin{aligned}
H | x \rangle
& = \frac{1}{\sqrt{2}} (| 0 \rangle + e^{i \pi x} | 1 \rangle) \\
& = \frac{1}{\sqrt{2}} [| 0 \rangle + (-1)^{x} | 1 \rangle] \quad \text{, since } e^{i \pi x} = (-1)^x. \\
& = \frac{1}{\sqrt{2}} \sum_{z \in \{0, 1\}} (-1)^{x \cdot z} | z \rangle
.
\end{aligned}
H ∣ x ⟩ = 2 1 ( ∣0 ⟩ + e iπ x ∣1 ⟩) = 2 1 [ ∣0 ⟩ + ( − 1 ) x ∣1 ⟩] , since e iπ x = ( − 1 ) x . = 2 1 z ∈ { 0 , 1 } ∑ ( − 1 ) x ⋅ z ∣ z ⟩ .
Interference discerns some global property of the state, e.g. Hadamard gate H H H , QFT, QPE.
Entanglement non-separability via Hadamard-CNOT combination CNOT ( H ⊗ I ) ∣ 00 ⟩ = 1 2 ( ∣ 00 ⟩ + ∣ 11 ⟩ ) \boxed{\text{CNOT} (H \otimes I)|00 \rangle= \frac{1}{\sqrt{2}} (|00 \rangle + |11 \rangle)} CNOT ( H ⊗ I ) ∣00 ⟩ = 2 1 ( ∣00 ⟩ + ∣11 ⟩) , transferring from standard basis to Bell basis.
y2022p9q11 (a.ii.)
single qubit unitary (local) applied to a 2-qubit state cannot change its (global) entanglement.
Three-qubit entanglement: collapse it to two-qubit via I 2 ⊗ CNOT I_2 \otimes \text{CNOT} I 2 ⊗ CNOT gate.
Measurement in computational basis or (|+>, |->
) basis
Measuring entangled states: sum of the squared amplitudes of the states in the basis.
Lecture 4: Quantum mechanics concepts
Perfectly distinguish pair of orthogonal states.
(1) either transfer qubits to computational basis,
(2) or measure in their basis.
y2022p8q11 (c,d)
Helstrom-Holevo bound p ≤ 1 + sin θ 2 p \leq \frac{1+\sin\theta}{2} p ≤ 2 1 + s i n θ , where ∣ ⟨ ψ a ∣ ψ b ⟩ ∣ = cos θ |\langle \psi_a | \psi_b \rangle|= \cos\theta ∣ ⟨ ψ a ∣ ψ b ⟩ ∣ = cos θ . Hence, sin θ = 1 − ∣ ⟨ ψ a ∣ ψ b ⟩ ∣ 2 \sin\theta = \sqrt{1-|\langle \psi_a | \psi_b \rangle|^2} sin θ = 1 − ∣ ⟨ ψ a ∣ ψ b ⟩ ∣ 2 .
Proof: ∣ ⟨ ψ a ∣ v a ⟩ ∣ 2 = c o s 2 ( π 2 − θ 2 ) = 1 + c o s ( π 2 − θ ) 2 = 1 + s i n θ 2 , |\langle \psi_a| v_a \rangle|^2 = cos^2(\frac{\frac{\pi}{2}-\theta}{2})=\frac{1+cos(\frac{\pi}{2}-\theta)}{2}=\frac{1+sin\theta}{2}, ∣ ⟨ ψ a ∣ v a ⟩ ∣ 2 = co s 2 ( 2 2 π − θ ) = 2 1 + cos ( 2 π − θ ) = 2 1 + s in θ , where the chosen measurement basis v i v_i v i spread equally each side of the states ψ i \psi_i ψ i to be distinguished.
y2012p8q11 (c)
disprove: measure non-orthogonal states with certainty.
No-signalling principle: impossible to use entanglement or any quantum operation to infer whether a distant party has measured their qubit. After measurement, the entanglement is collapsed, thus not possible to transmit information faster than light.
No-cloning principle: impossible to copy an unknown quantum state. ∄ U . U ( ∣ ψ ⟩ ∣ 0 ⟩ ) = ∣ ψ ⟩ ∣ ψ ⟩ \nexists U. U (| \psi \rangle |0 \rangle) = | \psi \rangle | \psi \rangle ∄ U . U ( ∣ ψ ⟩ ∣0 ⟩) = ∣ ψ ⟩ ∣ ψ ⟩ .
No-deleting principle: impossible to delete one of the unknown quantum state copies. ∄ U ~ . U ~ ( ∣ ψ ⟩ ∣ ψ ⟩ ) = ∣ ψ ⟩ ∣ 0 ⟩ \nexists \tilde{U}. \tilde{U} (| \psi \rangle |\psi \rangle) = |\psi \rangle | 0 \rangle ∄ U ~ . U ~ ( ∣ ψ ⟩ ∣ ψ ⟩) = ∣ ψ ⟩ ∣0 ⟩ .
Lecture 5: Quantum circuits
Universal gate set: { H , T , C N O T } \{H, T, CNOT\} { H , T , CNOT } . Pauli gates X = H Z H X=HZH X = H Z H , Y = i X Z = S X S Z Y=iXZ=SXSZ Y = i XZ = SXSZ .
Proof for Z = H X H Z=HXH Z = H X H (L8. quantum search)
either by matrix multiplication.
or geometric interpretation (X / Z X/Z X / Z : rotate 180 degree about x/z-axis, H H H : swap x and z axis).
Rotation R k = diag ( 1 , e i 2 π 2 k ) R_k = \text{diag}(1, e^{i \frac{2\pi}{2^{k}}}) R k = diag ( 1 , e i 2 k 2 π ) , R k † = diag ( 1 , e − i 2 π 2 k ) R_k^{\dagger} = \text{diag}(1, e^{-i \frac{2\pi}{2^{k}}}) R k † = diag ( 1 , e − i 2 k 2 π ) . R 0 = I R_0 = I R 0 = I , R 1 = Z R_1 = Z R 1 = Z , R 2 = S R_2 = S R 2 = S , R 3 = T R_3 = T R 3 = T , ... .
R z ( θ ) = diag ( e − i θ 2 , e i θ 2 ) R_z (\theta) = \text{diag}(e^{-i \frac{\theta}{2}}, e^{i \frac{\theta}{2}}) R z ( θ ) = diag ( e − i 2 θ , e i 2 θ ) , ignoring the global phase.
T = diag ( 1 , e i π 4 ) = R 3 = R z ( π 4 ) = e i π 8 diag ( e − i π 8 , e i π 8 ) . S = T 2 = diag ( 1 , e i π 2 = i ) = R 2 = R z ( π 2 ) = e i π 4 diag ( e − i π 4 , e i π 4 ) . Z = S 2 = diag ( 1 , e i π = − 1 ) = R 1 = R z ( π ) = e i π 2 diag ( e − i π 2 , e i π 2 ) . I = Z 2 = diag ( 1 , 1 ) = R 0 = R z ( 0 ) . \begin{aligned}
T & = \text{diag}(1, e^{i \frac{\pi}{4}})
&= R_3
& = R_z(\frac{\pi}{4})
= e^{i \frac{\pi}{8}} \text{diag}(e^{- i \frac{\pi}{8}}, e^{i \frac{\pi}{8}})
. \\
S & = T^2 = \text{diag}(1, e^{i \frac{\pi}{2}}=i)
& = R_2
& = R_z(\frac{\pi}{2})
= e^{i \frac{\pi}{4}} \text{diag}(e^{- i \frac{\pi}{4}}, e^{i \frac{\pi}{4}})
. \\
Z & = S^2 = \text{diag}(1, e^{i \pi}=-1)
& = R_1
& = R_z(\pi)
= e^{i \frac{\pi}{2}} \text{diag}(e^{- i \frac{\pi}{2}}, e^{i \frac{\pi}{2}})
. \\
I & = Z^2 = \text{diag}(1, 1)
& = R_0
& = R_z(0)
.
\end{aligned}
T S Z I = diag ( 1 , e i 4 π ) = T 2 = diag ( 1 , e i 2 π = i ) = S 2 = diag ( 1 , e iπ = − 1 ) = Z 2 = diag ( 1 , 1 ) = R 3 = R 2 = R 1 = R 0 = R z ( 4 π ) = e i 8 π diag ( e − i 8 π , e i 8 π ) . = R z ( 2 π ) = e i 4 π diag ( e − i 4 π , e i 4 π ) . = R z ( π ) = e i 2 π diag ( e − i 2 π , e i 2 π ) . = R z ( 0 ) .
[T , S T, S T , S are not self-invertible and Z Z Z is self-inverse].
Toffoli gate
SWAP can be decomposed into 3 CNOTs.
Design via standard quantum gates
y2023p9q11 (a.ii)
y2015p8q8 (b)
y2022p9q11 (a.i.)
two qubit entanglement
Z = H X H Z=HXH Z = H X H (L8. quantum search). Hence, C N O T = C X = ( I ⊗ H ) × C Z × ( I ⊗ H ) CNOT=CX=(I \otimes H) \times CZ \times (I \otimes H) CNOT = CX = ( I ⊗ H ) × CZ × ( I ⊗ H ) , by self-inverse of X , Z X,Z X , Z .
or ( U 1 ⊗ U 2 ) × CZ × ( H ⊗ H ) ∣ 00 ⟩ = ( U 1 ⊗ U 2 ) × 1 2 ( ∣ 00 ⟩ + ∣ 01 ⟩ + ∣ 10 ⟩ − ∣ 11 ⟩ ) (U_1 \otimes U_2) \times \text{CZ} \times (H \otimes H)|00 \rangle = (U_1 \otimes U_2) \times \frac{1}{2} \left( |00\rangle + |01\rangle + |10\rangle - |11\rangle \right) ( U 1 ⊗ U 2 ) × CZ × ( H ⊗ H ) ∣00 ⟩ = ( U 1 ⊗ U 2 ) × 2 1 ( ∣00 ⟩ + ∣01 ⟩ + ∣10 ⟩ − ∣11 ⟩ ) , but hard to decode.
or use outer product matrix form, with (input, output) pair.
Teleportation , send a qubit via two bits.
Super_dense coding , send two bits via one qubit.
sender: ∣ 00 ⟩ |00 \rangle ∣00 ⟩ → s u p e r p o s i t i o n H ⊗ I + CNOT \rightarrow_{superposition}^{H \otimes I + \text{CNOT}} → s u p er p os i t i o n H ⊗ I + CNOT Bell state → two bits { I , X , Z , X Z } \rightarrow_{\text{two bits}}^{\{I,X,Z,XZ\}} → two bits { I , X , Z , XZ } four Bell states.
receiver: four Bell states → i n t e r f e r e n c e CNOT + H ⊗ I \rightarrow_{interference}^{\text{CNOT} + H \otimes I} → in t er f ere n ce CNOT + H ⊗ I two bits.
Past paper
QKD: BB84
Eve's (intercept, measure, resend) attack.
Lecture 7: Deutsch-Jozsa algorithm
f : { 0 , 1 } n → { 0 , 1 } \boxed{f: \{0, 1\}^n \rightarrow \{0, 1\}} f : { 0 , 1 } n → { 0 , 1 } , which is either constant or balanced.
Prepare state: ∣ ψ ⟩ ∣ − ⟩ | \psi \rangle |-\rangle ∣ ψ ⟩ ∣ − ⟩ .
where the uniform superposition ∣ ψ ⟩ = ∣ + ⟩ ⊗ n = 1 2 n ∑ x ∈ { 0 , 1 } n ∣ x ⟩ | \psi \rangle = | + \rangle^{\otimes n} = \frac{1}{\sqrt{2^n}} \sum_{x \in \{0, 1\}^n} | x \rangle ∣ ψ ⟩ = ∣ + ⟩ ⊗ n = 2 n 1 ∑ x ∈ { 0 , 1 } n ∣ x ⟩ of all N = 2 n N=2^n N = 2 n states.
Unitary operation U f U_f U f , a phase operator on the state ∣ x ⟩ | x \rangle ∣ x ⟩ ,
U f ∣ x ⟩ ∣ y ⟩ = ∣ x ⟩ ∣ y ⊕ f ( x ) ⟩ U_f | x \rangle | y \rangle = | x \rangle | y \oplus f(x) \rangle U f ∣ x ⟩ ∣ y ⟩ = ∣ x ⟩ ∣ y ⊕ f ( x )⟩ , where y ∈ { 0 , 1 } y \in \{0, 1\} y ∈ { 0 , 1 } .
U f ∣ x ⟩ ∣ − ⟩ = ( − 1 ) f ( x ) ∣ x ⟩ ∣ − ⟩ U_f | x \rangle | - \rangle = (-1)^{f(x)} | x \rangle | - \rangle U f ∣ x ⟩ ∣ − ⟩ = ( − 1 ) f ( x ) ∣ x ⟩ ∣ − ⟩ .
Interference H ⊗ n H^{\otimes n} H ⊗ n and measure the first n n n qubits in ∣ 0 ⟩ ⊗ n | 0 \rangle^{\otimes n} ∣0 ⟩ ⊗ n basis.
H ⊗ n ∣ x ⟩ = 1 2 n ∑ z ∈ { 0 , 1 } n ( − 1 ) x ⋅ z ∣ z ⟩ \boxed{
H^{\otimes n} | x \rangle = \frac{1}{\sqrt{2^n}} \sum_{z \in \{0, 1\}^n} (-1)^{x \cdot z} | z \rangle
}
H ⊗ n ∣ x ⟩ = 2 n 1 z ∈ { 0 , 1 } n ∑ ( − 1 ) x ⋅ z ∣ z ⟩
Proof: as ∣ x ⟩ = ∣ x 1 . . . x n ⟩ | x \rangle = | x_1 ... x_n \rangle ∣ x ⟩ = ∣ x 1 ... x n ⟩ , where x i ∈ { 0 , 1 } x_i \in \{0, 1\} x i ∈ { 0 , 1 } and
H ∣ x i ⟩ = 1 2 ( ∣ 0 ⟩ + ( − 1 ) x i ∣ 1 ⟩ ) = 1 2 ( ∣ z 1 = 0 ⟩ + ( − 1 ) x i ∣ z j = 1 ⟩ ) = 1 2 ( ( − 1 ) x i × 0 ∣ z 1 = 0 ⟩ + ( − 1 ) x i × 1 ∣ z 2 = 1 ⟩ ) = 1 2 ( ( − 1 ) x i × z 1 ∣ z 1 = 0 ⟩ + ( − 1 ) x i × z 2 ∣ z 2 = 1 ⟩ ) = 1 2 ∑ z j ∈ { 0 , 1 } ( − 1 ) x i × z j ∣ z j ⟩ \begin{aligned}
H |x_i \rangle
& = \frac{1}{\sqrt{2}} (|0 \rangle + (-1)^{x_i} |1\rangle ) \\
& = \frac{1}{\sqrt{2}} (|z_1=0 \rangle + (-1)^{x_i} |z_j=1\rangle) \\
& = \frac{1}{\sqrt{2}} ((-1)^{x_i \times 0}|z_1=0 \rangle + (-1)^{x_i \times 1} |z_2=1\rangle) \\
& = \frac{1}{\sqrt{2}} ((-1)^{x_i \times z_1}|z_1=0 \rangle + (-1)^{x_i \times z_2} |z_2=1\rangle) \\
& = \frac{1}{\sqrt{2}} \sum_{z_j \in \{0, 1\}} (-1)^{x_i \times z_j} |z_j \rangle
\end{aligned}
H ∣ x i ⟩ = 2 1 ( ∣0 ⟩ + ( − 1 ) x i ∣1 ⟩) = 2 1 ( ∣ z 1 = 0 ⟩ + ( − 1 ) x i ∣ z j = 1 ⟩) = 2 1 (( − 1 ) x i × 0 ∣ z 1 = 0 ⟩ + ( − 1 ) x i × 1 ∣ z 2 = 1 ⟩) = 2 1 (( − 1 ) x i × z 1 ∣ z 1 = 0 ⟩ + ( − 1 ) x i × z 2 ∣ z 2 = 1 ⟩) = 2 1 z j ∈ { 0 , 1 } ∑ ( − 1 ) x i × z j ∣ z j ⟩
H ⊗ n ∣ x 1 . . . x n ⟩ = ⊗ i ( H ∣ x i ⟩ ) H^{\otimes n} | x_1 ... x_n \rangle = \otimes_i ( H |x_i \rangle) H ⊗ n ∣ x 1 ... x n ⟩ = ⊗ i ( H ∣ x i ⟩) , and the power of the function is ∑ i x i × z i = x ⋅ z \sum_{i} x_i \times z_i = x \cdot z ∑ i x i × z i = x ⋅ z , we are done.
Past paper
Lecture 8: Grover's search
Quadratic speedup over unstructured classical search, from O ( N ) O(N) O ( N ) to O ( N ) O(\sqrt{N}) O ( N ) .
M M M is the number of solutions (marked states f ( x ) = 1 f(x)=1 f ( x ) = 1 ) to the search problem.
Prepare state: ∣ ψ ⟩ ∣ − ⟩ | \psi \rangle |-\rangle ∣ ψ ⟩ ∣ − ⟩ .
where the uniform superposition ∣ ψ ⟩ = ∣ + ⟩ ⊗ n = 1 2 n ∑ x ∈ { 0 , 1 } n ∣ x ⟩ | \psi \rangle = | + \rangle^{\otimes n} = \frac{1}{\sqrt{2^n}} \sum_{x \in \{0, 1\}^n} | x \rangle ∣ ψ ⟩ = ∣ + ⟩ ⊗ n = 2 n 1 ∑ x ∈ { 0 , 1 } n ∣ x ⟩ of all N = 2 n N=2^n N = 2 n states.
With the target state ∣ x t ⟩ = 1 M ∑ x s.t. f ( x ) = 1 ∣ x ⟩ | x_t \rangle = \frac{1}{\sqrt{M}} \sum_{x \text{ s.t. } f(x) = 1} | x \rangle ∣ x t ⟩ = M 1 ∑ x s.t. f ( x ) = 1 ∣ x ⟩ ,
∣ ψ ⟩ = 1 N [ ∑ x s.t. f ( x ) = 0 ∣ x ⟩ + ∑ x s.t. f ( x ) = 1 ∣ x ⟩ ] = 1 N [ ∑ x s.t. f ( x ) = 0 ∣ x ⟩ + M 1 M ∑ x s.t. f ( x ) = 1 ∣ x ⟩ ] = 1 N [ ∑ x s.t. f ( x ) = 0 ∣ x ⟩ + M ∣ x t ⟩ ] \begin{aligned}
| \psi \rangle & = \frac{1}{\sqrt{N}} [ \sum_{x \text{ s.t. } f(x) = 0} | x \rangle + \sum_{x \text{ s.t. } f(x) = 1} | x \rangle] \\
&= \frac{1}{\sqrt{N}} [ \sum_{x \text{ s.t. } f(x) = 0} | x \rangle + \sqrt{M} \frac{1}{\sqrt{M}} \sum_{x \text{ s.t. } f(x) = 1} | x \rangle] \\
&= \frac{1}{\sqrt{N}} [ \sum_{x \text{ s.t. } f(x) = 0} | x \rangle + \sqrt{M} | x_t \rangle ]
\end{aligned}
∣ ψ ⟩ = N 1 [ x s.t. f ( x ) = 0 ∑ ∣ x ⟩ + x s.t. f ( x ) = 1 ∑ ∣ x ⟩] = N 1 [ x s.t. f ( x ) = 0 ∑ ∣ x ⟩ + M M 1 x s.t. f ( x ) = 1 ∑ ∣ x ⟩] = N 1 [ x s.t. f ( x ) = 0 ∑ ∣ x ⟩ + M ∣ x t ⟩]
Each iteration ( W ⊗ I ) V (W \otimes I) V ( W ⊗ I ) V : rotate the state towards the target state ∣ x t ⟩ | x_t \rangle ∣ x t ⟩ by 2 θ 2 \theta 2 θ , where θ = arcsin M N \theta = \arcsin\frac{\sqrt{M}}{\sqrt{N}} θ = arcsin N M .
Oracle V V V flips the sign of the target state ∣ x t ⟩ | x_t \rangle ∣ x t ⟩ , i.e. V ∣ x ⟩ = ( − 1 ) I ( x = x t ) ∣ x ⟩ V | x \rangle = (-1)^{\mathbb{I}(x=x_t)} | x \rangle V ∣ x ⟩ = ( − 1 ) I ( x = x t ) ∣ x ⟩ .
Diffusion operator W = 2 ∣ ψ ⟩ ⟨ ψ ∣ − I W = 2 | \psi \rangle \langle \psi | - I W = 2∣ ψ ⟩ ⟨ ψ ∣ − I , rotating ∣ ψ ′ ⟩ = V ∣ ψ ⟩ | \psi' \rangle =V | \psi \rangle ∣ ψ ′ ⟩ = V ∣ ψ ⟩ around the axis ∣ ψ ⟩ | \psi \rangle ∣ ψ ⟩ .
reflected vector: ∣ ψ ′ ′ ⟩ = 2 ∣ ψ ⟩ ⟨ ψ ∣ ∣ ψ ′ ⟩ − ∣ ψ ′ ⟩ | \psi'' \rangle = 2 | \psi \rangle \langle \psi| | \psi' \rangle - | \psi' \rangle ∣ ψ ′′ ⟩ = 2∣ ψ ⟩ ⟨ ψ ∣∣ ψ ′ ⟩ − ∣ ψ ′ ⟩ , where the former is the projected vector of ∣ ψ ′ ⟩ | \psi' \rangle ∣ ψ ′ ⟩ onto the axis ∣ ψ ⟩ | \psi \rangle ∣ ψ ⟩ .
|a> = |psi> <psi|psi'>, projected vector
|b> = 2|psi> <psi|psi'>,
|psi''> = |b> - |psi'>, by parallelogram.
= 2 |psi> <psi|psi'> - |psi'>.
/> |psi''>
/
/ |a> |b>
---->|----->-----> |psi>
\ | /> |psi''>
\ | /
\ | /
\> |psi'>
After n i t n_{it} n i t iterations, the angle between the final state and the target state is ( 2 n i t + 1 ) θ (2n_{it}+1) \theta ( 2 n i t + 1 ) θ .
n i t = π 2 − θ 2 θ = π 4 θ ≈ π 4 sin θ n_{it} = \frac{\frac{\pi}{2} - \theta}{2\theta} = \frac{\pi}{4\theta} \approx \frac{\pi}{4\sin\theta} n i t = 2 θ 2 π − θ = 4 θ π ≈ 4 s i n θ π .
the final state is 1 N [ cos ( ( 2 n i t + 1 ) θ ) ∑ x s.t. f ( x ) = 0 ∣ x ⟩ + sin ( ( 2 n i t + 1 ) θ ) ∣ x t ⟩ ] \frac{1}{\sqrt{N}}[ \cos((2n_{it}+1)\theta) \sum_{x \text{ s.t. } f(x) = 0} | x \rangle + \sin((2n_{it}+1)\theta) | x_t \rangle] N 1 [ cos (( 2 n i t + 1 ) θ ) ∑ x s.t. f ( x ) = 0 ∣ x ⟩ + sin (( 2 n i t + 1 ) θ ) ∣ x t ⟩] .
the probability of measuring the target state is sin 2 ( ( 2 n i t + 1 ) θ ) \sin^2((2n_{it}+1)\theta) sin 2 (( 2 n i t + 1 ) θ ) .
Past papers
Lecture 9: QFT & QPE
QFT transforms a sequence of N N N complex numbers { x } \{x\} { x } into another { y } \{y\} { y } of the same length,
∣ x ⟩ |x \rangle ∣ x ⟩ → \rightarrow → ∣ y ⟩ |y \rangle ∣ y ⟩ :
∑ j = 0 N − 1 x j ∣ j ⟩ \sum_{j=0}^{N-1} x_j |j \rangle ∑ j = 0 N − 1 x j ∣ j ⟩ → \rightarrow → ∑ k = 0 N − 1 y k ∣ k ⟩ \sum_{k=0}^{N-1} y_k |k \rangle ∑ k = 0 N − 1 y k ∣ k ⟩ , where y k = 1 N ∑ j = 0 N − 1 w j k x j \boxed{y_k = \frac{1}{\sqrt{N}} \sum_{j=0}^{N-1} w^{jk} x_j} y k = N 1 j = 0 ∑ N − 1 w jk x j and w = e i 2 π N w = e^{i \frac{2\pi}{N}} w = e i N 2 π .
The normalization term is 1 N \frac{1}{N} N 1 and exponential term is negated in DFT.
here, we use 1 N \frac{1}{\sqrt{N}} N 1 to satisfy the unitary condition, where the dimension of Hilbert space for n n n qubits is N = 2 n N=2^n N = 2 n .
The time series coefficients x j x_j x j are transformed into the frequency domain coefficients y k y_k y k .
DFT is the change of basis operator that converts from euclidean basis to the Fourier basis.
each y k y_k y k corresponds to how much of the sinusoid with frequency f = k N f=\frac{k}{N} f = N k [cycles per sample] is present in the signal.
w j k = e i 2 π N j k = cos ( 2 π k N j ) + i sin ( 2 π k N j ) w^{jk} = e^{i \frac{2\pi}{N} jk} = \cos(\frac{2\pi k}{N} j) + i \sin(\frac{2\pi k}{N} j) w jk = e i N 2 π jk = cos ( N 2 πk j ) + i sin ( N 2 πk j ) , forming an orthogonal basis over the space of N N N complex vectors.
note that w N = e i 2 π = 1 w^{N} = e^{i 2\pi} = 1 w N = e i 2 π = 1 .
Alternatively, we can express the QFT as a matrix transformation M \mathbf{M} M , where N N N is the dimension of the Hilbert space.
The DFT is thus y = M x y = \mathbf{M} x y = M x , which in the matrix form is expressed as,
[ y 0 … y k … y N − 1 ] = 1 N [ 1 1 1 … 1 1 ω ω 2 … ω N − 1 1 ω 2 ω 4 … ω 2 ( N − 1 ) 1 … … … … 1 ω N − 1 ω 2 ( N − 1 ) … ω ( N − 1 ) ( N − 1 ) ] ⋅ [ x 0 … x j … x N − 1 ] , where ω = e i 2 π N . \begin{bmatrix}
y_0 \\
\dots \\
y_k \\
\dots \\
y_{N-1}
\end{bmatrix}
=
\frac{1}{\sqrt{N}}
\begin{bmatrix}
1 & 1 & 1 & \dots & 1 \\
1 & \omega & \omega^2 & \dots & \omega^{N-1} \\
1 & \omega^2 & \omega^4 & \dots & \omega^{2(N-1)} \\
1 & \dots & \dots & \dots & \dots \\
1 & \omega^{N-1} & \omega^{2(N-1)} & \dots & \omega^{(N-1)(N-1)}
\end{bmatrix}
\cdot
\begin{bmatrix}
x_0 \\
\dots \\
x_j \\
\dots \\
x_{N-1}
\end{bmatrix},
\text{where }\omega = e^{i \frac{2\pi}{N}}.
y 0 … y k … y N − 1 = N 1 1 1 1 1 1 1 ω ω 2 … ω N − 1 1 ω 2 ω 4 … ω 2 ( N − 1 ) … … … … … 1 ω N − 1 ω 2 ( N − 1 ) … ω ( N − 1 ) ( N − 1 ) ⋅ x 0 … x j … x N − 1 , where ω = e i N 2 π .
The matrix M \mathbf{M} M can be expressed as a sum of outer products of the basis states ∣ k ⟩ |k \rangle ∣ k ⟩ , and ⟨ j ∣ \langle j| ⟨ j ∣ ,
M = 1 N ∑ j = 0 N − 1 ∑ k = 0 N − 1 ω j k ∣ k ⟩ ⟨ j ∣ . \mathbf{M} = \frac{1}{\sqrt{N}} \sum_{j=0}^{N-1} \sum_{k=0}^{N-1} \omega^{jk} |k \rangle \langle j|.
M = N 1 j = 0 ∑ N − 1 k = 0 ∑ N − 1 ω jk ∣ k ⟩ ⟨ j ∣.
where the outer product maps the state from ∣ j ⟩ |j \rangle ∣ j ⟩ to ∣ k ⟩ |k \rangle ∣ k ⟩ ,
M ∣ j ⟩ = 1 N ∑ k = 0 N − 1 ω j k ∣ k ⟩ ⟨ j ∣ j ⟩ , ∣ j ⟩ → M 1 N ∑ k = 0 N − 1 ω j k ∣ k ⟩ . {\mathbf{M}} |j \rangle = \frac{1}{\sqrt{N}} \sum_{k=0}^{N-1} \omega^{jk} |k \rangle \langle j | j \rangle, \\
|j \rangle \rightarrow^{\mathbf{M}} \frac{1}{\sqrt{N}} \sum_{k=0}^{N-1} \omega^{jk} |k \rangle. \\
M ∣ j ⟩ = N 1 k = 0 ∑ N − 1 ω jk ∣ k ⟩ ⟨ j ∣ j ⟩ , ∣ j ⟩ → M N 1 k = 0 ∑ N − 1 ω jk ∣ k ⟩ .
inverse QFT (iQFT)
∣ y ⟩ |y \rangle ∣ y ⟩ → \rightarrow → ∣ x ⟩ |x \rangle ∣ x ⟩ : ∑ k = 0 N − 1 y k ∣ k ⟩ → ∑ j = 0 N − 1 x j ∣ j ⟩ \sum_{k=0}^{N-1} y_k |k \rangle \rightarrow \sum_{j=0}^{N-1} x_j |j \rangle ∑ k = 0 N − 1 y k ∣ k ⟩ → ∑ j = 0 N − 1 x j ∣ j ⟩ , where x j = 1 N ∑ k = 0 N − 1 w − j k y k \boxed{x_j = \frac{1}{\sqrt{N}} \sum_{k=0}^{N-1} w^{-jk} y_k} x j = N 1 k = 0 ∑ N − 1 w − jk y k and w − j k = e − i 2 π N j k w^{-jk} = e^{-i \frac{2\pi}{N} jk } w − jk = e − i N 2 π jk .
The exponential term is negated from the QFT.
Quantum Phase Estimation (QPE)
If given the eigenvector ∣ u ⟩ |u \rangle ∣ u ⟩ of U U U and eigenvalue e i 2 π ϕ e^{i 2\pi \phi} e i 2 π ϕ with phase ϕ ∈ [ 0 , 1 ) \phi \in [0,1) ϕ ∈ [ 0 , 1 ) , we have U ∣ u ⟩ = e i 2 π ϕ ∣ u ⟩ U |u \rangle = e^{i 2\pi \phi}|u \rangle U ∣ u ⟩ = e i 2 π ϕ ∣ u ⟩ , we can estimate the phase ϕ \phi ϕ via QPE with t t t bits of precision.
preparation
1 s t 1^{st} 1 s t register: H ⊗ t ∣ 0 ⟩ ⊗ t = 1 2 t ∑ x ∈ { 0 , 1 } t ∣ x ⟩ H ^ {\otimes t} |0 \rangle^{\otimes t}=\frac{1}{\sqrt{2^t}}\sum_{x\in \{0,1\}^t}|x \rangle H ⊗ t ∣0 ⟩ ⊗ t = 2 t 1 ∑ x ∈ { 0 , 1 } t ∣ x ⟩ (superposition)
2 n d 2^{nd} 2 n d register: the (superposition of) given eigenvector(s) ∣ u ⟩ |u \rangle ∣ u ⟩ with eigenvalue e i 2 π ϕ e^{i 2 \pi \phi} e i 2 π ϕ ,
e.g. ∣ 0 ⟩ = a ∣ u 1 ⟩ + b ∣ u 2 ⟩ |0 \rangle = a |u_1 \rangle + b |u_2 \rangle ∣0 ⟩ = a ∣ u 1 ⟩ + b ∣ u 2 ⟩ , where ∣ u 1 ⟩ |u_1 \rangle ∣ u 1 ⟩ and ∣ u 2 ⟩ |u_2 \rangle ∣ u 2 ⟩ are the eigenvectors of U U U with eigenvalues e i 2 π ϕ 1 e^{i 2 \pi \phi_1} e i 2 π ϕ 1 and e i 2 π ϕ 2 e^{i 2 \pi \phi_2} e i 2 π ϕ 2 .
oracle U j U^j U j on the 1 s t 1^{st} 1 s t register (Entanglement)
1 2 ( ∣ 0 ⟩ + ∣ 1 ⟩ ) → 1 2 ( ∣ 0 ⟩ + ( e i 2 π ϕ ) j ∣ 1 ⟩ ) \frac{1}{\sqrt{2}} (|0 \rangle + |1 \rangle) \rightarrow \frac{1}{\sqrt{2}} (|0 \rangle + (e^{i 2 \pi \phi })^j |1 \rangle) 2 1 ( ∣0 ⟩ + ∣1 ⟩) → 2 1 ( ∣0 ⟩ + ( e i 2 π ϕ ) j ∣1 ⟩)
1 2 t ∑ x = 0 2 t − 1 ∣ x ⟩ → 1 2 t ∑ j = 0 2 t − 1 ( e i 2 π ϕ ) j ∣ j ⟩ \frac{1}{\sqrt{2^t}} \sum_{x=0}^{2^t-1}|x \rangle \rightarrow \frac{1}{\sqrt{2^t}} \sum_{j=0}^{2^t-1} (e^{i 2 \pi \phi })^j |j \rangle 2 t 1 ∑ x = 0 2 t − 1 ∣ x ⟩ → 2 t 1 ∑ j = 0 2 t − 1 ( e i 2 π ϕ ) j ∣ j ⟩
2 n d 2^{nd} 2 n d register: respective ∣ u ⟩ |u \rangle ∣ u ⟩ with eigenvalue e i 2 π ϕ e^{i 2 \pi \phi} e i 2 π ϕ and phase ϕ \phi ϕ .
iQFT (Interference)
measurement
1 s t 1^{st} 1 s t register: t bits approximation of ∣ ϕ ~ ⟩ | \tilde{\phi} \rangle ∣ ϕ ~ ⟩
2 n d 2^{nd} 2 n d register: ∣ u ⟩ |u \rangle ∣ u ⟩ with phase ϕ \phi ϕ .
∣ u 1 ⟩ | u_1 \rangle ∣ u 1 ⟩ with probability ∣ a ∣ 2 |a|^2 ∣ a ∣ 2 and ∣ u 2 ⟩ | u_2 \rangle ∣ u 2 ⟩ with probability ∣ b ∣ 2 |b|^2 ∣ b ∣ 2 .
Past papers: QFT
y2015p8q8 (b)
design two qubit QFT circuit
y2009p9q11 (b)
(i) QFT in the matrix and outer product form D D D .
(ii) the sum of geometric series for ∑ l \sum_l ∑ l (case split on q = 1 q=1 q = 1 and q ≠ 1 q \neq 1 q = 1 ).
(iii) relationship between QFT and iQFT is D = D 2 D − 1 D = D^{2} D^{-1} D = D 2 D − 1 ,
The sum ∑ i = 1 M − 1 ∣ M − 1 ⟩ ⟨ i ∣ \sum_{i=1}^{M-1} | M-1 \rangle \langle i | ∑ i = 1 M − 1 ∣ M − 1 ⟩ ⟨ i ∣ maps the state ∣ i ⟩ |i \rangle ∣ i ⟩ to ∣ M − 1 ⟩ |M-1 \rangle ∣ M − 1 ⟩ , shifting by one the nonzero basis labels.
iQFT / QPE
Lecture 10: QFT & QPE: factoring
order finding : for coprime x x x and N N N , find x r ≡ 1 m o d N x^r \equiv 1 \mod N x r ≡ 1 mod N , where r r r is the least positive integer.
U ∣ r ⟩ = ∣ ( x ⋅ r ) m o d N ⟩ U |r \rangle = |(x \cdot r) \mod N \rangle U ∣ r ⟩ = ∣ ( x ⋅ r ) mod N ⟩ ⟹ \implies ⟹ For eigenstates s ∈ [ 0 , r − 1 ] , s\in [0, r-1], s ∈ [ 0 , r − 1 ] , we have eigenvectors ∣ u s ⟩ = 1 r ∑ j = 0 r − 1 e − i 2 π s r j ∣ x j m o d N ⟩ |u_s \rangle = \frac{1}{\sqrt{r}} \sum_{j=0}^{r-1} e^{-i 2\pi \frac{s}{r}}j |x^j \mod N \rangle ∣ u s ⟩ = r 1 ∑ j = 0 r − 1 e − i 2 π r s j ∣ x j mod N ⟩ with phase ϕ = s r \phi = \frac{s}{r} ϕ = r s .
Use QPE, 2 n d 2^{nd} 2 n d register prepared with equal superposition of unknown eigenvectors 1 r ∑ j = 0 r − 1 ∣ u j ⟩ = ∣ 1 ⟩ \frac{1}{\sqrt{r}} \sum_{j=0}^{r-1} |u_j \rangle = |1 \rangle r 1 ∑ j = 0 r − 1 ∣ u j ⟩ = ∣1 ⟩ (shallow-depth quantum circuit X X X ).
factoring : for composite integer N N N , N = p ⋅ q N=p \cdot q N = p ⋅ q , where p p p and q q q are prime numbers.
Shor's algorithm
Lecture 11: QFT & QPE: quantum chemistry
Trotter formula: U = e − i ( H 1 + H 2 ) t = U 1 U 2 = e − i H 1 t e − i H 2 t + O ( t 2 ) U = e^{-i(H_1+H_2)t} = U_1 U_2 = e^{-iH_1 t} e^{-iH_2t} + O(t^2) U = e − i ( H 1 + H 2 ) t = U 1 U 2 = e − i H 1 t e − i H 2 t + O ( t 2 ) , where U 1 U_1 U 1 and U 2 U_2 U 2 don't commute.
Projective measurement with (normalized) eigenvectors
Ground state energy estimation ∣ e 0 ⟩ | e_0 \rangle ∣ e 0 ⟩ of a H H H with eigenvalue λ 0 = E 0 \lambda_0 = E_0 λ 0 = E 0 .
Use QPE, 2 n d 2^{nd} 2 n d register should be prepared as close to the eigenvector such that it's sufficiently dominated by the ground state ∣ e 0 ⟩ | e_0 \rangle ∣ e 0 ⟩
L15. adiabatic state preparation.
Lecture 12: Quantum automata and complexity
Trick: try different combinations of matrix multiplication for state transition.
Lecture 13: Quantum error correction
New addition of Practical QEC (Google implementation).
Lecture 14: Fault tolerance
bit-flip, phase-flip, Shor code, Steane code
Fault tolerance threshold p t h = 1 c p_{th} = \frac{1}{c} p t h = c 1 , for suppressed error rate p = c p e 2 + O ( p e 3 ) p = c p_e^2 + O(p_e^3) p = c p e 2 + O ( p e 3 ) . Per-gate error rate ( c p e ) 2 k c \frac{(cp_e)^{2^k}}{c} c ( c p e ) 2 k after k k k concatenation.
Lecture 15: Adiabatic quantum computing
The adiabatic quantum theory, as a universal computing model that is polynomially equivalent to gate-based.
Quantum annealing, D-Wave.
QAOA
Lecture 16: Near-term case studies
Superconduct, trapped-ion, silicon, optical.