Skip to content

Qubit States & Bloch Sphere

Category: Quantum Computing
Difficulty: Beginner
Time Complexity: N/A (state representation)
Space Complexity: O(1) per qubit

A qubit is the quantum analog of a classical bit. While a classical bit is either 0 or 1, a qubit can exist in a superposition: |ψ⟩ = α₀|0⟩ + α₁|1⟩, where α₀ and α₁ are complex amplitudes satisfying |α₀|² + |α₁|² = 1. The Bloch sphere is a unit sphere where every point on the surface represents a valid single-qubit pure state. This visualization walks through fundamental qubit states (|0⟩, |1⟩, |+⟩, |−⟩) and shows how quantum gates rotate the state vector on the Bloch sphere.

{
"stateSequence": [
{
"label": "|0\u27e9",
"amplitudes": [
1,
0,
0,
0
]
},
{
"label": "H|0\u27e9 = |+\u27e9",
"amplitudes": [
0.7071067811865476,
0,
0.7071067811865476,
0
],
"gate": "H"
},
{
"label": "S|+\u27e9 = |+i\u27e9",
"amplitudes": [
0.7071067811865476,
0,
0,
0.7071067811865476
],
"gate": "S"
},
{
"label": "H|+i\u27e9",
"amplitudes": [
0.5,
0.5,
0.5,
-0.5
],
"gate": "H"
},
{
"label": "X|0\u27e9 = |1\u27e9",
"amplitudes": [
0,
0,
1,
0
],
"gate": "X"
},
{
"label": "H|1\u27e9 = |\u2212\u27e9",
"amplitudes": [
0.7071067811865476,
0,
-0.7071067811865476,
0
],
"gate": "H"
}
]
}
{
"stateSequence": [
{
"label": "|0\u27e9",
"amplitudes": [
1,
0,
0,
0
]
},
{
"label": "H|0\u27e9 = |+\u27e9",
"amplitudes": [
0.7071067811865476,
0,
0.7071067811865476,
0
],
"gate": "H"
},
{
"label": "S|+\u27e9 = |+i\u27e9",
"amplitudes": [
0.7071067811865476,
0,
0,
0.7071067811865476
],
"gate": "S"
},
{
"label": "H|+i\u27e9",
"amplitudes": [
0.5,
0.5,
0.5,
-0.5
],
"gate": "H"
},
{
"label": "X|0\u27e9 = |1\u27e9",
"amplitudes": [
0,
0,
1,
0
],
"gate": "X"
},
{
"label": "H|1\u27e9 = |\u2212\u27e9",
"amplitudes": [
0.7071067811865476,
0,
-0.7071067811865476,
0
],
"gate": "H"
}
]
}
{
"stateSequence": [
{
"label": "|0\u27e9",
"amplitudes": [
1,
0,
0,
0
]
},
{
"label": "X|0\u27e9 = |1\u27e9",
"amplitudes": [
0,
0,
1,
0
],
"gate": "X"
},
{
"label": "Y|0\u27e9 = i|1\u27e9",
"amplitudes": [
0,
0,
0,
1
],
"gate": "Y"
},
{
"label": "Z|0\u27e9 = |0\u27e9",
"amplitudes": [
1,
0,
0,
0
],
"gate": "Z"
}
]
}
{
"stateSequence": [
{
"label": "|0\u27e9",
"amplitudes": [
1,
0,
0,
0
]
},
{
"label": "H|0\u27e9 = |+\u27e9",
"amplitudes": [
0.7071067811865476,
0,
0.7071067811865476,
0
],
"gate": "H"
},
{
"label": "T|+\u27e9",
"amplitudes": [
0.7071067811865476,
0,
0.5,
0.5
],
"gate": "T"
}
]
}
// Qubit State Representation
|ψ⟩ = α₀|0⟩ + α₁|1⟩
// Constraint: |α₀|² + |α₁|² = 1
P(|0⟩) = |α₀|²
P(|1⟩) = |α₁|²
// Bloch Sphere Coordinates
θ = 2 × acos(|α₀|)
φ = arg(α₁) − arg(α₀)
// Cartesian (for rendering)
x = sin(θ) × cos(φ)
y = sin(θ) × sin(φ)
z = cos(θ)
import math
def qubit_state(alpha0: complex, alpha1: complex):
"""Represent a qubit state |ψ⟩ = α₀|0⟩ + α₁|1⟩"""
# Verify normalization
assert abs(abs(alpha0)**2 + abs(alpha1)**2 - 1.0) < 1e-9
return (alpha0, alpha1)
def bloch_angles(alpha0: complex, alpha1: complex):
"""Convert state to Bloch sphere angles (θ, φ)"""
theta = 2 * math.acos(min(1.0, abs(alpha0)))
if abs(alpha1) < 1e-10:
phi = 0
elif abs(alpha0) < 1e-10:
phi = math.atan2(alpha1.imag, alpha1.real)
else:
phi = math.atan2(alpha1.imag, alpha1.real) - math.atan2(alpha0.imag, alpha0.real)
return theta, phi % (2 * math.pi)
// Qubit state: |ψ⟩ = α₀|0⟩ + α₁|1⟩
// α₀, α₁ are complex numbers: [real, imaginary]
function qubitState(alpha0, alpha1) {
// Verify normalization
const normSq = alpha0[0]**2 + alpha0[1]**2 + alpha1[0]**2 + alpha1[1]**2;
console.assert(Math.abs(normSq - 1.0) < 1e-9);
return [alpha0, alpha1];
}
function blochAngles(alpha0, alpha1) {
const theta = 2 * Math.acos(Math.min(1, Math.sqrt(alpha0[0]**2 + alpha0[1]**2)));
const phi = Math.atan2(alpha1[1], alpha1[0]) - Math.atan2(alpha0[1], alpha0[0]);
return { theta, phi: ((phi % (2*Math.PI)) + 2*Math.PI) % (2*Math.PI) };
}

