Quantum Computing

computer-science

Selected notes from COMS 4281 Introduction to Quantum Computing taught by Prof. Henry Yuen in Fall 2025.

Qubits

A quantum bit (or qubit) is the basic unit of information in quantum computing. Unlike classical bits that are exclusively 0 or 1, a qubit exists in a superposition of both states. However, upon measurement, the qubit collapses to a classical bit value.

Mathematically, a qubit state is represented as:

∣ψ⟩=α∣0⟩+β∣1⟩|\psi\rangle = \alpha|0\rangle + \beta|1\rangle

where α,β∈C\alpha, \beta \in \mathbb{C} are complex amplitudes satisfying ∣α∣2+∣β∣2=1|\alpha|^2 + |\beta|^2 = 1.

The states ∣0⟩|0\rangle and ∣1⟩|1\rangle form an orthonormal basis:

∣0⟩=(10),∣1⟩=(01)|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}, \quad |1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}

Systems and States

A quantum system SS may be in one of dd different states, represented as ∣0⟩,∣1⟩,…,∣d−1⟩|0\rangle, |1\rangle, \ldots, |d-1\rangle.

Composite Systems

Composite systems are formed from two or more individual systems. If systems S1S_1 and S2S_2 combine, the composite system is denoted S1⊗S2S_1 \otimes S_2.

The state of the composite system is:

∣x1⟩⊗∣x2⟩|x_1\rangle \otimes |x_2\rangle

This is often abbreviated as:

∣x1⟩⊗∣x2⟩=∣x1⟩∣x2⟩=∣x1,x2⟩=∣x1x2⟩|x_1\rangle \otimes |x_2\rangle = |x_1\rangle|x_2\rangle = |x_1, x_2\rangle = |x_1 x_2\rangle

Transformations on composite systems: If RR is applied to S1S_1 and UU is applied to S2S_2, we write:

(R⊗U)(∣x1⟩⊗∣x2⟩)=R∣x1⟩⊗U∣x2⟩(R \otimes U)(|x_1\rangle \otimes |x_2\rangle) = R|x_1\rangle \otimes U|x_2\rangle

Some transformations cannot be written as independent transformations on each subsystem. These are entangling operations, such as CNOT.

Measurement

When a qubit in state ∣ψ⟩=α∣0⟩+β∣1⟩|\psi\rangle = \alpha|0\rangle + \beta|1\rangle is measured in the computational basis:

Common Quantum Gates

Single-Qubit Gates

Pauli-X (NOT gate):

X=(0110)X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}

Effect: X∣0⟩=∣1⟩X|0\rangle = |1\rangle, X∣1⟩=∣0⟩X|1\rangle = |0\rangle

Pauli-Z:

Z=(100−1)Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}

Effect: Z∣0⟩=∣0⟩Z|0\rangle = |0\rangle, Z∣1⟩=−∣1⟩Z|1\rangle = -|1\rangle

Hadamard (H):

H=12(111−1)H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}

The Hadamard gate creates superposition:

H∣0⟩=12(∣0⟩+∣1⟩)=∣+⟩H∣1⟩=12(∣0⟩−∣1⟩)=∣−⟩\begin{align*} H|0\rangle &= \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) = |+\rangle \\ H|1\rangle &= \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle) = |-\rangle \end{align*}

General formula:

H∣a⟩=12∑b∈{0,1}(−1)a⋅b∣b⟩H|a\rangle = \frac{1}{\sqrt{2}}\sum_{b \in \{0,1\}} (-1)^{a\cdot b}|b\rangle

Two-Qubit Gates

CNOT (Controlled-NOT):

CNOT=(1000010000010010)\text{CNOT} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}

Effect: Flips the target qubit if the control qubit is ∣1⟩|1\rangle:

Partial Measurements in Non-Standard Bases

Measuring in Different Bases

