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 first provides the simplest basis-state flip. The Hadamard gate H then creates the |+⟩ and |−⟩ superpositions, and Z finally makes their relative-phase difference visible. 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
What “superposition” means: |+⟩ = (|0⟩ + |1⟩)/√2 and |−⟩ = (|0⟩ − |1⟩)/√2. Each state gives 0 and 1 with equal probability when measured in the computational basis. They are not classical 50/50 mixtures: the plus or minus sign records a coherent relative phase, placing the states at opposite ends of the Bloch sphere’s x-axis.
Six Qiskit Bloch spheres arranged in X, Hadamard, and Z gate order, showing zero to one, zero to plus, and plus to minus, with plus and minus expanded as superpositions.
Qiskit overview in the teaching order X, H, then Z. Blue shows each input and red shows its output. The |+⟩ and |−⟩ states are expanded below the spheres as equal-amplitude superpositions of |0⟩ and |1⟩.

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 Hadamard Gate: Create Superposition and Change Basis

After X establishes the two computational basis states, the Hadamard gate creates equal-amplitude coherent superpositions and connects the z-axis basis to the x-axis basis:

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 Qiskit Bloch spheres showing Hadamard mapping zero to plus and one to minus, with both output states expanded as superpositions.
Qiskit visualisation of H|0⟩ = |+⟩ = (|0⟩ + |1⟩)/√2 and H|1⟩ = |−⟩ = (|0⟩ − |1⟩)/√2.

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)

5  ·  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.

6  ·  X, H, and Z Side by Side

PropertyX gateH gateZ gate
Main roleBit flipCreate superposition / change basisPhase flip
Bloch rotation180° about x180° about the axis halfway between +x and +z180° about z
Coordinate map(x,y,z) → (x,−y,−z)(x,y,z) → (z,−y,x)(x,y,z) → (−x,−y,z)
Illustrative input|0⟩ → |1⟩|0⟩ → |+⟩|+⟩ → |−⟩
What becomes clearThe computational value changesBasis states become coherent superpositionsRelative phase changes
Teaching order: X makes the basis-state flip concrete. H creates |+⟩ and |−⟩. Z then reveals why the relative sign between their amplitudes matters.

7  ·  Verify the X → H → Z Diagram in Qiskit

The following public-API Qiskit program verifies the three transformations, arranges the Bloch spheres in the teaching order X, H, Z, labels the x-axis endpoints, and writes the two superposition formulas below the 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 = zero.evolve(HGate())
minus = plus.evolve(ZGate())

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

rows = [
    ("X gate", zero, one, r"Input: $|0\rangle$", r"Output: $|1\rangle$"),
    ("H gate", zero, plus, r"Input: $|0\rangle$", r"Output: $|+\rangle$"),
    ("Z gate", plus, minus, r"Input: $|+\rangle$", r"Output: $|-\rangle$"),
]

fig = plt.figure(figsize=(9.6, 12.6), facecolor="white")

for row_index, (gate, before, after, before_title, after_title) in enumerate(rows):
    for column_index, (state, title, color) in enumerate((
        (before, before_title, "#1565C0"),
        (after, after_title, "#D32F2F"),
    )):
        axis = fig.add_subplot(
            3, 2, row_index * 2 + column_index + 1, projection="3d"
        )
        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.text(
        0.03, 0.805 - row_index * 0.31, gate,
        rotation=90, va="center", ha="center", fontweight="bold",
    )

fig.suptitle(
    "Bloch-sphere gate order: X, then H, then Z",
    fontsize=19, fontweight="bold", y=0.995,
)
fig.text(
    0.5, 0.018,
    r"$|+\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$"
    r"    and    $|-\rangle=(|0\rangle-|1\rangle)/\sqrt{2}$",
    ha="center", fontsize=13,
)
fig.tight_layout(rect=(0.055, 0.05, 1, 0.975), h_pad=1.4)

output = Path("bloch-sphere-x-h-z-gates.png")
fig.savefig(output, dpi=220, bbox_inches="tight", facecolor="white")
print(output)
Verification built in: the assertions stop the program unless X maps |0⟩ to |1⟩, H maps |0⟩ to |+⟩, and Z maps |+⟩ to |−⟩.

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 is a half-turn around x, H is a half-turn about the axis halfway between +x and +z, and Z is a half-turn around 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, H creates coherent superpositions and changes between the z and x bases, and Z changes the phase relationship between basis amplitudes. 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, H, and Z really rotations?

Yes. Ignoring physically irrelevant global phase, X is a π rotation about the x-axis, H is a π rotation about the axis halfway between +x and +z, 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

2 responses 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

  2. Draw Bloch Spheres with Qiskit on Termux Avatar

    […] Quantum Computing: A Complete Learning Path series. For the underlying state geometry, begin with Bloch Sphere Explained: Basis States and the X, H and Z Gates. QUANTUM SERIES 2026 A reproducible Android workflow: calculate the states, render the spheres, […]

    Like

Leave a comment