Bloch Sphere Geometry: Representing Qubit Superposition and Quantum State Vectors
1. Theoretical Foundations: Two-State Hilbert Spaces & Dirac Notation
Classical information processing relies upon the binary bit—a deterministic state restricted to the discrete set ${0, 1}$. Quantum information theory, by contrast, reformulates the fundamental unit of information into the qubit (quantum bit), a physical system whose state space is modeled by a two-dimensional complex Hilbert space $\mathcal{H}_2 \cong \mathbb{C}^2$. Understanding the geometric and algebraic mechanics of this fundamental system requires a formal journey through linear algebra, Dirac bra-ket notation, complex probability amplitudes, and sphere mapping.
1.1 The Two-State Hilbert Space and Computational Basis
In the formal language of quantum mechanics introduced by Paul Dirac, a physical state is represented by a normalized ray in a Hilbert space. For a single qubit, the standard computational basis vectors, denoted by the ket vectors $|0\rangle$ and $|1\rangle$, form an orthonormal basis for $\mathbb{C}^2$:
$$|0\rangle = \begin{pmatrix} 1 \ 0 \end{pmatrix}, \quad |1\rangle = \begin{pmatrix} 0 \ 1 \end{pmatrix}$$
Orthonormality is expressed via the inner product, defined using the conjugate transpose (bra vector $\langle \psi | = |\psi\rangle^\dagger$):
$$\langle 0 | 0 \rangle = \begin{pmatrix} 1 & 0 \end{pmatrix} \begin{pmatrix} 1 \ 0 \end{pmatrix} = 1, \quad \langle 1 | 1 \rangle = 1, \quad \langle 0 | 1 \rangle = \begin{pmatrix} 1 & 0 \end{pmatrix} \begin{pmatrix} 0 \ 1 \end{pmatrix} = 0$$
An arbitrary pure state vector $|\psi\rangle \in \mathbb{C}^2$ is expressed as a linear combination of these basis states:
$$|\psi\rangle = \alpha |0\rangle + \beta |1\rangle = \begin{pmatrix} \alpha \ \beta \end{pmatrix}$$
where $\alpha, \beta \in \mathbb{C}$ are complex probability amplitudes.
Complex Vector Space (C²) Bloch Sphere Geometry (S²)
------------------------- --------------------------
|ψ⟩ = α|0⟩ + β|1⟩ |0⟩ (North Pole)
α, β ∈ C, |α|² + |β|² = 1 |
| / θ (Polar)
Bra-Ket Conjugate Transpose: | /
⟨ψ| = α*⟨0| + β*⟨1| = (α* β*) | /--- φ (Azimuthal)
|/__________ |1⟩ (South Pole)
1.2 Complex Amplitudes and the Born Rule Normalization
According to the fundamental postulates of quantum mechanics—as detailed in foundational courses such as MIT OpenCourseWare Quantum Physics—the physical interpretation of the complex amplitudes $\alpha$ and $\beta$ is governed by Born's rule. Upon performing a measurement in the computational basis, the probability $P(0)$ of observing the system in state $|0\rangle$ and the probability $P(1)$ of observing $|1\rangle$ are given by the squared moduli of their respective amplitudes:
$$P(0) = |\alpha|^2 = \alpha^ \alpha, \quad P(1) = |\beta|^2 = \beta^ \beta$$
Because the total measurement probability across all mutually exclusive outcomes in a closed system must equal unity, any valid state vector must satisfy the normalization condition:
$$\langle \psi | \psi \rangle = |\alpha|^2 + |\beta|^2 = 1$$
Writing $\alpha$ and $\beta$ in their polar forms clarifies the physical degrees of freedom:
$$\alpha = r_0 e^{i \gamma_0}, \quad \beta = r_1 e^{i \gamma_1}$$
where $r_0, r_1 \ge 0$ and $\gamma_0, \gamma_1 \in [0, 2\pi)$. Substituting these expressions into the normalization constraint yields:
$$r_0^2 + r_1^2 = 1$$
This constraint describes a 3-sphere $S^3$ embedded within $\mathbb{R}^4 \cong \mathbb{C}^2$. However, quantum mechanics dictates that an overall global phase factor has no observable physical consequences. Factoring out $e^{i \gamma_0}$ gives:
$$|\psi\rangle = e^{i \gamma_0} \left( r_0 |0\rangle + r_1 e^{i (\gamma_1 - \gamma_0)} |1\rangle \right)$$
Since $e^{i \gamma_0}$ acts as a global phase, we set $\gamma = \gamma_0$ and define the relative phase angle $\phi = \gamma_1 - \gamma_0$. The physical state is thus parameterized by two real numbers:
$$|\psi\rangle \sim r_0 |0\rangle + r_1 e^{i\phi} |1\rangle$$
1.3 Parametrization and Derivation of the Bloch Sphere
To map the normalization condition $r_0^2 + r_1^2 = 1$ onto standard trigonometric functions, we reparameterize $r_0$ and $r_1$ using a single polar angle $\theta$. Defining $r_0 = \cos(\theta/2)$ and $r_1 = \sin(\theta/2)$ guarantees that $r_0^2 + r_1^2 = \cos^2(\theta/2) + \sin^2(\theta/2) = 1$ for all real $\theta$.
Restricting $\theta \in [0, \pi]$ and $\phi \in [0, 2\pi)$ avoids redundant coverage of the state space. This yields the canonical parameterization of a single-qubit state vector:
$$|\psi(\theta, \phi)\rangle = \cos\left(\frac{\theta}{2}\right) |0\rangle + e^{i\phi} \sin\left(\frac{\theta}{2}\right) |1\rangle$$
This mapping establishes a bijection between pure single-qubit states (up to global phase) and points on the surface of a unit 2-sphere in $\mathbb{R}^3$, known as the Wikipedia Bloch Sphere.
+z |0⟩
| /
| /
|/ θ (Polar Angle)
+--------------> +y
/ \ \
/ \ \ φ (Azimuthal Angle)
/ \ \
+x v---|1⟩ (-z)
The Cartesian coordinates $(r_x, r_y, r_z) \in \mathbb{R}^3$ corresponding to a point on the Bloch sphere surface are evaluated as the expectation values of the Pauli spin operators:
$$r_x = \langle \psi | \sigma_x | \psi \rangle = \sin\theta \cos\phi$$
$$r_y = \langle \psi | \sigma_y | \psi \rangle = \sin\theta \sin\phi$$
$$r_z = \langle \psi | \sigma_z | \psi \rangle = \cos\theta$$
Direct verification confirms that $r_x^2 + r_y^2 + r_z^2 = \sin^2\theta(\cos^2\phi + \sin^2\phi) + \cos^2\theta = \sin^2\theta + \cos^2\theta = 1$.
1.4 The Density Operator Representation
For mixed states (statistical ensembles of pure states), the system is described by a density operator $\rho$. A general single-qubit density matrix can be expanded in terms of the identity matrix $I$ and the three Pauli matrices as documented in the mathematical overview of Wikipedia Pauli Matrices:
$$\rho = \frac{1}{2} \left( I + \vec{r} \cdot \vec{\sigma} \right) = \frac{1}{2} \begin{pmatrix} 1 + r_z & r_x - i r_y \ r_x + i r_y & 1 - r_z \end{pmatrix}$$
where $\vec{r} = (r_x, r_y, r_z)^T$ is the Bloch vector. The state is pure if and only if $|\vec{r}| = 1$ ($\text{Tr}(\rho^2) = 1$), mixed if $|\vec{r}| < 1$ ($\text{Tr}(\rho^2) < 1$), and maximally mixed when $\vec{r} = \vec{0}$ ($\rho = \frac{1}{2}I$).
2. Quantum Advantage: Unitary Gates & Matrix Algebra
Quantum computation processes information by manipulating state vectors via linear transformations that preserve norm and probability structure.
2.1 Postulate of Unitary Evolution
The time evolution of a closed quantum system is governed by the Schrödinger equation, implying that any quantum logic gate acting on a single qubit must be represented by a $2 \times 2$ unitary matrix $U \in \text{U}(2)$, satisfying:
$$U^\dagger U = U U^\dagger = I_2$$
where $U^\dagger = (U^*)^T$ is the Hermitian conjugate of $U$.
Unitary matrices preserve the inner product between arbitrary quantum states:
$$\langle U\phi | U\psi \rangle = \langle \phi | U^\dagger U | \psi \rangle = \langle \phi | \psi \rangle$$
This guarantees that physical normalization is strictly conserved under quantum logic operations.
+-------------------------------------------------------------------+
| Pauli Generator Matrix Set |
+-------------------------------------------------------------------+
| X = [0 1] Y = [0 -i] Z = [1 0] I = [1 0] |
| [1 0] [i 0] [0 -1] [0 1] |
+-------------------------------------------------------------------+
The algebraic properties of the Pauli matrices form the fundamental algebra $\mathfrak{su}(2)$:
$$\sigma_i \sigma_j = \delta_{ij} I + i \sum_{k} \epsilon_{ijk} \sigma_k$$
$${\sigma_i, \sigma_j} = 2\delta_{ij}I, \quad [\sigma_i, \sigma_j] = 2i \sum_{k} \epsilon_{ijk} \sigma_k$$
2.2 Geometric Rotations Around Sphere Axes
Every single-qubit unitary gate $U \in \text{SU}(2)$ can be expressed as a rotation operator $R_{\hat{n}}(\theta)$ corresponding to a rotation by an angle $\theta$ around a unit axis vector $\hat{n} = (n_x, n_y, n_z)$ on the Bloch sphere. Using the matrix exponential Taylor series expansion:
$$R_{\hat{n}}(\theta) = \exp\left(-i \frac{\theta}{2} \hat{n} \cdot \vec{\sigma}\right) = \sum_{k=0}^{\infty} \frac{\left(-i \frac{\theta}{2}\right)^k}{k!} (\hat{n} \cdot \vec{\sigma})^k$$
Since $(\hat{n} \cdot \vec{\sigma})^2 = (n_x^2 + n_y^2 + n_z^2)I = I$, the series separates into even and odd terms:
$$R_{\hat{n}}(\theta) = \left( \sum_{m=0}^{\infty} \frac{(-1)^m \left(\frac{\theta}{2}\right)^{2m}}{(2m)!} \right) I - i \left( \sum_{m=0}^{\infty} \frac{(-1)^m \left(\frac{\theta}{2}\right)^{2m+1}}{(2m+1)!} \right) (\hat{n} \cdot \vec{\sigma})$$
$$R_{\hat{n}}(\theta) = \cos\left(\frac{\theta}{2}\right) I - i \sin\left(\frac{\theta}{2}\right) (n_x X + n_y Y + n_z Z)$$
The standard single-qubit axis rotation operators are thus defined as:
$$R_x(\theta) = \begin{pmatrix} \cos(\theta/2) & -i\sin(\theta/2) \ -i\sin(\theta/2) & \cos(\theta/2) \end{pmatrix}$$
$$R_y(\theta) = \begin{pmatrix} \cos(\theta/2) & -\sin(\theta/2) \ \sin(\theta/2) & \cos(\theta/2) \end{pmatrix}$$
$$R_z(\theta) = \begin{pmatrix} e^{-i\theta/2} & 0 \ 0 & e^{i\theta/2} \end{pmatrix}$$
2.3 Step-by-Step Mathematical Proofs of Core Transformations
Proof 1: Action of the Hadamard Gate $H$ on Basis $|0\rangle$
The Hadamard transformation $H$ is defined as:
$$H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \ 1 & -1 \end{pmatrix}$$
Applying $H$ to state $|0\rangle$:
$$H |0\rangle = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \ 1 & -1 \end{pmatrix} \begin{pmatrix} 1 \ 0 \end{pmatrix} = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \ 1 \end{pmatrix} = \frac{1}{\sqrt{2}} |0\rangle + \frac{1}{\sqrt{2}} |1\rangle \equiv |+\rangle$$
To compute its Bloch sphere position, compare $|+\rangle$ with the standard form $\cos(\theta/2)|0\rangle + e^{i\phi}\sin(\theta/2)|1\rangle$:
$$\cos(\theta/2) = \frac{1}{\sqrt{2}} \implies \frac{\theta}{2} = \frac{\pi}{4} \implies \theta = \frac{\pi}{2}$$
$$e^{i\phi}\sin(\pi/4) = \frac{1}{\sqrt{2}} \implies e^{i\phi} = 1 \implies \phi = 0$$
Evaluating the Bloch coordinates:
$$r_x = \sin(\pi/2)\cos(0) = 1, \quad r_y = \sin(\pi/2)\sin(0) = 0, \quad r_z = \cos(\pi/2) = 0$$
Thus, $H$ rotates the state vector from the North pole $(0, 0, 1)$ to the positive x-axis $(1, 0, 0)$ on the Bloch sphere equator. $\blacksquare$
Proof 2: State Transformation Under $R_y(\theta)$
Let the initial state be $|0\rangle = \begin{pmatrix} 1 \ 0 \end{pmatrix}$. We calculate $R_y(\theta)|0\rangle$:
$$R_y(\theta) |0\rangle = \begin{pmatrix} \cos(\theta/2) & -\sin(\theta/2) \ \sin(\theta/2) & \cos(\theta/2) \end{pmatrix} \begin{pmatrix} 1 \ 0 \end{pmatrix} = \begin{pmatrix} \cos(\theta/2) \ \sin(\theta/2) \end{pmatrix} = \cos\left(\frac{\theta}{2}\right) |0\rangle + \sin\left(\frac{\theta}{2}\right) |1\rangle$$
This transformed state vector matches the canonical Bloch parameterization for azimuthal angle $\phi = 0$. The operation rotates the Bloch vector along the meridian arc by angle $\theta$ towards the South pole ($|1\rangle$). $\blacksquare$
Proof 3: Antipodal Mapping of Orthogonal States
Let $|\psi_1\rangle$ and $|\psi_2\rangle$ be two pure states represented on the Bloch sphere by vectors $\vec{r}_1$ and $\vec{r}_2$.
$$|\psi_1\rangle = \cos\left(\frac{\theta}{2}\right)|0\rangle + e^{i\phi}\sin\left(\frac{\theta}{2}\right)|1\rangle$$
Let $|\psi_2\rangle$ be an orthogonal state such that $\langle \psi_1 | \psi_2 \rangle = 0$. Taking the inner product:
$$|\psi_2\rangle = \sin\left(\frac{\theta}{2}\right)|0\rangle - e^{i\phi}\cos\left(\frac{\theta}{2}\right)|1\rangle$$
Computing the Bloch coordinates for $|\psi_2\rangle$:
$$r_{2,x} = \sin(\pi - \theta)\cos(\phi + \pi) = \sin\theta(-\cos\phi) = -r_{1,x}$$
$$r_{2,y} = \sin(\pi - \theta)\sin(\phi + \pi) = \sin\theta(-\sin\phi) = -r_{1,y}$$
$$r_{2,z} = \cos(\pi - \theta) = -\cos\theta = -r_{1,z}$$
Therefore, $\vec{r}_2 = -\vec{r}_1$. Orthogonal state vectors in complex Hilbert space $\mathbb{C}^2$ map to diametrically opposite (antipodal) points on the real geometric Bloch sphere $S^2$. $\blacksquare$
3. Quantum Advantage: Interference & Hilbert Space Scaling
The core computational capabilities of quantum systems stem from wave function interference and the exponential scaling of multi-qubit tensor product spaces.
3.1 Wave Function Interference Dynamics
In classical probability distributions, combinations of independent state probabilities are strictly additive ($P = P_1 + P_2$). In quantum mechanics, probability amplitudes add linearly, enabling both constructive and destructive interference prior to state collapse:
$$|\psi_{final}\rangle = U_2 U_1 |\psi_{initial}\rangle$$
Consider applying two successive Hadamard transforms to state $|0\rangle$:
$$H (H |0\rangle) = H \left( \frac{|0\rangle + |1\rangle}{\sqrt{2}} \right) = \frac{1}{\sqrt{2}} \left( \frac{|0\rangle + |1\rangle}{\sqrt{2}} \right) + \frac{1}{\sqrt{2}} \left( \frac{|0\rangle - |1\rangle}{\sqrt{2}} \right)$$
$$= \frac{1}{2}|0\rangle + \frac{1}{2}|1\rangle + \frac{1}{2}|0\rangle - \frac{1}{2}|1\rangle = \left(\frac{1}{2} + \frac{1}{2}\right)|0\rangle + \left(\frac{1}{2} - \frac{1}{2}\right)|1\rangle = 1|0\rangle + 0|1\rangle = |0\rangle$$
State Path |0⟩ ---+---> Amplitude +1/2 ---> (|0⟩ Component Constructive) ---> 1|0⟩
\
State Path |1⟩ ----+---> Amplitude -1/2 ---> (|1⟩ Component Destructive) ---> 0|1⟩
The amplitude for state $|1\rangle$ undergoes complete destructive interference ($\frac{1}{2} - \frac{1}{2} = 0$), while state $|0\rangle$ undergoes constructive interference. Quantum algorithms leverage this mechanism by constructing interference patterns that cancel out incorrect computational paths while amplifying the amplitudes of optimal solutions.
3.2 Dimensionality and Algorithmic Complexity
While a single qubit is parameterized by two continuous angles on $S^2$, an $n$-qubit register inhabits a tensor product space $\mathcal{H}{2^n} = \bigotimes{i=1}^n \mathcal{H}_2 \cong \mathbb{C}^{2^n}$.
$$\left|\Psi^{(n)}\right\rangle = \sum_{k=0}^{2^n - 1} c_k |k\rangle, \quad \sum_{k=0}^{2^n - 1} |c_k|^2 = 1$$
Qubits (n) Hilbert Space Dim (2ⁿ) Classical Bits Required for Amplitudes
---------------------------------------------------------------------------------
1 2 2 x 64-bit float = 16 Bytes
10 1,024 16 KB
30 1,073,741,824 16 GB
50 1.125 x 10¹⁵ 16 Petabytes
300 ~2³⁰⁰ (> Atoms in Universe) Uncomputable by Classical Hardware
This exponential growth in state space capacity allows quantum algorithms to process vast computational spaces simultaneously. When coupled with entanglement and interference, this structure enables quantum complexity classes like BQP (Bounded-Error Quantum Polynomial-Time) to achieve superpolynomial speedups over classical algorithms for specific problem domains.
4. Industrial Analogies & Real-World Applications
+-----------------------------------------------------------------------------------------+
| INDUSTRIAL QUANTUM PIPELINE |
+-----------------------------------------------------------------------------------------+
| |
| +-----------------------+ +-----------------------+ +---------------------+ |
| | FINANCIAL PORTFOLIOS | | MOLECULAR SIMULATION | | CRYPTOGRAPHY (PQC) | |
| | Combinatorial Optima | | Quantum Chemistry VQE | | Shor / Lattice / QKD| |
| +-----------+-----------+ +-----------+-----------+ +----------+----------+ |
| | | | |
| +----------------------+ | +---------------------+ |
| v v v |
| +----------------------------------------+ |
| | SINGLE & MULTI-QUBIT HARDWARE | |
| | Unitary Rotations & State Interference | |
| +----------------------------------------+ |
+-----------------------------------------------------------------------------------------+
1. Financial Portfolio Optimization & Risk Modeling
Modern portfolio theory requires solving Quadratic Unconstrained Binary Optimization (QUBO) problems across millions of assets. Classical algorithms scale exponentially when evaluating non-linear correlation matrices.
By mapping asset combinations to multi-qubit state spaces, quantum approximate optimization algorithms (QAOA) utilize unitary rotation matrices ($R_x, R_z$) to explore high-dimensional risk landscapes. Quantum phase superposition allows simultaneous evaluation of multi-asset risk profiles, providing quadratic to exponential reductions in computational latency for real-time market risk arbitrage.
2. Molecular Simulation & Chemical Catalysis
Simulating molecular dynamics (e.g., Nitrogenase $FeMo$-cofactor for industrial fertilizer production) requires tracking strongly correlated electron configurations. Classical approximations (e.g., Density Functional Theory) struggle with electron correlation scaling.
Using the Variational Quantum Eigensolver (VQE) framework—built on single-qubit parameter rotations $R_y(\theta)$ and entangling operations—qubit registers directly mimic molecular orbitals. This enables exact calculations of ground-state energy surfaces, accelerating drug discovery and energy storage development.
3. Post-Quantum Cryptography & Security Architecture
Modern public-key cryptosystems (RSA, ECC) rely on the classical hardness of integer factorization and discrete logarithms. Shor's algorithm demonstrates that a fault-tolerant quantum computer can solve these problems in polynomial time $O((\log N)^3)$, breaking standard encryption paradigms.
Consequently, organizations like the NIST Post-Quantum Cryptography Standard are deploying quantum-resistant lattice-based algorithms (such as CRYSTALS-Kyber and Dilithium), alongside hardware-based Quantum Key Distribution (BB84 protocol) leveraging single-qubit polarization states.
4. Supply Chain & Logistics Network Optimization
Global logistics platforms handle complex routing problems with millions of constraints. Finding global minima across intricate cost landscapes often traps classical solvers in local minima.
Quantum annealing and universal gate-based algorithms navigate these landscapes using quantum tunneling and phase-directed interference. Single-qubit parameter tunings alter the tunneling probability amplitude across energy barriers, accelerating global optimization for routing, fleet scheduling, and global freight distribution.
5. Advanced Materials Design & Superconductivity
Discovering room-temperature superconductors requires analyzing the Fermi-Hubbard model for strongly interacting lattice systems. Classical computational overhead scales exponentially with system size.
Simulating quantum materials directly on quantum hardware circumvents this bottleneck. By mapping electron spin states directly to Bloch sphere representations, materials scientists can model phase transitions, magnetic properties, and high-temperature superconducting mechanisms with unprecedented fidelity.
5. Core Takeaway: Key Quantum Advantage
[!IMPORTANT]
THE CORE QUANTUM ADVANTAGE
Unlike classical bits, which are strictly bounded to discrete binary states ($0$ or $1$), a single qubit leverages complex probability amplitudes ($\alpha, \beta \in \mathbb{C}$) to inhabit a continuous two-dimensional Hilbert space mapped directly onto the surface of the Bloch sphere ($S^2$).The computational power of quantum systems emerges from unitary linear transformations (retaining probability normalization) and wave function interference (amplifying correct solutions while cancelling incorrect paths). When scaled to $n$ qubits, this framework unlocks an exponential state space ($\mathbb{C}^{2^n}$), enabling computational speedups across cryptography, chemistry, and complex optimization problems.
6. Implementation & Computational Verification in Python
The following Python program relies strictly on standard numerical frameworks (NumPy Documentation) to model single-qubit state vectors, evaluate density matrices, perform unitary rotations using Pauli spin generators, calculate measurement probability distributions, and extract exact geometric Bloch sphere coordinates.
#!/usr/bin/env python3
"""
Single-Qubit Quantum Information State Engine
Mathematical Verification of Hilbert Vectors, Unitary Rotations, and Bloch Mapping.
"""
import numpy as np
# Define Standard Computational Basis Vectors
KET_0 = np.array([[1.0], [0.0]], dtype=np.complex128)
KET_1 = np.array([[0.0], [1.0]], dtype=np.complex128)
# Define Pauli Operators & Identity Matrix
I2 = np.array([[1, 0], [0, 1]], dtype=np.complex128)
SIGMA_X = np.array([[0, 1], [1, 0]], dtype=np.complex128)
SIGMA_Y = np.array([[0, -1j], [1j, 0]], dtype=np.complex128)
SIGMA_Z = np.array([[1, 0], [0, -1]], dtype=np.complex128)
def compute_bloch_coordinates(psi: np.ndarray) -> tuple[float, float, float]:
"""
Calculates the Bloch sphere coordinates (rx, ry, rz) for a pure state |ψ⟩.
Formula: r_i = ⟨ψ| σ_i |ψ⟩
"""
# Ensure vector normalization
norm = np.linalg.norm(psi)
if not np.isclose(norm, 1.0):
psi = psi / norm
psi_bra = psi.conj().T
rx = float(np.real(psi_bra @ SIGMA_X @ psi)[0, 0])
ry = float(np.real(psi_bra @ SIGMA_Y @ psi)[0, 0])
rz = float(np.real(psi_bra @ SIGMA_Z @ psi)[0, 0])
return rx, ry, rz
def construct_state_vector(theta: float, phi: float) -> np.ndarray:
"""
Generates a canonical state vector: |ψ⟩ = cos(θ/2)|0⟩ + exp(iφ)sin(θ/2)|1⟩
"""
alpha = np.cos(theta / 2.0)
beta = np.exp(1j * phi) * np.sin(theta / 2.0)
return alpha * KET_0 + beta * KET_1
def get_rotation_matrix(axis: str, angle: float) -> np.ndarray:
"""
Constructs a single-qubit axis rotation operator R_n(θ) = exp(-i * (θ/2) * σ_n)
"""
half_angle = angle / 2.0
cos_term = np.cos(half_angle)
sin_term = np.sin(half_angle)
if axis.upper() == 'X':
return cos_term * I2 - 1j * sin_term * SIGMA_X
elif axis.upper() == 'Y':
return cos_term * I2 - 1j * sin_term * SIGMA_Y
elif axis.upper() == 'Z':
return cos_term * I2 - 1j * sin_term * SIGMA_Z
else:
raise ValueError("Axis must be 'X', 'Y', or 'Z'.")
def evaluate_quantum_state(psi: np.ndarray, state_label: str = "State Vector") -> None:
"""
Outputs state diagnostics including state amplitudes, measurement probabilities,
density matrix, and Bloch sphere coordinates.
"""
norm_sq = float(np.real((psi.conj().T @ psi)[0, 0]))
p0 = float(np.abs(psi[0, 0])**2)
p1 = float(np.abs(psi[1, 0])**2)
rx, ry, rz = compute_bloch_coordinates(psi)
rho = psi @ psi.conj().T
print(f"\n==================== {state_label.upper()} ====================")
print(f"Vector Representation |ψ⟩:\n |0⟩ coefficient (α): {psi[0,0]:.5f}\n |1⟩ coefficient (β): {psi[1,0]:.5f}")
print(f"Normalization Check ⟨ψ|ψ⟩ : {norm_sq:.6f}")
print(f"Born Rule Probabilities : P(|0⟩) = {p0:.4f}, P(|1⟩) = {p1:.4f}")
print(f"Bloch Vector (rx, ry, rz) : ({rx:.5f}, {ry:.5f}, {rz:.5f})")
print(f"Density Matrix (ρ = |ψ⟩⟨ψ|):\n{np.round(rho, 4)}")
print("=========================================================")
if __name__ == "__main__":
print("=== QUANTUM STATE VECTOR & BLOCH SPHERE ENGINE ===")
# 1. Initialize State at North Pole |0⟩
psi_initial = KET_0
evaluate_quantum_state(psi_initial, "Initial State |0⟩")
# 2. Apply Hadamard Transformation H = (X + Z) / sqrt(2)
Hadamard = (1.0 / np.sqrt(2.0)) * (SIGMA_X + SIGMA_Z)
psi_plus = Hadamard @ psi_initial
evaluate_quantum_state(psi_plus, "Hadamard Transformed State |+⟩")
# 3. Apply Ry(π/2) Rotation to |0⟩
Ry_pi_2 = get_rotation_matrix('Y', np.pi / 2.0)
psi_ry = Ry_pi_2 @ psi_initial
evaluate_quantum_state(psi_ry, "State after Ry(π/2) Rotation")
# 4. Verify Equivalence between H|0⟩ and R_y(π/2) followed by R_z(0) up to global phase
rx_h, ry_h, rz_h = compute_bloch_coordinates(psi_plus)
rx_ry, ry_ry, rz_ry = compute_bloch_coordinates(psi_ry)
bloch_dist = np.sqrt((rx_h - rx_ry)**2 + (ry_h - ry_ry)**2 + (rz_h - rz_ry)**2)
print(f"\n[Verification] Distance between H|0⟩ and Ry(π/2)|0⟩ on Bloch Sphere: {bloch_dist:.8f}")
assert np.isclose(bloch_dist, 0.0), "Bloch coordinates must match identically."
print("[SUCCESS] All mathematical invariants and state transformations verified successfully.")
Verification & Execution Results
=== QUANTUM STATE VECTOR & BLOCH SPHERE ENGINE ===
==================== INITIAL STATE |0⟩ ====================
Vector Representation |ψ⟩:
|0⟩ coefficient (α): 1.00000+0.00000j
|1⟩ coefficient (β): 0.00000+0.00000j
Normalization Check ⟨ψ|ψ⟩ : 1.000000
Born Rule Probabilities : P(|0⟩) = 1.0000, P(|1⟩) = 0.0000
Bloch Vector (rx, ry, rz) : (0.00000, 0.00000, 1.00000)
Density Matrix (ρ = |ψ⟩⟨ψ|):
[[1.+0.j 0.+0.j]
[0.+0.j 0.+0.j]]
=========================================================
==================== HADAMARD TRANSFORMED STATE |+⟩ ====================
Vector Representation |ψ⟩:
|0⟩ coefficient (α): 0.70711+0.00000j
|1⟩ coefficient (β): 0.70711+0.00000j
Normalization Check ⟨ψ|ψ⟩ : 1.000000
Born Rule Probabilities : P(|0⟩) = 0.5000, P(|1⟩) = 0.5000
Bloch Vector (rx, ry, rz) : (1.00000, 0.00000, 0.00000)
Density Matrix (ρ = |ψ⟩⟨ψ|):
[[0.5+0.j 0.5+0.j]
[0.5+0.j 0.5+0.j]]
=========================================================
==================== STATE AFTER RY(Π/2) ROTATION ====================
Vector Representation |ψ⟩:
|0⟩ coefficient (α): 0.70711+0.00000j
|1⟩ coefficient (β): 0.70711+0.00000j
Normalization Check ⟨ψ|ψ⟩ : 1.000000
Born Rule Probabilities : P(|0⟩) = 0.5000, P(|1⟩) = 0.5000
Bloch Vector (rx, ry, rz) : (1.00000, 0.00000, 0.00000)
Density Matrix (ρ = |ψ⟩⟨ψ|):
[[0.5+0.j 0.5+0.j]
[0.5+0.j 0.5+0.j]]
=========================================================
[Verification] Distance between H|0⟩ and Ry(π/2)|0⟩ on Bloch Sphere: 0.00000000
[SUCCESS] All mathematical invariants and state transformations verified successfully.
7. Summary & Further Reading
The single qubit serves as the fundamental building block of quantum computation. By understanding how complex Hilbert spaces ($\mathbb{C}^2$), Dirac bra-ket algebra, and unitary linear operations map onto the geometric surface of the Bloch sphere ($S^2$), researchers and software engineers can reason about higher-dimensional multi-qubit systems. As quantum computing scales from single-qubit rotations to thousand-qubit fault-tolerant processors, these foundational mathematical principles remain the core framework for designing algorithms, analyzing quantum error correction, and unlocking quantum advantage across global industries.
For further exploration of quantum hardware frameworks and advanced theoretical physics, consult the official software documentation at IBM Qiskit Documentation.