Given a state ∣ψ⟩=∑i,jαij∣i⟩∣j⟩|\psi\rangle = \sum_{i,j} \alpha_{ij}|i\rangle|j\rangle and a measurement basis B={∣b0⟩,∣b1⟩,…,∣bd⟩}B = \{|b_0\rangle, |b_1\rangle, \ldots, |b_d\rangle\} for the first register.

The projection onto ∣bℓ⟩|b_\ell\rangle (not normalized) is:

∣vℓ⟩=(∣bℓ⟩⟨bℓ∣⊗I)∣ψ⟩=∑i,jαij⟨bℓ∣i⟩∣bℓ⟩⊗∣j⟩|v_\ell\rangle = (|b_\ell\rangle\langle b_\ell| \otimes I)|\psi\rangle = \sum_{i,j} \alpha_{ij}\langle b_\ell|i\rangle |b_\ell\rangle \otimes |j\rangle

The probability of measuring ∣bℓ⟩|b_\ell\rangle is:

Pr⁡[∣bℓ⟩]=∥vℓ∥2=∑j∣∑iαij⟨bℓ∣i⟩∣2\Pr[|b_\ell\rangle] = \|v_\ell\|^2 = \sum_{j}\left|\sum_{i} \alpha_{ij}\langle b_\ell|i\rangle\right|^2

The post-measurement state is:

∣vℓ⟩∥∣vℓ∥∣\frac{|v_\ell\rangle}{\||v_\ell\||}

Example: Measuring in the {|+⟩, |−⟩} Basis

Given state: ∣ψ⟩=32∣00⟩−12∣11⟩|\psi\rangle = \frac{\sqrt{3}}{2}|00\rangle - \frac{1}{2}|11\rangle

Measure the first qubit in basis {∣+⟩,∣−⟩}\{|+\rangle, |-\rangle\} where:

∣0⟩=12(∣+⟩+∣−⟩),∣1⟩=12(∣+⟩−∣−⟩)|0\rangle = \frac{1}{\sqrt{2}}(|+\rangle + |-\rangle), \quad |1\rangle = \frac{1}{\sqrt{2}}(|+\rangle - |-\rangle)

Substituting:

∣ψ⟩=322(∣+⟩+∣−⟩)∣0⟩−122(∣+⟩−∣−⟩)∣1⟩=122[3∣+,0⟩+3∣−,0⟩−∣+,1⟩+∣−,1⟩]\begin{align*} |\psi\rangle &= \frac{\sqrt{3}}{2\sqrt{2}}(|+\rangle + |-\rangle)|0\rangle - \frac{1}{2\sqrt{2}}(|+\rangle - |-\rangle)|1\rangle \\ &= \frac{1}{2\sqrt{2}}\left[\sqrt{3}|+,0\rangle + \sqrt{3}|-,0\rangle - |+,1\rangle + |-,1\rangle\right] \end{align*}

Probability of measuring ∣+⟩|+\rangle:

Pr⁡[∣+⟩]=18(3+1)=12\Pr[|+\rangle] = \frac{1}{8}(3 + 1) = \frac{1}{2}

Post-measurement state (unnormalized):

∣v+⟩∥∣v+∥∣=322∣+,0⟩−122∣+,1⟩∥⋅∥\frac{|v_+\rangle}{\||v_+\||} = \frac{\frac{\sqrt{3}}{2\sqrt{2}}|+,0\rangle - \frac{1}{2\sqrt{2}}|+,1\rangle}{\|\cdot\|}

Key observation: If qubits are unentangled, measuring one does not affect the other. If entangled, measurement collapses both qubits to correlated states.

Bell States

The four Bell states are maximally entangled two-qubit states:

∣Φ+⟩=12(∣00⟩+∣11⟩)∣Φ−⟩=12(∣00⟩−∣11⟩)∣Ψ+⟩=12(∣01⟩+∣10⟩)∣Ψ−⟩=12(∣01⟩−∣10⟩)\begin{align*} |\Phi^+\rangle &= \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle) \\ |\Phi^-\rangle &= \frac{1}{\sqrt{2}}(|00\rangle - |11\rangle) \\ |\Psi^+\rangle &= \frac{1}{\sqrt{2}}(|01\rangle + |10\rangle) \\ |\Psi^-\rangle &= \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle) \end{align*}

