QuantumSimulator
Interactive Course
Interactive chapters from intuition to mastery
Structured Lessons
Eight modules with formulas and self-checks
Quantum Brain
Navigate lessons, laws, gates, devices, and tools
Guided Experiments
Hands-on circuits that teach one idea each
Circuit Lab
Build circuits, run them, and see the results
Gate Reference
Quick reference for all quantum gates
Cryostat Studio
3D cryostat design and simulation
Component Catalog
Browse all cryostat components
System Checks
Check your design for errors
Menu
physics
Interactive Course
Interactive chapters from intuition to mastery
Structured Lessons
Eight modules with formulas and self-checks
Quantum Brain
Navigate lessons, laws, gates, devices, and tools
Guided Experiments
Hands-on circuits that teach one idea each
simulator
Circuit Lab
Build circuits, run them, and see the results
Gate Reference
Quick reference for all quantum gates
wiringStudio
Cryostat Studio
3D cryostat design and simulation
Component Catalog
Browse all cryostat components
System Checks
Check your design for errors
Home/Quantum Physics/Lessons/Controlled-Phase Gate
CP

Controlled-Phase Gate

Entanglement2-qubitctrl-phase

Applies a chosen phase rotation to the ∣11⟩ component only.

Intuition

CP generalizes CZ by letting you choose any phase angle θ. CZ always applies a −1 phase (180°) to ∣11⟩. CP lets you apply any phase from 0° to 360°. At θ=π, CP becomes CZ. At smaller angles, it applies more subtle phase rotations. This fine-grained control is exactly what the Quantum Fourier Transform (QFT) needs. The QFT is a quantum circuit that converts computational-basis amplitudes into frequency-basis amplitudes, and it is the key subroutine inside Shor’s factoring algorithm. In the QFT, each pair of qubits gets a CP gate with a different angle, building up the precise phase relationships that encode frequency information.

Matrix representation
diag(1,1,1,eiθ)
Action on states
∣11⟩→eiθ∣11⟩,other basis states unchanged
Circuit
q0q1HCP
Full technical statement

CP(θ) is a diagonal matrix with entries (1, 1, 1, exp(iθ). A diagonal matrix acts on each basis state independently, so CP multiplies ∣00⟩,∣01⟩, and ∣10⟩ by 1 and ∣11⟩ by exp(iθ). Like CZ, CP is symmetric between the two qubits (swapping them gives the same gate). The gate is unitary, and its inverse is CP(−θ. The Quantum Fourier Transform (QFT) on n qubits uses CP gates with angles π/2^k for k = 1, ..., n−1. Each successively smaller angle encodes a finer frequency resolution.

What changes in measurements

The joint phase structure of the two-qubit state changes by angle θ.

What stays hidden until later

At θ=π, this becomes the CZ gate.

Bloch sphere

Applies a conditional phase rotation by angle θ. Symmetric between the two qubits. At θ=π, it reduces to CZ.

Step-by-step example

CP in the Quantum Fourier Transform (QFT)

  1. 1The QFT converts computational-basis states into frequency-basis states. In a 3-qubit QFT, after applying H to qubit 0, you apply CP(π/2) between qubits 0 and 1.
  2. 2Next, apply CP(π/4) between qubits 0 and 2. The angle halves for each additional qubit of separation.
  3. 3These controlled phases encode frequency information. Each CP contributes one term in the Fourier sum.
  4. 4The angle pattern is π/2^k, where k is the distance between the qubits in the QFT circuit.
  5. 5The decreasing angles build up the precise phase pattern that distinguishes one frequency from another.
Where this gate appears
  • Quantum Fourier Transform, where CP gates at specific angles are the core building blocks
  • Quantum phase estimation algorithm
  • Quantum arithmetic circuits for modular exponentiation
  • Simulating physical systems with tunable interaction strengths
Connected gates
  • CP(π) = CZ — CZ is the special case of CP with the maximum phase of π
  • CP is symmetric between the two qubits, just like CZ
  • CP(θ)^† = CP(−θ) — the inverse gate applies the negative angle
  • CP appears at every stage of the QFT with angles π/2^k for increasing k
Tempting but wrong

It is tempting to think CP is just a minor variation of CZ with little practical significance. That sounds plausible because CZ is already a useful gate. What actually happens is that the ability to choose arbitrary angles is what makes the QFT work. The precision of these angles directly determines the frequency resolution of quantum phase estimation, which is the subroutine behind Shor’s factoring algorithm.

Why this gate matters for what comes next

CP is the engine of the Quantum Fourier Transform. The QFT underlies Shor’s factoring algorithm and quantum phase estimation. Understanding CP means understanding how quantum computers extract period and frequency information exponentially faster than classical computers.

Test your understanding

In the Quantum Fourier Transform, why do the CP angles decrease as π/2^k?

Quick reference →↗ Nielsen and Chuang, Quantum Computation and Quantum Information
←
Previous
Controlled-Z
Next
Measure
→
← Back to all lessons