|q⟩ Bad Qubits

beginner · Programming · Single-Qubit Gates I: X, Y, Z

The X (NOT) Gate

The Pauli-X gate is the quantum version of the classical NOT: it swaps the amplitudes of ∣0⟩|0\rangle and ∣1⟩|1\rangle. On a basis state it simply flips the bit,

X∣0⟩=∣1⟩,X∣1⟩=∣0⟩,X|0\rangle = |1\rangle, \qquad X|1\rangle = |0\rangle,

and its matrix is

X=(0110).X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}.

Unlike a classical NOT, XX acts linearly on superpositions too: X(α∣0⟩+β∣1⟩)=β∣0⟩+α∣1⟩X\big(\alpha|0\rangle + \beta|1\rangle\big) = \beta|0\rangle + \alpha|1\rangle. Because X2=IX^2 = I, applying it twice returns the original state — XX is its own inverse.

Try it

Flip the qubit from ∣0⟩|0\rangle to ∣1⟩|1\rangle, then press Run and Check.

Run your code to see the quantum state.

After running, all the probability sits on ∣1⟩|1\rangle — the Bloch vector now points at the south pole.

Sign in on the full site to ask questions and join the discussion.