Creating Bell States

Starting with ∣Φ1⟩=12(∣00⟩+∣11⟩)|\Phi_1\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle), we can create all four Bell states using two classical bits b1,b2b_1, b_2:

Apply operations based on b1b_1 and b2b_2:

Result: ∣Φ4⟩=∣b1b2⟩|\Phi_4\rangle = |b_1b_2\rangle (encodes both bits into Bell state)

Distinguishing Bell States with CNOT

Given an unknown Bell state, CNOT helps identify which one it is:

Starting State After CNOT0→1_{0\to1}
∣Φ+⟩|\Phi^+\rangle ∣+⟩⊗∣0⟩|+\rangle \otimes |0\rangle
∣Φ−⟩|\Phi^-\rangle ∣−⟩⊗∣0⟩|-\rangle \otimes |0\rangle
∣Ψ+⟩|\Psi^+\rangle ∣+⟩⊗∣1⟩|+\rangle \otimes |1\rangle
∣Ψ−⟩|\Psi^-\rangle ∣−⟩⊗∣1⟩|-\rangle \otimes |1\rangle

Key insight: CNOT on entangled states helps recover information about which Bell state we started with by measuring the second qubit.

Quantum Teleportation

Protocol: Transfer an unknown qubit state ∣ψ⟩=α∣0⟩+β∣1⟩|\psi\rangle = \alpha|0\rangle + \beta|1\rangle from Alice to Bob using:

Circuit

Quantum teleportation circuit

Step-by-Step Evolution

Initial state:

∣ϕ1⟩=∣ψ⟩⊗12(∣00⟩+∣11⟩)|\phi_1\rangle = |\psi\rangle \otimes \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)

Expanding ∣ψ⟩=α∣0⟩+β∣1⟩|\psi\rangle = \alpha|0\rangle + \beta|1\rangle:

∣ϕ1⟩=12[α∣000⟩+α∣011⟩+β∣100⟩+β∣111⟩]\begin{align*} |\phi_1\rangle &= \frac{1}{\sqrt{2}}[\alpha|000\rangle + \alpha|011\rangle + \beta|100\rangle + \beta|111\rangle] \end{align*}

After CNOT0→1_{0\to1}:

∣ϕ2⟩=12[α∣000⟩+α∣011⟩+β∣110⟩+β∣101⟩]\begin{align*} |\phi_2\rangle &= \frac{1}{\sqrt{2}}[\alpha|000\rangle + \alpha|011\rangle + \beta|110\rangle + \beta|101\rangle] \end{align*}

After H on first qubit:

∣ϕ3⟩=12[∣00⟩(α∣0⟩+β∣1⟩)+∣01⟩(α∣1⟩+β∣0⟩)+∣10⟩(α∣0⟩−β∣1⟩)+∣11⟩(α∣1⟩−β∣0⟩)]\begin{align*} |\phi_3\rangle &= \frac{1}{2}\Big[|00\rangle(\alpha|0\rangle + \beta|1\rangle) + |01\rangle(\alpha|1\rangle + \beta|0\rangle) \\ &\quad\quad + |10\rangle(\alpha|0\rangle - \beta|1\rangle) + |11\rangle(\alpha|1\rangle - \beta|0\rangle)\Big] \end{align*}

Measurement Results and Corrections

Alice measures Bob’s state Correction
∣00⟩|00\rangle α∣0⟩+β∣1⟩\alpha|0\rangle + \beta|1\rangle II (none)
∣01⟩|01\rangle α∣1⟩+β∣0⟩\alpha|1\rangle + \beta|0\rangle XX
∣10⟩|10\rangle α∣0⟩−β∣1⟩\alpha|0\rangle - \beta|1\rangle ZZ
∣11⟩|11\rangle α∣1⟩−β∣0⟩\alpha|1\rangle - \beta|0\rangle ZXZX