The fundamental unit of quantum information, capable of existing in a superposition of |0⟩ and |1⟩.

A unit sphere where every point on the surface represents a valid single-qubit pure state. The north pole is |0⟩, the south pole is |1⟩, and the equator contains equal superpositions like |+⟩ and |−⟩.

A qubit in state α|0⟩ + β|1⟩ is in a superposition — it’s not ‘secretly’ 0 or 1, but genuinely both until measured.

When measured, the probability of getting |0⟩ is |α₀|² and |1⟩ is |α₁|², always summing to 1 (Born rule).

  • Phase vs Probability: Two states can have the same measurement probabilities but different phases (e.g., |+⟩ and |+i⟩ both give 50/50, but they differ on the Bloch sphere). Phase matters for interference.
  • Global Phase: Multiplying a state by e^{iγ} doesn’t change any observable — the Bloch sphere representation removes global phase.

Q1: What is the probability of measuring |0⟩ for the state |+⟩ = (|0⟩ + |1⟩)/√2?

  • A) 100%
  • B) 50%
  • C) 25%
  • D) 0%
Show answer

Answer: B) 50%

|α₀|² = |1/√2|² = 1/2 = 50%. The amplitudes are equal, so both outcomes are equally likely.

Q2: Where is the state |0⟩ located on the Bloch sphere?

  • A) North pole (top)
  • B) South pole (bottom)
  • C) On the equator
  • D) At the center
Show answer

Answer: A) North pole (top)

By convention, |0⟩ is at the north pole (z = +1) and |1⟩ is at the south pole (z = −1) of the Bloch sphere.

Q3: Can two different qubit states give identical measurement probabilities?

  • A) Yes — states can differ in phase
  • B) No — probabilities uniquely determine the state
  • C) Only if they are entangled
  • D) Only for mixed states
Show answer

Answer: A) Yes — states can differ in phase

States like |+⟩ = (|0⟩+|1⟩)/√2 and |+i⟩ = (|0⟩+i|1⟩)/√2 both give 50/50 measurement probabilities, but they are different quantum states with different phases.