Singapore-based practical guides, tutorials and experiments in AI, computing, modelling, simulation, optimisation and quantum computing, with research notes and hands-on workflows.

Bloch Sphere Explained: Basis States and the X and Z Gates

Part of the Quantum Computing: A Complete Learning Path series.
QUANTUM SERIES 2026
One qubit, one sphere, and three gates that connect the computational and phase bases.

The X and Z gates are both called “flips,” but they do not flip the same thing. X exchanges the computational basis states |0⟩ and |1⟩. Z leaves those measurement outcomes unchanged and instead reverses the relative phase of a superposition.

The Bloch sphere makes those distinctions geometric. X is a half-turn about the x-axis; Z is a half-turn about the z-axis; and the Hadamard gate H changes between the computational z basis and the phase-sensitive x basis. The diagrams and Qiskit verification below show exactly where the four states |0⟩, |1⟩, |+⟩, and |−⟩ move.


1  ·  Why the Bloch Sphere Works

A general pure state of one qubit is described by two complex amplitudes:

|ψ⟩ = cos(θ/2)|0⟩ + e sin(θ/2)|1⟩

The angle θ measures the state’s distance from the north pole. The angle φ gives its direction around the equator. Together they supply the two real parameters needed after normalisation and global phase have been removed.

A pure state lies on the sphere’s surface. A mixed state—representing statistical uncertainty or noise—lies inside the sphere. The centre is the maximally mixed one-qubit state, not a pure superposition.

Key distinction: the Bloch sphere discards global phase because multiplying the entire state by the same phase does not change any measurement probability. Relative phase remains, and the Z gate changes it.

2  ·  Basis States and the Equator

The computational basis states occupy the poles. The two equal superpositions with real amplitudes occupy opposite points on the x-axis:

|0⟩ = [1, 0]T  →  (0, 0, +1)
|1⟩ = [0, 1]T  →  (0, 0, −1)
|+⟩ = (|0⟩ + |1⟩)/√2  →  (+1, 0, 0)
|−⟩ = (|0⟩ − |1⟩)/√2  →  (−1, 0, 0)
StateBloch positionComputational-basis measurement
|0⟩North pole, +z0 with certainty
|1⟩South pole, −z1 with certainty
|+⟩Equator, +x0 or 1, each with probability 1/2
|−⟩Equator, −x0 or 1, each with probability 1/2
Four labelled Qiskit Bloch spheres showing zero before X, one after X, plus before Z, and minus after Z, with plus and minus marked on the x-axis.
Qiskit visualisation of X|0⟩ = |1⟩ and Z|+⟩ = |−⟩. The x-axis endpoints are labelled |+⟩ and |−⟩; blue shows the input state and red shows the state after the gate.

3  ·  The X Gate: Rotate About x

The Pauli X gate swaps the two amplitudes of a one-qubit state:

X = [0  1]
    [1  0]

X(α|0⟩ + β|1⟩) = β|0⟩ + α|1⟩

For the computational basis, this gives X|0⟩ = |1⟩ and X|1⟩ = |0⟩. On the Bloch sphere, X is a 180-degree rotation around the x-axis:

(x, y, z) → (x, −y, −z)

The x-coordinate stays fixed while y and z reverse. The poles therefore exchange places, but the states |+⟩ and |−⟩ remain on their respective x-axis points, up to global phase.

4  ·  The Z Gate: Rotate About z

The Pauli Z gate leaves the |0⟩ amplitude unchanged and reverses the sign of the |1⟩ amplitude:

Z = [1   0]
    [0  −1]

Z(α|0⟩ + β|1⟩) = α|0⟩ − β|1⟩

For the poles, Z|0⟩ = |0⟩ and Z|1⟩ = −|1⟩. The minus sign in the second expression is only a global phase when the input is |1⟩, so the physical point on the Bloch sphere does not move.

The change becomes visible for a superposition. Z maps |+⟩ to |−⟩ and |−⟩ to |+⟩, moving the state to the opposite side of the equator:

(x, y, z) → (−x, −y, z)

The phase flip is not a bit flip. Z preserves the z-coordinate and therefore leaves computational-basis probabilities unchanged. It reverses the transverse x and y components that encode relative phase.

5  ·  The Hadamard Gate: Change Basis

The Hadamard gate connects the computational basis on the z-axis to the |+⟩/|−⟩ basis on the x-axis:

H = (1/√2) [1   1]
          [1  −1]

H|0⟩ = |+⟩    H|1⟩ = |−⟩
H|+⟩ = |0⟩    H|−⟩ = |1⟩

On Bloch coordinates, Hadamard swaps the x and z components and reverses the y component:

(x, y, z) → (z, −y, x)

Geometrically, H is—up to an irrelevant global phase—a 180-degree rotation about the axis halfway between +x and +z. It is also self-inverse: applying H twice returns the starting state.

Four labelled Qiskit Bloch spheres showing the Hadamard gate moving zero to plus and one to minus.
Qiskit visualisation of H|0⟩ = |+⟩ and H|1⟩ = |−⟩. The gate moves the computational-basis poles to the labelled x-axis endpoints.

The state mappings can be checked directly with Qiskit:

from qiskit.circuit.library import HGate
from qiskit.quantum_info import Statevector

zero = Statevector.from_label("0")
one = Statevector.from_label("1")

plus = zero.evolve(HGate())
minus = one.evolve(HGate())

assert plus.equiv(Statevector.from_label("+"))
assert minus.equiv(Statevector.from_label("-"))
assert plus.evolve(HGate()).equiv(zero)
assert minus.evolve(HGate()).equiv(one)

6  ·  X and Z Side by Side

