← Quantum Information & Computing
πŸ”²

Quantum Gates & Circuits

Quantum gates are the quantum analogues of classical logic gates. They are represented by unitary matrices β€” invertible operations that preserve the normalization of quantum states. Every quantum computation is a sequence of such gates, and a small universal set suffices to approximate any quantum operation to arbitrary precision.

Key Concepts

Unitary Matrix
A matrix UU satisfying U†U=UU†=IU^\dagger U = UU^\dagger = I, where U†U^\dagger is the conjugate transpose. Unitarity ensures that gate operations are reversible and preserve the norm of quantum states β€” a physical necessity.
Pauli Gates
Three fundamental single-qubit gates: X=(0110)X = \begin{pmatrix}0&1\\1&0\end{pmatrix} (bit flip, quantum NOT), Y=(0βˆ’ii0)Y = \begin{pmatrix}0&-i\\i&0\end{pmatrix}, and Z=(100βˆ’1)Z = \begin{pmatrix}1&0\\0&-1\end{pmatrix} (phase flip). Together with the identity they form a basis for all 2Γ—22\times2 Hermitian matrices.
Hadamard Gate
The gate H=12(111βˆ’1)H = \frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\1&-1\end{pmatrix} maps ∣0βŸ©β†’βˆ£+⟩=∣0⟩+∣1⟩2|0\rangle \to |{+}\rangle = \frac{|0\rangle+|1\rangle}{\sqrt{2}} and ∣1βŸ©β†’βˆ£βˆ’βŸ©=∣0βŸ©βˆ’βˆ£1⟩2|1\rangle \to |{-}\rangle = \frac{|0\rangle-|1\rangle}{\sqrt{2}}. It is its own inverse (H2=IH^2 = I) and creates equal superpositions β€” the first step of almost every quantum algorithm.
CNOT Gate
A two-qubit gate that flips the target qubit if and only if the control qubit is ∣1⟩|1\rangle: ∣c⟩∣tβŸ©β†’βˆ£c⟩∣tβŠ•c⟩|c\rangle|t\rangle \to |c\rangle|t \oplus c\rangle. CNOT is the prototypical entangling gate and, combined with single-qubit gates, forms a universal gate set.
Universality
A gate set is universal if any unitary operation on nn qubits can be approximated to arbitrary accuracy using gates from the set. The set {H,T,CNOT}\{H, T, \text{CNOT}\} is universal, where T=diag(1,eiΟ€/4)T = \text{diag}(1, e^{i\pi/4}). The Solovay-Kitaev theorem guarantees efficient approximation.
Quantum Circuit Model
Quantum computation is represented as a sequence of quantum gates applied to qubits in a circuit diagram. Time flows left to right. Unlike classical circuits, all gates are reversible. Measurements (irreversible) appear at the end or mid-circuit.

Key Equations

Pauli-X (NOT) Gate
X=(0110),X∣0⟩=∣1⟩,X∣1⟩=∣0⟩X = \begin{pmatrix}0 & 1 \\ 1 & 0\end{pmatrix}, \quad X|0\rangle = |1\rangle, \quad X|1\rangle = |0\rangle
Bit flip gate: swaps |0⟩ and |1⟩ amplitudes.
Hadamard Gate
H=12(111βˆ’1),H∣0⟩=∣+⟩,H∣1⟩=βˆ£βˆ’βŸ©H = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1 \\ 1 & -1\end{pmatrix}, \quad H|0\rangle = |{+}\rangle, \quad H|1\rangle = |{-}\rangle
Creates equal superposition; HΒ² = I.
CNOT Gate
CNOT=(1000010000010010)\text{CNOT} = \begin{pmatrix}1&0&0&0\\0&1&0&0\\0&0&0&1\\0&0&1&0\end{pmatrix}
Two-qubit gate: flips target qubit when control is |1⟩.
Phase Gate T
T=(100eiΟ€/4)T = \begin{pmatrix}1 & 0 \\ 0 & e^{i\pi/4}\end{pmatrix}
Ο€/8 gate; adds a relative phase of e^{iΟ€/4} to |1⟩. Together with H and CNOT forms a universal set.
Unitarity Condition
U†U=Iβ€…β€ŠβŸΉβ€…β€ŠallΒ quantumΒ gatesΒ areΒ reversibleU^\dagger U = I \implies \text{all quantum gates are reversible}
Every quantum gate has an inverse gate, unlike classical irreversible gates like AND or OR.
Worked Example

Applying the Hadamard Gate

Problem

Show that applying HH twice to ∣0⟩|0\rangle returns ∣0⟩|0\rangle, demonstrating H2=IH^2 = I.

Solution

Apply H to |0⟩:

H∣0⟩=12(111βˆ’1)(10)=12(11)=∣+⟩H|0\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\1&-1\end{pmatrix}\begin{pmatrix}1\\0\end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\end{pmatrix} = |{+}\rangle

Apply H again to |+⟩:

H∣+⟩=12(111βˆ’1)12(11)=12(20)=(10)=∣0⟩H|{+}\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\1&-1\end{pmatrix}\frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\end{pmatrix} = \frac{1}{2}\begin{pmatrix}2\\0\end{pmatrix} = \begin{pmatrix}1\\0\end{pmatrix} = |0\rangle
Answer H²|0⟩ = |0⟩, confirming H² = I
Practice

Exercises

5 problems
1 of 5

Apply the XX gate to ∣0⟩|0\rangle. What is P(∣1⟩)P(|1\rangle) after measurement?

2 of 5

Apply HH to ∣0⟩|0\rangle to get ∣+⟩|{+}\rangle. What is P(∣0⟩)P(|0\rangle) upon measurement?

3 of 5

Apply HH then HH again to ∣0⟩|0\rangle (since H2=IH^2=I). What is P(∣0⟩)P(|0\rangle)?

Unlock Exercise 3

Subscribe to PhysWeb Pro to access all exercises and track your progress.

Upgrade to Pro β†’
4 of 5

Apply ZZ to ∣1βŸ©β†’βˆ’βˆ£1⟩|1\rangle \to -|1\rangle. What is P(∣1⟩)P(|1\rangle)? (Global phase has no effect.)

Unlock Exercise 4

Subscribe to PhysWeb Pro to access all exercises and track your progress.

Upgrade to Pro β†’
5 of 5

A general 2-qubit unitary can be decomposed into at most how many CNOT gates (Shende et al. 2004 tight bound)?

Unlock Exercise 5

Subscribe to PhysWeb Pro to access all exercises and track your progress.

Upgrade to Pro β†’

Key Takeaways

  • Quantum gates are unitary matrices; U†U=IU^\dagger U = I ensures reversibility and norm preservation.
  • Pauli gates X, Y, Z are the single-qubit building blocks; X is the quantum NOT gate.
  • The Hadamard HH creates equal superpositions and is its own inverse: H2=IH^2 = I.
  • CNOT entangles two qubits β€” it is the essential two-qubit gate for quantum algorithms.
  • The set {H,T,CNOT}\{H, T, \text{CNOT}\} is universal: any quantum algorithm can be compiled into these three gates.