Web Simulation 

 

 

 

Quantum Gate Simulator 

Bloch Sphere Representation

A single qubit state is parameterized by two angles θ ∈ [0, π] and φ ∈ [0, 2π]:

|ψ⟩ = cos(θ/2)|0⟩ + e sin(θ/2)|1⟩

The Bloch sphere visualizes this: the north pole (+Z) is |0⟩, the south pole (−Z) is |1⟩, and any point on the surface represents a pure qubit state.

1-Qubit Gates

  • X, Y, Z (Pauli): 180° rotations. X maps |0⟩ ↔ |1⟩.
  • H (Hadamard): Creates superposition: |0⟩ → (|0⟩+|1⟩)/√2.
  • S, T: Phase gates (90°, 45° about Z).
  • Rx(γ), Ry(γ), Rz(γ): Parametric rotation gates; γ sets the rotation angle.

2-Qubit Gates

  • CNOT: Q₀ control, Q₁ target. If control is |1⟩, applies X to target.
  • SWAP: Exchanges the states of Q₀ and Q₁.
  • CZ: Phase flip on Q₁ when Q₀ is |1⟩.

When the output is entangled, the Bloch spheres turn purple and show reduced density matrices (mixed-state approximation).

Simulation

The interactive simulator is below. Use the controls to explore the concepts described above.

Input Q0

0
0

Input Q1

0
0

Gates

Output Q0

Output Q1

Measurement Probabilities

|00⟩
0%
|01⟩
0%
|10⟩
0%
|11⟩
0%

Usage

  1. Input State: Use θ and φ sliders to set each qubit. For 1-qubit mode, only Q₁ is shown; for 2-qubit gates (CNOT, SWAP, CZ), both Q₀ and Q₁ appear.
  2. Gates: 1-qubit gates apply to Q₁; 2-qubit gates act on both. For parametric gates (Rx, Ry, Rz), use the γ slider to set the rotation angle.
  3. Measurement Probabilities: The histogram shows P(|00⟩), P(|01⟩), P(|10⟩), P(|11⟩) from the current 4D state. Purple bars indicate entanglement.
  4. Measure System: Collapses the state to a single outcome (Born rule); output spheres jump to the measured basis state.
  5. Reset Simulation: Clears the measurement and restores the full probability distribution.
  6. Reset: Sets all inputs to |0⟩ and gate to H.

Limitations

  • One or two qubits only. The state space is 1- or 2-qubit (up to a 4-D vector). Real quantum advantage needs many qubits, where the 2N state space cannot be drawn or simulated classically at scale.
  • Pure-state, noiseless. Gates are perfect unitaries with no decoherence, gate error, or readout error. Entangled outputs are shown via reduced density matrices as a mixed-state approximation on the Bloch spheres — a single sphere cannot fully represent an entangled qubit.
  • Single gate at a time. The tool applies one gate to the input state; it is not a multi-gate circuit builder with sequential composition, ancillas, or mid-circuit measurement.
  • Fixed gate set. Common Pauli/H/S/T/rotation and CNOT/SWAP/CZ gates only; arbitrary unitaries, Toffoli/multi-controlled gates, and parameterized 2-qubit gates are not included.
  • Idealized measurement. "Measure" applies the Born rule and collapses instantly with no measurement back-action noise or repeated-shot statistics (it shows exact probabilities, not sampled counts).
  • Visualization, not computation. This builds intuition for single-gate action on the Bloch sphere; it does not run quantum algorithms (see [[groveralgorithm]] for an algorithm-level demo).