Malcolm Low | Practical AI, Computing & Quantum Research

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 Basis States: X vs Z Gates & Phase Rotations

Yes, quantum gates rotate state vectors. Confusing computational and Hadamard bases causes phase flip errors. See the visual Bloch sphere state guide →

·

Written by

Part of the Quantum Computing: A Complete Learning Path series.
Quick Answer & Key Insight

How Do Pauli X and Z Gates Rotate States on the Bloch Sphere?

Yes, Pauli X and Z gates flip states on the sphere. Blindly rotating qubits without tracking orthogonal axes causes fatal phase errors in quantum algorithms. Explore the interactive 3D visualization, state vector rotations, and Qiskit code below →

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⟩ + eiφ 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)
Quantum Gate Main Role & Bloch Sphere Rotation Coordinate Map & Basis Action
X gate Bit flip · 180° about x-axis (x,y,z) → (x,−y,−z) · Maps |0⟩ ↔ |1⟩
H gate Superposition / basis change · 180° about (x+z) axis (x,y,z) → (z,−y,x) · Maps |0⟩ ↔ |+⟩
Z gate Phase flip · 180° about z-axis (x,y,z) → (−x,−y,z) · Maps |+⟩ ↔ |−⟩
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.
Where single-qubit geometry reaches its limit: The Bloch sphere is exact for single isolated qubits. But what happens when two qubits become entangled? The joint system can no longer be factored into individual statevectors, and each qubit’s Bloch vector shrinks from the surface to the center ($r = 0$). See our dedicated guide to Two-Qubit Entanglement, the 4 Bell States, and Bloch Sphere Collapse.

Frequently Asked Questions

Can a Bloch sphere represent more than one qubit?

Not as a complete state description. A Bloch sphere exactly represents one pure single-qubit state. Separate single-qubit spheres cannot display quantum correlations in an entangled multi-qubit state. In fact, if you trace out one qubit of a maximally entangled Bell pair, the individual qubit’s Bloch vector collapses to the exact origin (r = 0, representing the maximally mixed state ρ = ½I). For the mathematical derivation and visual proof, see Two-Qubit Entanglement, the 4 Bell States, and Bloch Collapse.

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
← Previous: Qubits, Hadamard gates and superposition
→ Next (Core Mechanism): Understanding Phase Kickback: How Target Eigenstates Shift Control Phases →
→ Next (Entanglement): Two-Qubit Entanglement & The 4 Bell States (Module 3) →
Learning path: View the complete Quantum Computing learning path →
Quantum Series Recommended Next Reading in Quantum Computing

Deepen your quantum intuition with our step-by-step mathematical and circuit guides:

Deutsch-Jozsa Algorithm (Qiskit) →
Exponential quantum separation, constant vs balanced oracles & Qiskit code.
Reversible Computing & Gates →
Why quantum circuits require unitary reversibility, Landauer’s limit & Toffoli logic.
Understanding Phase Kickback →
How eigenvalue phases kick back into control qubits to power quantum speedups.
Bloch Sphere & Pauli Rotations →
Visual geometry of basis states |0⟩, |1⟩ and equatorial superposition rotations.
Draw Bloch Spheres with Qiskit →
Generating Matplotlib 3D state spheres on Android Termux and WordPress.
Complete Quantum Learning Path →
The full 12-part sequence from basic qubits to Shor’s and Grover’s algorithms.
FAQ Frequently Asked Questions

How do Pauli X and Z gates rotate qubit states on the Bloch sphere?

The Pauli X gate rotates the qubit state vector by pi radians around the x-axis, flipping |0> to |1>. The Pauli Z gate rotates the state vector by pi radians around the z-axis, changing the relative phase between basis states.

What is the geometric representation of basis states on the Bloch sphere?

The computational basis state |0> is located at the North Pole (z = +1), and |1> is located at the South Pole (z = -1). Equal superposition states lie on the equatorial plane.

Comments

Leave a Reply

More posts