Quantum gate library

Quantum Gates Library

Every gate with its unitary matrix, its effect on basis states, a live simulation and a related circuit.

Loading the simulator…

All gates

Beginner I Identity Gate (I) Identity Gate (I) The identity gate leaves the qubit state unchanged; it marks an idle time step or stands for 'do nothing' in tensor products. Beginner X Pauli-X Gate (NOT) Pauli-X Gate (NOT) The Pauli-X gate is the quantum NOT: it swaps |0⟩ and |1⟩ and is a π rotation about the x axis of the Bloch sphere. Beginner Y Pauli-Y Gate Pauli-Y Gate The Pauli-Y gate flips the bit and adds a phase: Y|0⟩ = i|1⟩, Y|1⟩ = −i|0⟩; it is a π rotation about the y axis. Beginner Z Pauli-Z Gate (Phase Flip) Pauli-Z Gate (Phase Flip) The Pauli-Z gate flips the sign of the |1⟩ amplitude (phase flip); it is a π rotation about the z axis. Beginner H Hadamard Gate Hadamard Gate The Hadamard gate maps |0⟩→|+⟩ and |1⟩→|−⟩, creating equal superpositions and exchanging the z and x bases. Intermediate S S Gate (Phase π/2) S Gate (Phase π/2) The S gate multiplies the |1⟩ amplitude by i (S = P(π/2)), a quarter turn about z; S² = Z. Intermediate S† S-dagger Gate S-dagger Gate S† is the inverse of S: it multiplies the |1⟩ amplitude by −i, a −π/2 rotation about z. Intermediate T T Gate (π/8 Gate) T Gate (π/8 Gate) The T gate multiplies the |1⟩ amplitude by e^iπ/4; an eighth turn about z that makes the Clifford set approximately universal. Intermediate T† T-dagger Gate T-dagger Gate T† is the inverse of T: it multiplies the |1⟩ amplitude by e^−iπ/4, a −π/4 rotation about z. Intermediate √X Square-root of X Gate (SX) Square-root of X Gate (SX) SX is the square root of X (SX² = X), a π/2 rotation about x up to global phase, and a native gate on IBM processors. Intermediate RX RX Rotation Gate RX Rotation Gate RX(θ) = e^−iθX/2 rotates the Bloch vector by θ about the x axis; a basic parameterized gate in variational circuits. Intermediate RY RY Rotation Gate RY Rotation Gate RY(θ) = e^−iθY/2 rotates about the y axis and keeps amplitudes real; widely used for state preparation and encoding. Intermediate RZ RZ Rotation Gate RZ Rotation Gate RZ(λ) = e^−iλZ/2 rotates about the z axis, changing only the relative phase; equal to P(λ) up to a global phase. Intermediate P Phase Gate P(λ) Phase Gate P(λ) The phase gate P(λ) = diag(1, e^iλ) multiplies the |1⟩ amplitude by e^iλ; Z, S and T are special cases. Advanced U General Single-qubit Gate U(θ,φ,λ) General Single-qubit Gate U(θ,φ,λ) U(θ,φ,λ) parameterizes any single-qubit gate up to a global phase with three angles, using Qiskit's convention. Intermediate CX CNOT Gate (Controlled-X) CNOT Gate (Controlled-X) CNOT flips the target qubit when the control is |1⟩; with a Hadamard it creates Bell states and, with single-qubit gates, is universal. Intermediate CY Controlled-Y Gate Controlled-Y Gate CY applies Y to the target when the control is |1⟩; it equals a CNOT conjugated by S†/S on the target. Intermediate CZ Controlled-Z Gate Controlled-Z Gate CZ multiplies the |11⟩ amplitude by −1; it is symmetric in its two qubits and equals a CNOT conjugated by Hadamards on the target. Advanced CP Controlled-Phase Gate CP(λ) Controlled-Phase Gate CP(λ) CP(λ) multiplies only the |11⟩ amplitude by e^iλ; it is symmetric and is the building block of the quantum Fourier transform. Intermediate SWAP SWAP Gate SWAP Gate SWAP exchanges the states of two qubits, |a⟩|b⟩ → |b⟩|a⟩, and equals three CNOTs. Advanced CCX Toffoli Gate (CCX) Toffoli Gate (CCX) The Toffoli gate flips the target when both controls are |1⟩; it is universal for reversible classical computation. Advanced CSWAP Fredkin Gate (Controlled-SWAP) Fredkin Gate (Controlled-SWAP) The Fredkin gate swaps two target qubits when the control is |1⟩; it conserves the number of ones and is the core of the swap test. Advanced RZZ RZZ (Ising ZZ) Gate RZZ (Ising ZZ) Gate RZZ(θ) = e^−iθ Z⊗Z/2 adds a phase depending on the parity of two qubits; the building block of QAOA cost layers and Ising models.

Experiments in this module

Module quiz

The quiz needs JavaScript.

All results in this lab come from an exact classical statevector simulation running in your browser, not from execution on a real quantum computer. The required memory doubles with every qubit ($2^n$ amplitudes), so the number of qubits is limited by default to 16.