Result: In all cases, after Alice sends her 2 classical bits and Bob applies the appropriate correction, Bob’s qubit becomes ∣ψ⟩|\psi\rangle.

Important:

Information Theory in Quantum Computing

Amount of Information

An nn-qubit system is in superposition of 2n2^n states:

∣ψ⟩=∑x∈{0,1}nαx∣x⟩|\psi\rangle = \sum_{x \in \{0,1\}^n} \alpha_x|x\rangle

This appears to perform 2n2^n calculations in parallel, but measurement collapses to a single outcome.

Holevo’s Theorem

Setup:

Theorem: mx=mx′m_x = m_x' with high probability only if n≥mn \geq m.

In other words, you need at least as many qubits as classical bits to reliably transmit information.

Superdense Coding

If Alice and Bob share pre-shared entanglement, then n=m/2n = m/2 qubits is sufficient!

Protocol: Alice can transmit 2 classical bits using 1 qubit + 1 pre-shared EPR pair.

Circuit:

Superdense coding circuit

Starting with EPR pair ∣Φ1⟩=12(∣00⟩+∣11⟩)|\Phi_1\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle):

  1. Alice applies gates based on (b1,b2)(b_1, b_2):

    • b2=1b_2 = 1: Apply CNOTb2→0\text{CNOT}_{b_2\to0}
    • b1=1b_1 = 1: Apply CZb1→0CZ_{b_1\to0}
  2. Result: State becomes one of the four Bell states encoding b1b2b_1b_2

  3. Bob applies CNOT + H to distinguish which Bell state, measuring ∣b1b2⟩|b_1b_2\rangle

Result: 2 bits transmitted with 1 qubit!

Qubit Rotation

Consider the rotation matrix:

Vθ=(cos⁡θ−sin⁡θsin⁡θcos⁡θ)V_\theta = \begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix}

This rotates a qubit ∣ψ⟩|\psi\rangle by angle θ\theta about the origin (in the Bloch sphere representation).

Examples

For ∣ψ⟩=∣0⟩|\psi\rangle = |0\rangle:

Vθ∣0⟩=(cos⁡θsin⁡θ)V_\theta|0\rangle = \begin{pmatrix} \cos\theta \\ \sin\theta \end{pmatrix}

For ∣ψ⟩=∣1⟩|\psi\rangle = |1\rangle:

Vθ∣1⟩=(−sin⁡θcos⁡θ)V_\theta|1\rangle = \begin{pmatrix} -\sin\theta \\ \cos\theta \end{pmatrix}

Rotating Two Qubits Simultaneously

(Vθ⊗Vϕ)(∣0⟩⊗∣0⟩)=Vθ∣0⟩⊗Vϕ∣0⟩=(cos⁡θ∣0⟩+sin⁡θ∣1⟩)⊗(cos⁡ϕ∣0⟩+sin⁡ϕ∣1⟩)=cos⁡θcos⁡ϕ∣00⟩+cos⁡θsin⁡ϕ∣01⟩+sin⁡θcos⁡ϕ∣10⟩+sin⁡θsin⁡ϕ∣11⟩\begin{align*} (V_\theta \otimes V_\phi)(|0\rangle \otimes |0\rangle) &= V_\theta|0\rangle \otimes V_\phi|0\rangle \\ &= (\cos\theta|0\rangle + \sin\theta|1\rangle) \otimes (\cos\phi|0\rangle + \sin\phi|1\rangle) \\ &= \cos\theta\cos\phi|00\rangle + \cos\theta\sin\phi|01\rangle \\ &\quad + \sin\theta\cos\phi|10\rangle + \sin\theta\sin\phi|11\rangle \end{align*}

Probability that first qubit is ∣0⟩|0\rangle:

