egtry / Quantum States & Qubits Step by Step

Prepare-Gate-Measure

Quantum computing starts with a prepared state, applies controlled physical operations, and measures at the end.

Calculate the baseline

Prepare zero, apply H, then read the output probabilities. The calculation gives a distribution, not a sampled outcome.

Apply an ideal H gate to the normalized real amplitudes (1, 0). What is the output probability of zero?

  1. H: (1, 0) → (0.7071067812, 0.7071067812) — Apply the ideal gate to amplitudes before squaring.
  2. a′ = (a+b)/√2; b′ = (a−b)/√2 — Keep the signs: interference happens at the amplitude level.
  3. P0 = (0.7071067812)² = 0.5 1; P1 = 0.5 — Read the two computational-basis probabilities.
  4. ✓ — Independent check: Unitary gate conserves norm; independently reconstruct the complementary probability.

Enable JavaScript to control the model and practise.

Compare a second case

Change only the prepared basis state. H still makes balanced direct probabilities, but the output relative sign differs.

Apply an ideal H gate to the normalized real amplitudes (0, 1). What is the output probability of zero?

  1. H: (0, 1) → (0.7071067812, -0.7071067812) — Apply the ideal gate to amplitudes before squaring.
  2. a′ = (a+b)/√2; b′ = (a−b)/√2 — Keep the signs: interference happens at the amplitude level.
  3. P0 = (0.7071067812)² = 0.5 1; P1 = 0.5 — Read the two computational-basis probabilities.
  4. ✓ — Independent check: Unitary gate conserves norm; independently reconstruct the complementary probability.

Enable JavaScript to control the model and practise.

Test the boundary and practise

Prepare a non-basis state. The same gate now gives a different distribution, showing why preparation is part of the computation.

Apply an ideal H gate to the normalized real amplitudes (0.6, 0.8). What is the output probability of zero?

  1. H: (0.6, 0.8) → (0.9899494937, -0.1414213562) — Apply the ideal gate to amplitudes before squaring.
  2. a′ = (a+b)/√2; b′ = (a−b)/√2 — Keep the signs: interference happens at the amplitude level.
  3. P0 = (0.9899494937)² = 0.98 1; P1 = 0.02 — Read the two computational-basis probabilities.
  4. ✓ — Independent check: Unitary gate conserves norm; independently reconstruct the complementary probability.

Enable JavaScript to control the model and practise.

Recap