PropertyX gateZ gate
Common nameBit flipPhase flip
Bloch rotation180° about x180° about z
Coordinate map(x,y,z) → (x,−y,−z)(x,y,z) → (−x,−y,z)
Illustrative input|0⟩ → |1⟩|+⟩ → |−⟩
What visibly changesComputational valueRelative phase
Mental model: X exchanges north and south. Z spins the equator while leaving north and south fixed.

7  ·  Verify the Diagrams in Qiskit

The following program constructs the X, Z, and H output states, checks all four gate identities, converts the X/Z states into Cartesian Bloch coordinates, labels the x-axis endpoints, and saves the four-panel X/Z figure. Install the visualisation dependencies with python -m pip install "qiskit[visualization]".

from pathlib import Path

import matplotlib.pyplot as plt
import numpy as np
from qiskit.circuit.library import HGate, XGate, ZGate
from qiskit.quantum_info import Statevector
from qiskit.visualization.bloch import Bloch


def bloch_vector(state):
    alpha, beta = state.data
    overlap = np.conj(alpha) * beta
    return [
        float(2 * np.real(overlap)),
        float(2 * np.imag(overlap)),
        float(abs(alpha) ** 2 - abs(beta) ** 2),
    ]


zero = Statevector.from_label("0")
one = zero.evolve(XGate())
plus = Statevector.from_label("+")
minus = plus.evolve(ZGate())
h_plus = zero.evolve(HGate())
h_minus = Statevector.from_label("1").evolve(HGate())

assert one.equiv(Statevector.from_label("1"))
assert minus.equiv(Statevector.from_label("-"))
assert h_plus.equiv(Statevector.from_label("+"))
assert h_minus.equiv(Statevector.from_label("-"))

states = [zero, one, plus, minus]
titles = [
    r"Before X: $|0\rangle$",
    r"After X: $|1\rangle$",
    r"Before Z: $|+\rangle$",
    r"After Z: $|-\rangle$",
]
colors = ["#1565C0", "#D32F2F", "#1565C0", "#D32F2F"]

fig = plt.figure(figsize=(14, 4.2), facecolor="white")
axes = [
    fig.add_subplot(1, 4, index + 1, projection="3d")
    for index in range(4)
]

for axis, state, title, color in zip(axes, states, titles, colors):
    sphere = Bloch(fig=fig, axes=axis, font_size=13)
    sphere.xlabel = [r"$|+\rangle$", r"$|-\rangle$"]
    sphere.vector_color = [color]
    sphere.add_vectors(bloch_vector(state))
    sphere.render(title=title)

fig.suptitle(
    "Bloch-sphere action of the Pauli X and Z gates",
    fontsize=18,
    fontweight="bold",
    y=1.02,
)
fig.tight_layout(rect=(0, 0.07, 1, 0.95))

output = Path("bloch-sphere-x-z-gates.png")
fig.savefig(output, dpi=220, bbox_inches="tight", facecolor="white")
print(output)
Verification built in: the assertions stop the program if X, Z, or H produces the wrong state. The diagram uses Qiskit’s own Bloch renderer and explicitly labels |+⟩ and |−⟩ on the x-axis.

8  ·  What the Geometry Establishes

  1. Basis states are geometric poles. |0⟩ and |1⟩ point along +z and −z.
  2. Superposition includes phase. |+⟩ and |−⟩ have identical computational-basis probabilities but occupy opposite points because their relative phases differ.
  3. Single-qubit gates are rotations. X and Z are half-turns around their named axes, while H is a half-turn about the axis halfway between +x and +z.
  4. Hadamard changes basis. It maps |0⟩ and |1⟩ to |+⟩ and |−⟩, then reverses that mapping when applied again.
  5. A statevector and its Bloch vector are two descriptions of the same one-qubit state. Qiskit provides a direct numerical check of the geometry.
The central result: X changes which computational basis state is occupied, Z changes the phase relationship between basis amplitudes, and H changes between the z and x bases. The Bloch sphere separates those effects at a glance.

Frequently Asked Questions

Can a Bloch sphere represent more than one qubit?

Not as a complete state description. A Bloch sphere exactly represents one qubit. Separate single-qubit spheres cannot display all correlations in an entangled multi-qubit state.

Why does Z appear to do nothing to |0⟩ and |1⟩?

Z leaves |0⟩ unchanged and maps |1⟩ to −|1⟩. For a basis state that minus sign is global phase, so the Bloch point and computational-basis measurement remain unchanged.

Are X and Z really rotations?

Yes. Ignoring physically irrelevant global phase, X is a π rotation about the x-axis and Z is a π rotation about the z-axis.

What does the Hadamard gate do on the Bloch sphere?

H swaps the x and z coordinates and reverses y, so it maps the computational z basis to the |+⟩/|−⟩ x basis. Because H is self-inverse, a second application maps those states back.

Why use |+⟩ to demonstrate the Z gate?

The Z gate changes relative phase, which is invisible when the state contains only one computational-basis component. The state |+⟩ contains both components, so Z moves it visibly across the equator to |−⟩.


Quantum Series 2026  ·  Diagrams rendered with Qiskit 2.5.2

✦ This article and its diagrams were prepared with assistance from OpenAI Codex. The equations, gate identities, Bloch coordinates, and Qiskit code were technically verified. ✦

Continue the Quantum Series

Comments

One response to “Bloch Sphere Explained: Basis States and the X and Z Gates”

  1. Quantum Computing: A Complete Learning Path – Malcolm Low | Practical AI, Computing & Quantum Research Avatar

    […] how the Hadamard gate builds superposition, and why tensor products scale the state space. 2 Bloch Sphere Explained: Basis States and the X and Z Gates The geometric bridge from qubit statevectors to gates: where |0⟩, |1⟩, |+⟩ and |−⟩ sit, […]

    Like

Leave a comment