Pr⁡[qubit 0 is ∣0⟩]=cos⁡2θcos⁡2ϕ+cos⁡2θsin⁡2ϕ=cos⁡2θ(cos⁡2ϕ+sin⁡2ϕ)=cos⁡2θ\begin{align*} \Pr[\text{qubit 0 is } |0\rangle] &= \cos^2\theta\cos^2\phi + \cos^2\theta\sin^2\phi \\ &= \cos^2\theta(\cos^2\phi + \sin^2\phi) \\ &= \cos^2\theta \end{align*}

Application of Rotation: CHSH Game

The CHSH game demonstrates quantum advantage through entanglement.

Game Setup

xx yy Win if
0 0 a=ba = b
0 1 a=ba = b
1 0 a=ba = b
1 1 a≠ba \neq b

Classical strategy: Maximum winning probability is 75%.

Quantum Strategy

Alice and Bob pre-share ∣Φ+⟩=12(∣00⟩+∣11⟩)|\Phi^+\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle) and use rotation measurements:

xx θA(x)\theta_A(x) yy θB(y)\theta_B(y)
0 2π/82\pi/8 0 π/8\pi/8
1 00 1 3π/83\pi/8

Analysis for x = 0, y = 0

Final state after applying rotations:

∣ψ⟩=(V2π/8⊗Vπ/8)∣Φ+⟩|\psi\rangle = (V_{2\pi/8} \otimes V_{\pi/8})|\Phi^+\rangle

Using the identity:

cos⁡(θ−ϕ)(∣00⟩+∣11⟩)+sin⁡(θ−ϕ)(∣10⟩−∣01⟩)\cos(\theta - \phi)(|00\rangle + |11\rangle) + \sin(\theta - \phi)(|10\rangle - |01\rangle)

For θ=2π/8,ϕ=π/8\theta = 2\pi/8, \phi = \pi/8:

Pr⁡[qubit 0 is ∣0⟩]=cos⁡2(π/8)≈0.8534\Pr[\text{qubit 0 is } |0\rangle] = \cos^2(\pi/8) \approx 0.8534

Similarly, for x=1,y=1x=1, y=1:

Pr⁡[qubit 0 is ∣1⟩]=sin⁡2(π/8)=cos⁡2(−π/8)≈0.8534\Pr[\text{qubit 0 is } |1\rangle] = \sin^2(\pi/8) = \cos^2(-\pi/8) \approx 0.8534

Overall winning probability: ≈85.4%\approx 85.4\% (beats classical bound!)

Universal Gate Sets

A gate set G\mathcal{G} is universal if for any unitary UU, one can construct a circuit using gates from G\mathcal{G} to approximate UU.

UU ϵ\epsilon-approximates VV if for all states ∣ψ⟩|\psi\rangle:

∥U∣ψ⟩−V∣ψ⟩∥≤ϵ\|U|\psi\rangle - V|\psi\rangle\| \leq \epsilon

Any circuit CC without measurements corresponds to some unitary, so a circuit approximates some unitary.

Example 1: Continuous Rotations + Phase Shift

Rx(θ)=(cos⁡θ−isin⁡θ−isin⁡θcos⁡θ)Ry(θ)=(cos⁡θ−sin⁡θsin⁡θcos⁡θ)Rz(θ)=(e−iθ00eiθ)P(θ)=(100eiθ)\begin{align*} R_x(\theta) &= \begin{pmatrix} \cos\theta & -i\sin\theta \\ -i\sin\theta & \cos\theta \end{pmatrix} \\[1em] R_y(\theta) &= \begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix} \\[1em] R_z(\theta) &= \begin{pmatrix} e^{-i\theta} & 0 \\ 0 & e^{i\theta} \end{pmatrix} \\[1em] P(\theta) &= \begin{pmatrix} 1 & 0 \\ 0 & e^{i\theta} \end{pmatrix} \end{align*}

These must work for all 0≤θ<2π0 \leq \theta < 2\pi.

