beginner · Programming · The Qubit State Vector & Dirac Notation
Changing Basis
The computational basis {∣0⟩,∣1⟩} is not the only valid basis for a qubit. Any pair
of orthonormal states spans the same space, so a state that looks simple in one basis can look like
an equal superposition in another. Choosing the right basis often makes a calculation — or an
algorithm — far more transparent.
The X basis (Hadamard basis)
A second natural basis is built from the two equal-superposition states introduced in the previous
lesson:
∣+⟩=21(∣0⟩+∣1⟩),∣−⟩=21(∣0⟩−∣1⟩).
These are orthonormal — you can check directly that ⟨+∣−⟩=0 and
⟨+∣+⟩=⟨−∣−⟩=1 — so they form a valid basis called the X basis
(or Hadamard basis). The Pauli-X operator has ∣+⟩ and ∣−⟩ as its
eigenvectors with eigenvalues +1 and −1, respectively, which is why the name sticks.
Rewriting states across bases
Every state ∣ψ⟩ can be expanded in either basis. To find the X-basis coefficients of a
computational-basis state, express ∣0⟩ and ∣1⟩ in terms of ∣+⟩ and ∣−⟩.
Adding and subtracting the definitions above gives
∣0⟩=21(∣+⟩+∣−⟩),∣1⟩=21(∣+⟩−∣−⟩).
So ∣1⟩ in the X basis is an equal superposition of ∣+⟩ and ∣−⟩ with
opposite signs. More generally, for any state
∣ψ⟩=α∣0⟩+β∣1⟩, the X-basis expansion is
∣ψ⟩=2α+β∣+⟩+2α−β∣−⟩.
Preparing an X-basis state in a circuit
To prepare ∣+⟩ or ∣−⟩ starting from ∣0⟩, you use H (and an optional X
flip beforehand). Concretely:
H∣0⟩=∣+⟩,H∣1⟩=H(X∣0⟩)=∣−⟩.
The state ∣−⟩ lives entirely in the X basis: it is the −1 eigenstate of X, so measuring
in the X basis would give a definite outcome. Measuring in the Z basis instead gives outcome 0 or
1 with equal probability 21, because the Z-basis amplitudes both have magnitude
21.
Try it
Starting from ∣0⟩, prepare the X-basis state ∣−⟩. You will need two gates. The
grader checks the full state vector, so leaving the qubit in ∣0⟩ will not pass.
Run your code to see the quantum state.
After running, the State Vector panel should show amplitudes
≈+0.707 on ∣0⟩ and ≈−0.707 on ∣1⟩ — that is
21∣0⟩−21∣1⟩=∣−⟩.
Sign in on the full site to ask questions and join the discussion.