This post is part of my 21-day quantum computing learning journey, focusing on the fundamental building blocks of quantum computation - qubits and their visualization. We’ll explore the mathematical elegance of superposition and practical tools for visualizing quantum states.

Progress: 8/21 days completed. Qubits: ✓. Bloch Sphere: mastered. Superposition visualization: being developed

Qubit: The fundamental element of quantum computing

Quantum computing begins with a qubit — the quantum version of a classical bit. But unlike classical bits that can be either 0 or 1, qubits live in a superposition of both states simultaneously.

Mathematical representation of a qubit

A qubit state is mathematically expressed as:

Qubit state is typically represented as: $$ |\psi\rangle = \alpha |0\rangle + \beta |1\rangle $$ where \( \alpha \) and \( \beta \) are complex numbers such that: $$ |\alpha|^2 + |\beta|^2 = 1 $$

This normalization condition ensures that the total probability equals 1 when we measure the qubit.

Qubit State Components

Qubit state can be described as a linear combination of basis states. The components and their physical meanings are summarized below:

Component Meaning Physical Interpretation
\(\alpha\) Amplitude of state \(|0\rangle\) Probability coefficient for finding qubit in state \(|0\rangle\)
\(\beta\) Amplitude of state \(|1\rangle\) Probability coefficient for finding qubit in state \(|1\rangle\)
\(|\alpha|^2\) Probability Probability of measuring the qubit in state \(|0\rangle\)
\(|\beta|^2\) Probability Probability of measuring the qubit in state \(|1\rangle\)

The Bloch Sphere: Geometric visualization of a qubit

The Bloch Sphere provides a geometric representation of a single qubit. It’s a brilliant way to visualize abstract quantum concepts. Any pure qubit state can be visualized as a point on the surface of a unit sphere, defined by:

  • θ (theta): Angle from the positive z-axis (latitude)
  • φ (phi): Angle in the x-y plane (longitude)

This shows the qubit’s state as a vector from the origin to the surface of the sphere. Why the Bloch Sphere matters Quantum gate rotations: Quantum gates rotate the qubit’s vector on the Bloch Sphere, providing an intuitive way to understand how gates like X, Y, Z, H, Rx, Ry, Rz affect a qubit’s state. s Measurement visualization: Measurements collapse the state to one of the poles (|0⟩ or |1⟩).

Geometric intuition: Quantum operations become rotations in 3D space, making abstract concepts much more comprehensible.

Practical applications: Code implementing concepts

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

# Qubit representation on the Bloch sphere
def qubit_to_bloch_coordinates(alpha, beta):
    """Convert qubit amplitudes to Bloch sphere coordinates"""
    # Normalization
    norm = np.sqrt(np.abs(alpha)**2 + np.abs(beta)**2)
    alpha_norm = alpha / norm
    beta_norm = beta / norm
    
    # Cartesian coordinates on Bloch sphere
    x = 2 * np.real(np.conj(alpha_norm) * beta_norm)
    y = 2 * np.imag(np.conj(alpha_norm) * beta_norm)
    z = np.abs(alpha_norm)**2 - np.abs(beta_norm)**2
    
    return x, y, z

# Examples of qubit states
def demonstrate_qubit_states():
    """Demonstrate various qubit states on the Bloch sphere"""
    
    # Fundamental computational states
    states = {
        "|0⟩": (1, 0),
        "|1⟩": (0, 1),
        "|+⟩": (1/np.sqrt(2), 1/np.sqrt(2)),
        "|-⟩": (1/np.sqrt(2), -1/np.sqrt(2)),
        "|i+⟩": (1/np.sqrt(2), 1j/np.sqrt(2)),
        "|i-⟩": (1/np.sqrt(2), -1j/np.sqrt(2))
    }
    
    print("Qubit states on the Bloch sphere:")
    print("State\t\tα\t\tβ\t\tx\t\ty\t\tz")
    print("-" * 80)
    
    for name, (alpha, beta) in states.items():
        x, y, z = qubit_to_bloch_coordinates(alpha, beta)
        print(f"{name}\t\t{alpha:.3f}\t\t{beta:.3f}\t\t{x:.3f}\t\t{y:.3f}\t\t{z:.3f}")

# Quantum gate operations simulation
def quantum_gates_on_bloch_sphere():
    """Demonstrate quantum gate effects on the Bloch sphere"""
    
    # Pauli gates
    pauli_x = np.array([[0, 1], [1, 0]])
    pauli_y = np.array([[0, -1j], [1j, 0]])
    pauli_z = np.array([[1, 0], [0, -1]])
    
    # Hadamard gate
    hadamard = np.array([[1, 1], [1, -1]]) / np.sqrt(2)
    
    # Initial state |0⟩
    initial_state = np.array([1, 0])
    
    gates = {
        "Initial |0⟩": np.eye(2),
        "After X gate": pauli_x,
        "After Y gate": pauli_y,
        "After Z gate": pauli_z,
        "After H gate": hadamard
    }
    
    print("\nQuantum gate effects on |0⟩ state:")
    print("Gate\t\t\tFinal state\t\tBloch position (x,y,z)")
    print("-" * 70)
    
    for name, gate in gates.items():
        final_state = gate @ initial_state
        alpha, beta = final_state[0], final_state[1]
        x, y, z = qubit_to_bloch_coordinates(alpha, beta)
        print(f"{name:<20}\t[{alpha:.3f}, {beta:.3f}]\t({x:.3f}, {y:.3f}, {z:.3f})")