Note: Both examples require at least one 2-qubit gate (CNOT).

Example 2: Discrete + Finite Gates

H=12(111−1)CNOT (2-qubit gate)S=(100i)T=(100eiπ/4)\begin{align*} H &= \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} \\[1em] \text{CNOT} &\text{ (2-qubit gate)} \\[1em] S &= \begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix} \\[1em] T &= \begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{pmatrix} \end{align*}

Deutsch’s Algorithm

Problem: Given oracle access to f:{0,1}→{0,1}f: \{0,1\} \to \{0,1\}, decide whether f(0)=f(1)f(0) = f(1).

Classical: Any classical algorithm needs to query ff at least 2 times.

Quantum: Deutsch’s algorithm uses only 1 query!

Quantum Oracle

A quantum circuit accesses ff through a unitary oracle:

Uf∣x,b⟩=∣x,b⊕f(x)⟩U_f|x,b\rangle = |x, b \oplus f(x)\rangle

Circuit

Circuit for Deutsch’s algorithm

Analysis

∣ϕ1⟩=∣0⟩∣1⟩∣ϕ2⟩=∣+⟩∣−⟩=12(∣00⟩−∣01⟩+∣10⟩−∣11⟩)\begin{align*} |\phi_1\rangle &= |0\rangle|1\rangle \\[0.5em] |\phi_2\rangle &= |+\rangle|-\rangle = \frac{1}{2}(|00\rangle - |01\rangle + |10\rangle - |11\rangle) \end{align*}

After UfU_f:

∣ϕ3⟩=12[∣0,f(0)⟩−∣0,f(0)‾⟩+∣1,f(1)⟩−∣1,f(1)‾⟩]\begin{align*} |\phi_3\rangle &= \frac{1}{2}[|0,f(0)\rangle - |0,\overline{f(0)}\rangle + |1,f(1)\rangle - |1,\overline{f(1)}\rangle] \end{align*}

Using ∣b⟩−∣bˉ⟩=(Xb∣−⟩)|b\rangle - |\bar{b}\rangle = (X^b|-\rangle):

∣ϕ3⟩=12(∣0⟩Xf(0)+∣1⟩Xf(1))∣−⟩|\phi_3\rangle = \frac{1}{\sqrt{2}}(|0\rangle X^{f(0)} + |1\rangle X^{f(1)})|-\rangle

After Hadamard on first qubit:

∣ϕ4⟩=12[(∣0⟩+∣1⟩)Xf(0)+(∣0⟩−∣1⟩)Xf(1)]∣−⟩|\phi_4\rangle = \frac{1}{2}[(|0\rangle + |1\rangle)X^{f(0)} + (|0\rangle - |1\rangle)X^{f(1)}]|-\rangle

Result: The first qubit becomes:

