k›ketwise.
FUNDAMENTALS / 08 / GATES

The X gate

Use a matrix to explain a bit flip.

Intuition

X swaps the two amplitudes. On the basis states it acts like classical NOT, but it also acts on every superposition.

X maps α|0⟩+β|1⟩ to β|0⟩+α|1⟩. On the Bloch sphere it is a half-turn around the x axis, up to global phase. It does not mean 'set the qubit to 1'.

The mathematics

X=[0110]X=\begin{bmatrix}0&1\\1&0\end{bmatrix}
Look a little deeper

Matrix-vector multiplication swaps the first and second entries. X is unitary: its conjugate transpose times itself is identity, so it preserves normalization.

Use it

Transform |0⟩ into |1⟩ using a single X.

This exercise uses the same server-side state and circuit checks as its linked practice problem.

Build your circuit

Click a gate to append it, or drag it onto a wire. CX uses the selected control; SWAP uses it as the second operand. Basis order: |qₙ … q₀⟩.

q0

Returned logical circuit · before transpilation · q0 on top

0 / 32 gates · terminal measurement of all qubits

Connect to code

qc.x(0)

These operations go inside a circuit-building program. Practice problems provide a complete solve() template.

Solve the linked Qiskit problem →

Check your understanding

What does X do to |1⟩?

First complete the circuit exercise successfully.