# Bloch sphere visualization
def visualize_bloch_sphere():
    """Create 3D visualization of the Bloch sphere with key states"""
    fig = plt.figure(figsize=(10, 8))
    ax = fig.add_subplot(111, projection='3d')
    
    # Draw the sphere
    u = np.linspace(0, 2 * np.pi, 100)
    v = np.linspace(0, np.pi, 100)
    x_sphere = np.outer(np.cos(u), np.sin(v))
    y_sphere = np.outer(np.sin(u), np.sin(v))
    z_sphere = np.outer(np.ones(np.size(u)), np.cos(v))
    
    ax.plot_surface(x_sphere, y_sphere, z_sphere, alpha=0.1, color='lightblue')
    
    # Plot key quantum states
    states = {
        "|0⟩": (0, 0, 1, 'blue'),
        "|1⟩": (0, 0, -1, 'red'),
        "|+⟩": (1, 0, 0, 'green'),
        "|-⟩": (-1, 0, 0, 'orange'),
        "|i+⟩": (0, 1, 0, 'purple'),
        "|i-⟩": (0, -1, 0, 'brown')
    }
    
    for name, (x, y, z, color) in states.items():
        ax.scatter([x], [y], [z], color=color, s=100, label=name)
        ax.text(x*1.2, y*1.2, z*1.2, name, fontsize=12)
    
    # Add coordinate axes
    ax.plot([0, 1.5], [0, 0], [0, 0], 'k-', alpha=0.3)
    ax.plot([0, 0], [0, 1.5], [0, 0], 'k-', alpha=0.3)
    ax.plot([0, 0], [0, 0], [0, 1.5], 'k-', alpha=0.3)
    
    ax.set_xlabel('X')
    ax.set_ylabel('Y')
    ax.set_zlabel('Z')
    ax.set_title('Bloch Sphere with Key Quantum States')
    ax.legend()
    
    plt.tight_layout()
    plt.show()

# Complete system demonstration
if __name__ == "__main__":
    print("=== Qubit States Demonstration ===")
    demonstrate_qubit_states()
    
    print("\n=== Quantum Gates on Bloch Sphere ===")
    quantum_gates_on_bloch_sphere()
    
    print("\n=== Bloch Sphere Visualization ===")
    visualize_bloch_sphere()

Bridging Classical and Quantum Mathematical Frameworks

Aspect Classical Quantum (Bloch Sphere)
States Bit values {0,1} Points on unit sphere
Operations Boolean functions Unitary rotations
Probabilities Deterministic \(|\alpha|^2\) and \(|\beta|^2\)
Reversibility Often irreversible Always reversible
Correlations Classical Quantum superposition

Quantum Concepts Summary

Topic Formal Expression Description
Qubit normalization \(|\alpha|^2 + |\beta|^2 = 1\) Total probability constraint
Computational basis \(|0\rangle = [1,0]^T,\quad |1\rangle = [0,1]^T\) Standard qubit basis states
Superposition state \(|+\rangle = \frac{1}{\sqrt{2}} (|0\rangle + |1\rangle)\) Equal superposition of basis states
Bloch coordinates \(x = 2\text{Re}(\alpha\beta),\ y = 2\text{Im}(\alpha\beta),\ z = |\alpha|^2 - |\beta|^2\) Mapping amplitudes to sphere
Pauli-X rotation \(X|0\rangle = |1\rangle,\quad X|1\rangle = |0\rangle\) Bit flip operation
Hadamard transformation \(H|0\rangle = |+\rangle,\quad H|1\rangle = |-\rangle\) Superposition creation
Measurement probability \(P(|0\rangle) = |\alpha|^2,\quad P(|1\rangle) = |\beta|^2\) Born rule application
Phase rotation \(R_z(\theta)|\psi\rangle = e^{-i\theta/2}|\psi\rangle\) Z-axis rotation on Bloch sphere

Key takeaway

The Bloch Sphere is a powerful mental model to understand and visualize quantum states. It shows how superposition, phase, and quantum gate operations act geometrically — not just algebraically.

Quantum computing isn’t just numbers — it’s also rotations, spheres, and a whole new way of visualizing logic. The elegance and power of the Bloch sphere continues to unlock new frontiers in quantum technology, making it an essential tool for anyone serious about quantum computing.

Mathematical reality of quantum supremacy: The Bloch sphere provides the precise language needed to describe quantum advantages over classical computation, from exponential speedups to fundamentally new computational paradigms. Understanding the geometric nature of quantum operations through the Bloch sphere is crucial for developing intuition about more complex quantum systems and algorithms.

My site is free of ads and trackers. Was this post helpful to you? Why not BuyMeACoffee


Reference:

  1. Introduction to quantum computing: Bloch sphere.
  2. Bloch sphere
  3. What is the Bloch Sphere, and why is it Important In Understanding Qubits and Quantum Computing?
  4. Bloch Sphere Simulator
  5. The Bloch Sphere: Quantum’s Controversial Concept
  6. The interactive system of Bloch sphere for quantum computing education