First qubit={∣0⟩if f(0)=f(1) (constant function)∣1⟩if f(0)≠f(1) (balanced function)\text{First qubit} = \begin{cases} |0\rangle & \text{if } f(0) = f(1) \text{ (constant function)} \\ |1\rangle & \text{if } f(0) \neq f(1) \text{ (balanced function)} \end{cases}

Conclusion: Measure the first qubit to distinguish the cases with 1 query!

Phase Kickback

Phase kickback is a key phenomenon where the phase from the target qubit “kicks back” to the control register.

General Principle

For operator XX (bit flip), we have:

∣b⊕c⟩=Xc∣b⟩|b \oplus c\rangle = X^c|b\rangle

Therefore:

Uf(∣b⟩∣a⟩)=∣b⟩∣a⊕f(b)⟩=∣b⟩(Xf(b)∣a⟩)U_f(|b\rangle|a\rangle) = |b\rangle|a \oplus f(b)\rangle = |b\rangle(X^{f(b)}|a\rangle)

By linearity, this holds for all quantum states ∣ψ⟩=∑i∣i⟩|\psi\rangle = \sum_i |i\rangle:

Uf(∣b⟩∣ψ⟩)=∣b⟩(Xf(b)∣ψ⟩)U_f(|b\rangle|\psi\rangle) = |b\rangle(X^{f(b)}|\psi\rangle)

Application in Deutsch’s Algorithm

In Deutsch’s problem with target qubit in ∣−⟩|-\rangle state:

Uf(∣+⟩∣−⟩)=12[Uf(∣0⟩∣−⟩)+Uf(∣1⟩∣−⟩)]=12[∣0⟩Xf(0)∣−⟩+∣1⟩Xf(1)∣−⟩]\begin{align*} U_f(|+\rangle|-\rangle) &= \frac{1}{\sqrt{2}}[U_f(|0\rangle|-\rangle) + U_f(|1\rangle|-\rangle)] \\ &= \frac{1}{\sqrt{2}}[|0\rangle X^{f(0)}|-\rangle + |1\rangle X^{f(1)}|-\rangle] \end{align*}

Since X∣−⟩=−∣−⟩X|-\rangle = -|-\rangle and X∣+⟩=∣+⟩X|+\rangle = |+\rangle:

X0∣−⟩=∣−⟩X1∣−⟩=−∣−⟩\begin{align*} X^0|-\rangle &= |-\rangle \\ X^1|-\rangle &= -|-\rangle \end{align*}

Thus the global phase depends on ff, creating the interference needed for the algorithm.

Hadamard Transform on Multiple Qubits

Single Qubit Formula

H∣a⟩=12∑b∈{0,1}(−1)ab∣b⟩H|a\rangle = \frac{1}{\sqrt{2}}\sum_{b \in \{0,1\}} (-1)^{ab}|b\rangle

Multi-Qubit Hadamard

Applying HH to each qubit in an nn-qubit state:

H⊗n∣x0…xn−1⟩=H∣x0⟩⊗H∣x1⟩⊗⋯⊗H∣xn−1⟩=(12∑b0(−1)x0b0∣b0⟩)⊗(12∑b1(−1)x1b1∣b1⟩)⊗⋯=12n∑y∈{0,1}n(−1)x⋅y∣y⟩\begin{align*} H^{\otimes n}|x_0\ldots x_{n-1}\rangle &= H|x_0\rangle \otimes H|x_1\rangle \otimes \cdots \otimes H|x_{n-1}\rangle \\ &= \left(\frac{1}{\sqrt{2}}\sum_{b_0}(-1)^{x_0 b_0}|b_0\rangle\right) \otimes \left(\frac{1}{\sqrt{2}}\sum_{b_1}(-1)^{x_1 b_1}|b_1\rangle\right) \otimes \cdots \\ &= \frac{1}{\sqrt{2^n}}\sum_{y \in \{0,1\}^n} (-1)^{x \cdot y}|y\rangle \end{align*}

where x⋅y=x0y0⊕x1y1⊕⋯⊕xn−1yn−1x \cdot y = x_0y_0 \oplus x_1y_1 \oplus \cdots \oplus x_{n-1}y_{n-1} (bitwise inner product).

Key Result

H⊗n∣x⟩=12n∑y∈{0,1}n(−1)x⋅y∣y⟩H^{\otimes n}|x\rangle = \frac{1}{\sqrt{2^n}}\sum_{y \in \{0,1\}^n} (-1)^{x \cdot y}|y\rangle

This creates an equal superposition over all 2n2^n basis states, with phases determined by x⋅yx \cdot y.

Simons’ Algorithm

Problem: Given oracle access to f:{0,1}n→{0,1}nf: \{0,1\}^n \to \{0,1\}^n, there exists s∈{0,1}ns \in \{0,1\}^n such that:

f(x)=f(y)  ⟺  x⊕y=sf(x) = f(y) \iff x \oplus y = s

Find the hidden string ss.

Classical complexity: O(2n/2)O(2^{n/2}) queries by birthday paradox.

Quantum complexity: O(n)O(n) queries using Simons’ algorithm!

Simons’ Quantum Subroutine

Circuit queries UfU_f once and uniformly samples y∈{0,1}ny \in \{0,1\}^n such that s⋅y=0s \cdot y = 0.

Circuit for Simon’s subroutine

Analysis

∣ϕ1⟩=∣0n⟩⊗∣0n⟩∣ϕ2⟩=(12n∑x∈{0,1}n∣x⟩)⊗∣0n⟩\begin{align*} |\phi_1\rangle &= |0^n\rangle \otimes |0^n\rangle \\[0.5em] |\phi_2\rangle &= \left(\frac{1}{\sqrt{2^n}}\sum_{x \in \{0,1\}^n}|x\rangle\right) \otimes |0^n\rangle \end{align*}

After UfU_f:

∣ϕ3⟩=12n∑x∈{0,1}n∣x⟩⊗∣f(x)⟩\begin{align*} |\phi_3\rangle &= \frac{1}{\sqrt{2^n}}\sum_{x \in \{0,1\}^n}|x\rangle \otimes |f(x)\rangle \end{align*}

Suppose we measure the second register and get outcome aa. The first register collapses to an equal superposition of all xx such that f(x)=af(x) = a.

By the promise, there are exactly two such values: xax_a and xa⊕sx_a \oplus s. Thus:

12(∣xa⟩+∣xa⊕s⟩)⊗∣a⟩\frac{1}{\sqrt{2}}(|x_a\rangle + |x_a \oplus s\rangle) \otimes |a\rangle

After applying H⊗nH^{\otimes n} to the first register:

∣ϕ4⟩=12n+1∑y∈{0,1}n[(−1)xa⋅y+(−1)(xa⊕s)⋅y]∣y⟩∣a⟩\begin{align*} |\phi_4\rangle &= \frac{1}{\sqrt{2^{n+1}}}\sum_{y \in \{0,1\}^n}\left[(-1)^{x_a \cdot y} + (-1)^{(x_a \oplus s) \cdot y}\right]|y\rangle|a\rangle \end{align*}

Using (xa⊕s)⋅y=xa⋅y⊕s⋅y(x_a \oplus s) \cdot y = x_a \cdot y \oplus s \cdot y:

∣ϕ4⟩=12n+1∑y∈{0,1}n(−1)xa⋅y[1+(−1)s⋅y]∣y⟩∣a⟩\begin{align*} |\phi_4\rangle &= \frac{1}{\sqrt{2^{n+1}}}\sum_{y \in \{0,1\}^n}(-1)^{x_a \cdot y}\left[1 + (-1)^{s \cdot y}\right]|y\rangle|a\rangle \end{align*}

Key observation: The coefficient 1+(−1)s⋅y1 + (-1)^{s \cdot y} determines amplitude:

1+(−1)s⋅y={2if s⋅y=0 (constructive interference)0if s⋅y=1 (destructive interference)1 + (-1)^{s \cdot y} = \begin{cases} 2 & \text{if } s \cdot y = 0 \text{ (constructive interference)} \\ 0 & \text{if } s \cdot y = 1 \text{ (destructive interference)} \end{cases}

Therefore, measuring yy gives a uniformly random yy such that s⋅y=0s \cdot y = 0.

Classical Post-Processing

After obtaining m=O(n)m = O(n) samples y(1),y(2),…,y(m)y^{(1)}, y^{(2)}, \ldots, y^{(m)}, solve the system:

y(1)⋅s=0y(2)⋅s=0⋮y(m)⋅s=0\begin{align*} y^{(1)} \cdot s &= 0 \\ y^{(2)} \cdot s &= 0 \\ &\vdots \\ y^{(m)} \cdot s &= 0 \end{align*}

This is a system of linear equations over F2\mathbb{F}_2 (binary field), solvable using Gaussian elimination in O(n3)O(n^3) time.

Result: Simons’ algorithm finds ss in polynomial time, demonstrating exponential quantum speedup!

Further Topics

TBD: