X Gate Swap
The X gate swaps the two amplitudes of a single qubit.
Calculate the baseline
Apply X to the normalized pair 3/5 and 4/5. It swaps the signed amplitudes and therefore swaps their probabilities.
Apply an ideal X gate to the normalized real amplitudes (0.6, 0.8). What is the output probability of zero?
- X: (0.6, 0.8) → (0.8, 0.6) — Apply the ideal gate to amplitudes before squaring.
- a′ = b; b′ = a — Keep the signs: interference happens at the amplitude level.
- P0 = (0.8)² = 0.64 1; P1 = 0.36 — Read the two computational-basis probabilities.
- ✓ — Independent check: Unitary gate conserves norm; independently reconstruct the complementary probability.
Enable JavaScript to control the model and practise.
Compare a second case
Reverse the input pair. The same X map returns the original ordering; this checks reversibility.
Apply an ideal X gate to the normalized real amplitudes (0.8, 0.6). What is the output probability of zero?
- X: (0.8, 0.6) → (0.6, 0.8) — Apply the ideal gate to amplitudes before squaring.
- a′ = b; b′ = a — Keep the signs: interference happens at the amplitude level.
- P0 = (0.6)² = 0.36 1; P1 = 0.64 — Read the two computational-basis probabilities.
- ✓ — Independent check: Unitary gate conserves norm; independently reconstruct the complementary probability.
Enable JavaScript to control the model and practise.
Test the boundary and practise
Use a different normalized input. The gate rule is unchanged and the output norm remains one.
Apply an ideal X gate to the normalized real amplitudes (0.3846153846, 0.9230769231). What is the output probability of zero?
- X: (0.3846153846, 0.9230769231) → (0.9230769231, 0.3846153846) — Apply the ideal gate to amplitudes before squaring.
- a′ = b; b′ = a — Keep the signs: interference happens at the amplitude level.
- P0 = (0.9230769231)² = 0.8520710059 1; P1 = 0.1479289941 — Read the two computational-basis probabilities.
- ✓ — Independent check: Unitary gate conserves norm; independently reconstruct the complementary probability.
Enable JavaScript to control the model and practise.
Explore the real numerical extension.
Recap
- X swaps amplitudes.
- Square after applying the gate.
- X applied twice is the identity.