Quantum Lab
Home/Simulator/Gate Reference
Reference

Quantum Gate Library

13 gates and measurement. Each card shows the matrix representation, Bloch sphere geometry, truth table (where applicable), and a link to try it in the simulator.

Showing
14/ 14
Single-qubit
9
Multi-qubit
5
X
X Gate
Single-qubit \u00B7 Basic
bit flip

Flips |0⟩ ↔ |1⟩ for the target qubit.

(01​10​)
Observable effect

The measured bit result flips.

Bloch sphere

Rotates 180° around the X axis. Swaps north and south poles.

Learn more
Z
Z Gate
Single-qubit \u00B7 Phase
phase

Adds a phase flip to |1⟩ without flipping the bit.

(10​0−1​)
Observable effect

Histogram may look unchanged right now.

Hidden effect

Phase shift — a later Hadamard reveals it.

Bloch sphere

Rotates 180° around the Z axis. Flips equatorial phase without moving the poles.

Try it in the simulatorLearn more
H
Hadamard
Single-qubit \u00B7 Basic
superposition

Creates equal superposition from a basis state.

2​1​(11​1−1​)
Observable effect

Measurement odds spread more evenly.

Hidden effect

Relative phase may affect later interference.

Bloch sphere

Rotates 180° around the axis halfway between X and Z. Maps north pole to equator.

Try it in the simulatorLearn more
CX
CNOT
2-qubit \u00B7 Entanglement
entangle

Flips the target when the control is |1⟩.

​1000​0100​0001​0010​​
Observable effect

Joint two-qubit probability structure changes.

Hidden effect

Creates entanglement when control is in superposition.

Bloch sphere

Conditional rotation of target qubit. Creates entanglement from superposed control.

Truth table
|00⟩\u2192|00⟩
|01⟩\u2192|01⟩
|10⟩\u2192|11⟩
|11⟩\u2192|10⟩
Try it in the simulatorLearn more
CCX
Toffoli
3-qubit \u00B7 Multi-qubit
AND

Flips target only when both controls are |1⟩.

I8​ with ∣110⟩↔∣111⟩
Observable effect

Classical AND logic applied to amplitudes.

Hidden effect

Still acts on superpositions — not purely classical.

Bloch sphere

Conditional X on target when both controls are |1⟩.

Truth table
|000⟩\u2192|000⟩
|110⟩\u2192|111⟩
|111⟩\u2192|110⟩
Try it in the simulatorLearn more
SW
Swap
2-qubit \u00B7 Multi-qubit
swap

Exchanges the quantum states of two qubits.

​1000​0010​0100​0001​​
Observable effect

Qubit roles swap in the output.

Bloch sphere

Exchanges the Bloch vectors of two qubits.

Truth table
|00⟩\u2192|00⟩
|01⟩\u2192|10⟩
|10⟩\u2192|01⟩
|11⟩\u2192|11⟩
Learn more
P
Phase
Single-qubit \u00B7 Phase
+π/2

Adds a quarter-turn of phase to the |1⟩ branch.

(10​0i​)
Observable effect

Measurement odds stay the same.

Hidden effect

Quarter-turn phase — visible only after another mixing gate.

Bloch sphere

Rotates 90° around the Z axis. Quarter-turn of equatorial phase.

Learn more
Rx
RX Gate
Single-qubit \u00B7 Rotation
X-rot

Rotates around the X axis by angle θ.

(cos2θ​−isin2θ​​−isin2θ​cos2θ​​)
Observable effect

Gradually mixes |0⟩ and |1⟩ amplitudes.

Hidden effect

At θ=π this becomes the X gate.

Bloch sphere

Rotates by θ around the X axis. At θ=π, becomes X gate.

Learn more
Ry
RY Gate
Single-qubit \u00B7 Rotation
Y-rot

Rotates around the Y axis by angle θ.

(cos2θ​sin2θ​​−sin2θ​cos2θ​​)
Observable effect

Creates real-valued superpositions.

Hidden effect

At θ=π this becomes the Y gate (up to phase).

Bloch sphere

Rotates by θ around the Y axis. Stays in the XZ plane.

Learn more
Rz
RZ Gate
Single-qubit \u00B7 Rotation
Z-rot

Rotates around the Z axis by angle θ.

(e−iθ/20​0eiθ/2​)
Observable effect

Adjusts relative phase between |0⟩ and |1⟩.

Hidden effect

Phase-only change — visible after mixing gates.

Bloch sphere

Rotates by θ around the Z axis. At θ=π, becomes Z gate.

Learn more
U3
U3 Gate
Single-qubit \u00B7 Rotation
universal

Most general single-qubit gate — any rotation via θ, φ, λ.

(cos2θ​eiϕsin2θ​​−eiλsin2θ​ei(ϕ+λ)cos2θ​​)
Observable effect

Can change both probabilities and phase simultaneously.

Hidden effect

Subsumes all single-qubit gates as special cases.

Bloch sphere

Arbitrary rotation. Three parameters cover any point on the sphere.

Learn more
CZ
Controlled-Z
2-qubit \u00B7 Entanglement
ctrl-Z

Applies Z to target when control is |1⟩.

diag(1,1,1,−1)
Observable effect

Joint two-qubit phase structure changes.

Hidden effect

Creates entanglement when control is in superposition.

Bloch sphere

Conditional phase flip. Symmetric between qubits — no control/target distinction.

Learn more
CP
Controlled-Phase
2-qubit \u00B7 Entanglement
ctrl-phase

Applies a configurable phase rotation to the |11⟩ state.

diag(1,1,1,eiθ)
Observable effect

Joint phase structure changes by angle θ.

Hidden effect

At θ=π this becomes the CZ gate.

Bloch sphere

Conditional phase rotation by θ. At θ=π, becomes CZ.

Learn more
M
Measure
Single-qubit \u00B7 Measurement
collapse

Collapses quantum state to a classical result.

∣ψ⟩→∣k⟩ with pk​=∣⟨k∣ψ⟩∣2
Observable effect

One outcome is sampled from the distribution.

Hidden effect

The full superposition information is discarded.

Bloch sphere

Projects the Bloch vector to the nearest pole. The sphere collapses to |0⟩ or |1⟩.

Learn more

Notation

Matrices are in the computational basis {|0\u27E9, |1\u27E9} for single-qubit gates and {|00\u27E9, |01\u27E9, |10\u27E9, |11\u27E9} for two-qubit gates. Rotation angles are in radians. Parameterized gates (RX, RY, RZ, U3, CP) accept user-defined parameters through the inline editor. Reference: Nielsen & Chuang, Quantum Computation and Quantum Information (Cambridge University Press, 2010).