Launch the interactive walkthrough to discover each component, including the 3D Q-Sphere Lab & Python in Colab.
Understand the fundamental unit of quantum information — the qubit — and how it differs from classical bits.
Grasp complex quantum concepts visually with zero prior physics or math knowledge!
100% OFF (0) or 100% ON (1)
No blend, no intermediate color. A strict binary choice.
Blue (0) + Red (1) = Purple
Blends both colors at any dial setting! Snaps to Blue or Red when measured.
Blend Blue (|0⟩) and Red (|1⟩) into Purple, then measure!
SUPERPOSITION: Pure Blended Purple Beam (|ψ⟩)
The detector hasn't looked yet. It is genuinely both colors simultaneously!
Interactive 3D state vector exploration, unitary transformation gates, and Born rule collapse for Topic 5.7
| Symbol / Term | Meaning | Beginner Interpretation |
|---|---|---|
| 2-element state vector | Column matrix holding quantum probability amplitudes | |
| Probability amplitude for (Spin Down) | Determines probability of measuring 0: P(0) = |α|² | |
| Probability amplitude for (Spin Up) | Determines probability of measuring 1: P(1) = |β|² |
Equal superposition state |+>: alpha = 1/sqrt(2), beta = 1/sqrt(2):
Result: A 50/50 chance of measuring 0 or 1, completely balanced.
| Symbol / Term | Meaning | Beginner Interpretation |
|---|---|---|
| Bra vector (row matrix) | Adjoint [1, 0] of column vector | |
| Ket vector (column matrix) | State vector [alpha, beta]^T | |
| Measurement probability | Squared modulus of the inner product |
For vector [0.6, 0.8]^T, calculate probability of measuring 0 and 1:
Result: The qubit has a 36% chance of measuring 0 and a 64% chance of measuring 1.
| Symbol / Term | Meaning | Beginner Interpretation |
|---|---|---|
| Probability of measuring | Chance of seeing Spin Down (0) | |
| Probability of measuring | Chance of seeing Spin Up (1) |
Verification of state vector [1/sqrt(2), 1/sqrt(2)]^T:
Result: Normalized valid quantum state vector.
A qubit starts in a defined state, typically |0⟩ (equivalent to classical 0).
Quantum gates manipulate the qubit to create superpositions — combinations of |0⟩ and |1⟩.
While in superposition, quantum algorithms apply operations that work on all possible states simultaneously.
When measured, the qubit collapses to either |0⟩ or |1⟩ with probabilities determined by |α|² and |β|².
After measurement, the qubit is in a definite state (either |0⟩ or |1⟩), and the superposition is destroyed.
Problem: Classical algorithms process one input at a time, limiting speed for certain problems.
Solution: Qubits in superposition allow quantum algorithms to explore multiple solution paths simultaneously.
Problem: Classical encryption can be broken with enough computing power.
Solution: Qubits enable quantum key distribution where any eavesdropping attempt disturbs the quantum state and is detectable.
Problem: Simulating quantum systems on classical computers becomes exponentially harder as system size grows.
Solution: Qubits naturally represent quantum states, making quantum simulation efficient on quantum computers.
Construct a 1-qubit circuit with Hadamard superposition, measure on Aer simulator, and plot measurement counts using matplotlib.
For Google Colab or Jupyter notebooks, run this shell command to install the required dependencies:
!pip install qiskit qiskit-aer matplotlib1 from qiskit import QuantumCircuit 2 from qiskit_aer import Aer 3 from qiskit.visualization import plot_histogram 4 import matplotlib.pyplot as plt
from qiskit import QuantumCircuit → Create and configure quantum circuits in Qiskit.
from qiskit_aer import Aer → Import Qiskit Aer high-performance simulator backend.
from qiskit.visualization import plot_histogram → Visualize quantum measurement statistics.
import matplotlib.pyplot as plt → Render bar charts and measurement distributions.
1 # Create a quantum circuit with 1 qubit and 1 classical bit 2 qc = QuantumCircuit(1, 1) 3 4 # Apply Hadamard gate to create superposition 5 qc.h(0) 6 7 # Measure the qubit 8 qc.measure(0, 0) 9 10 # Use Qiskit's Aer simulator 11 simulator = Aer.get_backend('aer_simulator') 12 13 # Run the circuit on the simulator 14 job = simulator.run(qc, shots=1000) # 1000 measurements 15 result = job.result() 16 17 # Get the measurement results 18 counts = result.get_counts(qc) 19 print(f"Measurement Counts: {counts}") 20 21 # Convert dictionary keys and values into lists 22 labels = list(counts.keys()) # ['0', '1'] 23 values = list(counts.values()) # [490, 510] 24 colors = ['blue', 'red'] 25 26 # Plot the bar chart 27 plt.bar(labels, values, color=colors) 28 plt.xlabel("Measurement Outcome") 29 plt.ylabel("Count") 30 plt.title("Quantum Measurement Results (Lesson 3)") 31 plt.show()
# Create a quantum circuit with 1 qubit and 1 classical bit
Allocate quantum register and classical bit for measurement.
qc = QuantumCircuit(1, 1)
Initialize 1 qubit in state |0> and 1 classical bit.
# Apply Hadamard gate to create superposition
Rotate state vector to equator (|+> state).
qc.h(0)
Apply Hadamard gate on qubit 0.
# Measure the qubit
Project quantum superposition into classical bit.
qc.measure(0, 0)
Measure qubit 0 into classical bit 0.
# Use Qiskit's Aer simulator
Configure aer_simulator backend.
simulator = Aer.get_backend('aer_simulator')
Load state simulator.
# Run the circuit on the simulator
Sample 1000 measurement shots.
job = simulator.run(qc, shots=1000) # 1000 measurements
Execute quantum simulation job.
result = job.result()
Retrieve job execution results.
# Get the measurement results
Extract dictionary of outcome counts.
counts = result.get_counts(qc)
Read counts dictionary.
print(f"Measurement Counts: {counts}")
Display outcome tally (e.g. {'0': ~500, '1': ~500}).
# Convert dictionary keys and values into lists
Format data for bar chart visualization.
labels = list(counts.keys()) # ['0', '1']
Basis state labels.
values = list(counts.values()) # [490, 510]
Observed frequency values.
colors = ['blue', 'red']
Distinct colors for basis states.
# Plot the bar chart
Render comparative histogram.
plt.bar(labels, values, color=colors)
Draw bar chart.
plt.xlabel("Measurement Outcome")
Set X-axis label.
plt.ylabel("Count")
Set Y-axis label.
plt.title("Quantum Measurement Results (Lesson 3)")
Set chart title.
plt.show()
Display plot figure.
Click "Copy for Colab", open Google Colab, paste into a single cell, and run.
1 # ========================================================= 2 # Lesson 3: Quantum Measurement with a One-Qubit Circuit 3 # Prepared for Google Colab (Run with Shift + Enter) 4 # ========================================================= 5 6 # Step 1: Install required packages 7 !pip install qiskit qiskit-aer matplotlib 8 9 # Step 2: Import libraries 10 from qiskit import QuantumCircuit 11 from qiskit_aer import Aer 12 from qiskit.visualization import plot_histogram 13 import matplotlib.pyplot as plt 14 15 # Step 3: Run Demonstration 16 # Create a quantum circuit with 1 qubit and 1 classical bit 17 qc = QuantumCircuit(1, 1) 18 19 # Apply Hadamard gate to create superposition 20 qc.h(0) 21 22 # Measure the qubit 23 qc.measure(0, 0) 24 25 # Use Qiskit's Aer simulator 26 simulator = Aer.get_backend('aer_simulator') 27 28 # Run the circuit on the simulator 29 job = simulator.run(qc, shots=1000) # 1000 measurements 30 result = job.result() 31 32 # Get the measurement results 33 counts = result.get_counts(qc) 34 print(f"Measurement Counts: {counts}") 35 36 # Convert dictionary keys and values into lists 37 labels = list(counts.keys()) # ['0', '1'] 38 values = list(counts.values()) # [490, 510] 39 colors = ['blue', 'red'] 40 41 # Plot the bar chart 42 plt.bar(labels, values, color=colors) 43 plt.xlabel("Measurement Outcome") 44 plt.ylabel("Count") 45 plt.title("Quantum Measurement Results (Lesson 3)") 46 plt.show()
Create QuantumCircuit(1, 1) initializing qubit 0 in ground state |0>.
Transform |0> into equal superposition (|0> + |1>)/sqrt(2).
Collapse quantum wavefunction into classical bit 0 with Born rule probabilities.
Run 1,000 shots on AerSimulator to observe statistical 50/50 convergence.
Plot measurement distribution comparing |0> and |1> outcomes.
QuantumCircuit(1, 1) with H gate and projective measurement.
Measurement Counts: {'0': 502, '1': 498}A single qubit in superposition collapses with 50% probability to outcome 0 and 50% probability to outcome 1, visually verified across 1000 simulated shots.
Hadamard, measurement, histogram, and probability collapse in single-qubit quantum systems.
Test your understanding with these questions. Remember, this is for learning, not examination!