First time studying this topic?

Launch the interactive walkthrough to discover each component, including the 3D Q-Sphere Lab & Python in Colab.

Topic 5.7

Qubit

Understand the fundamental unit of quantum information — the qubit — and how it differs from classical bits.

Learning Objectives

  • ✓Understand quantum bits (qubits) as the fundamental unit of quantum information
  • ✓Master column matrix representation: |0⟩ (Spin Down) and |1⟩ (Spin Up)
  • ✓Explore quantum superposition, probability amplitudes, and normalization
  • ✓Understand how measurement outcomes depend on the alignment of the measurement apparatus
  • ✓Learn mathematical operations on qubits: inner products and adjoints (conjugate transpose)
  • ✓Preview Bra-Ket notation and map course progression toward coding real quantum circuits

📖Let's Begin with a Story

Imagine flipping a coin. While it is spinning in the air, it is neither heads nor tails — it is in a dynamic state of "both." Only when you catch it and look does it snap into a definite single outcome. Classical computers work with bits that are always rigid — either 0 or 1, like a coin lying flat on a table showing heads or tails. There is no in-between. In quantum computing, our basic unit of information is the qubit (quantum bit). Qubits are physical quantum systems—such as the spin of an electron or the polarization of a photon. An electron can have its spin pointing down (∣0⟩|0\rangle) or up (∣1⟩|1\rangle). But before you measure it, quantum mechanics permits the electron to exist in an active superposition: it is simultaneously Spin Up and Spin Down! This is not a matter of human ignorance; it is a fundamental property of our universe. By learning how qubits work mathematically as column vectors and physically through quantum mechanics, you build the foundation for our entire journey: starting with why quantum computing matters, advancing to quantum logic gates and multi-qubit circuits, and ultimately running real quantum algorithms on cloud-based quantum computers!

Why Should You Learn Qubit?

🎯 Practical & Engineering Stakes
1. Foundational unit of quantum information: Just as the bit underpins all classical software, the qubit is the fundamental currency of quantum computing. 2. Superposition enables exponential state space: While a classical register holds one number at a time, nn qubits can exist in a superposition of all 2n2^n computational states at once. 3. Course Progression & Long-Term Goals: - Phase 1 (Foundations): Master the physics of qubits, superposition, interference, and entanglement with zero prerequisites. - Phase 2 (Circuit Construction): Learn quantum logic gates (Pauli-X, Hadamard, CNOT) and construct quantum circuits. - Phase 3 (Hands-On Coding & Execution): Write runnable Python code in Qiskit, simulate quantum registers, and deploy circuits to real IBM Quantum processors in the cloud. 4. Physical Reality: Real qubits exist in labs today using superconducting transmon circuits, trapped atomic ions, and photon waveguides.

🎮 Fun Learning Zone

Grasp complex quantum concepts visually with zero prior physics or math knowledge!

Zero Prerequisites
Visual Concept Storyboard

The Tumbling Silver Coin & The Dual-Beam Flashlight

Classical: Lightbulb Switch
💡 ⚪ 🔘

100% OFF (0) or 100% ON (1)

No blend, no intermediate color. A strict binary choice.

Qubit: Dual-Beam Purple Light
🟣 🔦 🪙

Blue (0) + Red (1) = Purple

Blends both colors at any dial setting! Snaps to Blue or Red when measured.

Classical: Serial / ConstrainedQuantum: Coherent Wave Parallelism
Visual takeaway: Understand in 5 seconds

Everyday Analogy: The Tumbling Silver Coin & The Dual-Beam Flashlight

Think of a classical bit as an ordinary light bulb: it can only be clicked OFF (0) or ON (1). Now imagine a special quantum flashlight with two color beams: Blue (Spin Down, 0) and Red (Spin Up, 1). A qubit is like a dial that lets you blend both colors at any intensity you want! When the dial is set to 50/50, the light shines pure Purple. But here is the quantum magic: our measuring detector cannot see Purple! When the detector measures the light, the purple beam instantly snaps into either 100% pure Blue or 100% pure Red. Before measurement, it was genuinely both!
🧪

Interactive Mental Sandbox

Try It Yourself
Dual-Beam Flashlight & Detector Snapping

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!

📖 The Thought Experiment Prompt:“Try this experiment in your imagination: You spin a shiny quarter on a smooth table. While it is spinning, you slide a cardboard card toward it from the side. If your card is tilted horizontally, the coin is forced to slap down flat (measuring in the computational basis). If you tilt your card at an angle, you alter the physics of how it gets caught! This is exactly how quantum measurement apparatus alignment works: the angle of your detector determines what physical property of the qubit you measure.”

✨ The "Aha!" Moment

A classical bit is a binary switch (0 or 1). A qubit is a 2-element column vector (c0c1)\begin{pmatrix} c_0 \\ c_1 \end{pmatrix} holding probability amplitudes. Until measured, it lives in a continuous world of possibilities!

What Is It?

Simple Explanation

A qubit (quantum bit) is the basic unit of quantum information. 1. Vector Representation (Column Matrices): A qubit's state is written as a 2-element column vector: - State ∣0⟩|0\rangle (Spin Down): (10)\begin{pmatrix} 1 \\ 0 \end{pmatrix} — upper element is the amplitude for 0. - State ∣1⟩|1\rangle (Spin Up): (01)\begin{pmatrix} 0 \\ 1 \end{pmatrix} — lower element is the amplitude for 1. 2. Superposition & Probability: A qubit can be in a superposition: (1/21/2)\begin{pmatrix} 1/\sqrt{2} \\ 1/\sqrt{2} \end{pmatrix}. To find the probability of each outcome, we square the magnitude of each amplitude: (1/2)2=1/2=50%(1/\sqrt{2})^2 = 1/2 = 50\% chance of 0, and (1/2)2=1/2=50%(1/\sqrt{2})^2 = 1/2 = 50\% chance of 1. The probabilities always sum to 1.0! 3. Measurement Apparatus Alignment: When you measure a qubit, the outcome depends on the physical alignment of your measurement apparatus with the qubit state. Perfect alignment yields 100% certainty for that spin state; tilting or misaligning the apparatus creates probabilistic outcomes based on the projection angle. 4. Mathematical Operations: Quantum mechanics uses inner products (matrix multiplication) to calculate probabilities, and takes the adjoint (transpose and complex conjugate †\dagger) of state vectors to turn column vectors into row vectors. 5. Bra-Ket Preview: Instead of writing full matrices every time, physicists use Bra-Ket notation: the Ket ∣ψ⟩|\psi\rangle is the column vector, and the Bra ⟨ψ∣\langle\psi| is its adjoint row vector.

Technical Explanation

A qubit is a two-level quantum system described by a state vector ∣ψ⟩|\psi\rangle in a 2-dimensional complex Hilbert space H=C2\mathcal{H} = \mathbb{C}^2. Represented as a column vector: ∣ψ⟩=(αβ)=α(10)+β(01)=α∣0⟩+β∣1⟩|\psi\rangle = \begin{pmatrix} \alpha \\ \beta \end{pmatrix} = \alpha \begin{pmatrix} 1 \\ 0 \end{pmatrix} + \beta \begin{pmatrix} 0 \\ 1 \end{pmatrix} = \alpha |0\rangle + \beta |1\rangle where α,β∈C\alpha, \beta \in \mathbb{C} are complex probability amplitudes satisfying the normalization constraint ⟨ψ∣ψ⟩=∣α∣2+∣β∣2=1\langle\psi|\psi\rangle = |\alpha|^2 + |\beta|^2 = 1. Measurement in an orthonormal basis {∣u0⟩,∣u1⟩}\{|u_0\rangle, |u_1\rangle\} defined by apparatus alignment yields outcome ii with probability P(i)=∣⟨ui∣ψ⟩∣2P(i) = |\langle u_i | \psi \rangle|^2 via the Born rule. The adjoint operation ∣ψ⟩†=(α∗β∗)=⟨ψ∣|\psi\rangle^\dagger = \begin{pmatrix} \alpha^* & \beta^* \end{pmatrix} = \langle\psi| converts ket column vectors into bra row vectors, enabling inner product evaluation ⟨ϕ∣ψ⟩\langle\phi|\psi\rangle.

📚 Key Terms

QubitQubit

Simple: The basic unit of quantum information, represented as a column vector with two probability amplitudes.
Technical: A two-level quantum system described by a normalized state vector in 2D complex Hilbert space C2\mathbb{C}^2.

Column Matrix Representation

Simple: Writing a qubit as a 2-number column: top number is amplitude for Spin Down (0), bottom number is amplitude for Spin Up (1).
Technical: Vector representation in computational basis: ∣0⟩=[1,0]T|0\rangle = [1, 0]^T and ∣1⟩=[0,1]T|1\rangle = [0, 1]^T.

Superposition & Normalization

Simple: Being in both states at once, where the squared probabilities of all outcomes must add up to exactly 100% (1.0).
Technical: Linear combination ∣ψ⟩=α∣0⟩+β∣1⟩|\psi\rangle = \alpha|0\rangle + \beta|1\rangle satisfying the normalization constraint ∣α∣2+∣β∣2=1|\alpha|^2 + |\beta|^2 = 1.

Measurement Apparatus Alignment

Simple: How your measuring device is physically tilted relative to the qubit: perfect alignment gives 100% certainty; misalignment gives probabilistic outcomes.
Technical: Choice of measurement basis M=∑iλi∣ui⟩⟨ui∣M = \sum_i \lambda_i |u_i\rangle\langle u_i|; projection probabilities follow P(i)=∣⟨ui∣ψ⟩∣2P(i) = |\langle u_i | \psi \rangle|^2.

Adjoint (Conjugate Transpose †\dagger)

Simple: Flipping a column vector on its side into a row vector and taking the complex conjugate of any imaginary numbers.
Technical: Hermitian adjoint operation A†=(AT)∗A^\dagger = (A^T)^*; maps ket ∣ψ⟩∈H|\psi\rangle \in \mathcal{H} to dual bra functional ⟨ψ∣∈H∗\langle\psi| \in \mathcal{H}^*.

Inner Product

Simple: Multiplying a row vector (bra) by a column vector (ket) to get a single number representing state overlap and probability.
Technical: Scalar product ⟨ϕ∣ψ⟩=∑iϕi∗ψi\langle\phi|\psi\rangle = \sum_i \phi_i^* \psi_i in Hilbert space defining metric norm and transition amplitudes.

Bra-Ket Preview

Simple: A clean shorthand: Ket ∣ψ⟩|\psi\rangle is the column vector, Bra ⟨ψ∣\langle\psi| is the matching row vector.
Technical: Dirac notation providing coordinate-free representation of vectors and linear functionals in Hilbert space.

Q-Sphere Lab: Qubit

IBM Q-Sphere Model

Interactive 3D state vector exploration, unitary transformation gates, and Born rule collapse for Topic 5.7

Azimuth: 45°Elevation: 25°
+Z |0⟩-Z |1⟩+X |+⟩+Y |+i⟩01|ψ⟩
Q-Sphere Phase Color:
0 π/2 π 3π/2

Quantum Statevector

dim(H) = 2
|ψ⟩ = (1.000 + 0.000i)|0⟩
     + (0.000 + 0.000i)|1⟩
Polar Angle (θ):0.0° (0.000π rad)
Phase Angle (ϕ):0.0° (0.000π rad)

Born Rule Probabilities: P(x) = |⟨x|ψ⟩|²Σ P = 1.00

P(|0⟩) = |α|²100.0%
P(|1⟩) = |β|²0.0%
Quantum Measurement

Apply Single-Qubit Unitary Gates

Presets:
Continuous Polar Angle θ (0° = |0⟩, 180° = |1⟩):0.0°
Continuous Phase Angle ϕ (0° to 360°):0.0°
Recent Operations Log:
#1Initial state: |0⟩

📐 Mathematical Foundation

LaTeX KaTeX
∣ψ⟩=(αβ)=α(10)+β(01)=α∣0⟩+β∣1⟩|\psi\rangle = \begin{pmatrix} \alpha \\ \beta \end{pmatrix} = \alpha \begin{pmatrix} 1 \\ 0 \end{pmatrix} + \beta \begin{pmatrix} 0 \\ 1 \end{pmatrix} = \alpha|0\rangle + \beta|1\rangle

What does it mean?

Column vector matrix representation of a single qubit. The top element alpha is the amplitude for Spin Down (|0>), and the bottom element beta is the amplitude for Spin Up (|1>).

Understanding the Symbols

Symbol / TermMeaningBeginner Interpretation
(αβ)\begin{pmatrix} \alpha \\ \beta \end{pmatrix}2-element state vectorColumn matrix holding quantum probability amplitudes
α(top)\alpha (\text{top})Probability amplitude for ∣0⟩|0\rangle (Spin Down)Determines probability of measuring 0: P(0) = |α|²
β(bottom)\beta (\text{bottom})Probability amplitude for ∣1⟩|1\rangle (Spin Up)Determines probability of measuring 1: P(1) = |β|²

📊 Numerical Example

Equal superposition state |+>: alpha = 1/sqrt(2), beta = 1/sqrt(2):

|\psi\rangle = \begin{pmatrix} 1/\sqrt{2} \\ 1/\sqrt{2} \end{pmatrix} P(0) = |1/\sqrt{2}|^2 = 1/2 = 50\% P(1) = |1/\sqrt{2}|^2 = 1/2 = 50\% Total = 50\% + 50\% = 100\%

Result: A 50/50 chance of measuring 0 or 1, completely balanced.

📐 Mathematical Foundation

LaTeX KaTeX
P(0)=∣⟨0∣ψ⟩∣2=∣(10)(αβ)∣2=∣α∣2P(0) = |\langle 0 \mid \psi \rangle|^2 = \left| \begin{pmatrix} 1 & 0 \end{pmatrix} \begin{pmatrix} \alpha \\ \beta \end{pmatrix} \right|^2 = |\alpha|^2

What does it mean?

Inner product calculation using the adjoint bra ⟨0∣\langle 0| and ket ∣ψ⟩|\psi\rangle to find the measurement probability of outcome 0.

Understanding the Symbols

Symbol / TermMeaningBeginner Interpretation
⟨0∣\langle 0 |Bra vector (row matrix)Adjoint [1, 0] of column vector ∣0⟩|0\rangle
∣ψ⟩|\psi\rangleKet vector (column matrix)State vector [alpha, beta]^T
P(0)P(0)Measurement probabilitySquared modulus of the inner product

📊 Numerical Example

For vector [0.6, 0.8]^T, calculate probability of measuring 0 and 1:

P(0) = |0.6|^2 = 0.36 = 36\% P(1) = |0.8|^2 = 0.64 = 64\% 36\% + 64\% = 100\% ✓

Result: The qubit has a 36% chance of measuring 0 and a 64% chance of measuring 1.

📐 Mathematical Foundation

LaTeX KaTeX
∣α∣2+∣β∣2=1|\alpha|^2 + |\beta|^2 = 1

What does it mean?

The fundamental normalization condition: the total probability of all possible measurement outcomes must equal 1 (100%).

Understanding the Symbols

Symbol / TermMeaningBeginner Interpretation
∣α∣2|\alpha|^2Probability of measuring ∣0⟩|0\rangleChance of seeing Spin Down (0)
∣β∣2|\beta|^2Probability of measuring ∣1⟩|1\rangleChance of seeing Spin Up (1)

📊 Numerical Example

Verification of state vector [1/sqrt(2), 1/sqrt(2)]^T:

∣1/2∣2+∣1/2∣2=0.5+0.5=1.00✓|1/\sqrt{2}|^2 + |1/\sqrt{2}|^2 = 0.5 + 0.5 = 1.00 ✓

Result: Normalized valid quantum state vector.

⚙️ How Does It Work?

1

Initialization

A qubit starts in a defined state, typically |0⟩ (equivalent to classical 0).

2

Superposition Creation

Quantum gates manipulate the qubit to create superpositions — combinations of |0⟩ and |1⟩.

3

Quantum Operations

While in superposition, quantum algorithms apply operations that work on all possible states simultaneously.

4

Measurement

When measured, the qubit collapses to either |0⟩ or |1⟩ with probabilities determined by |α|² and |β|².

5

Result

After measurement, the qubit is in a definite state (either |0⟩ or |1⟩), and the superposition is destroyed.

🌍 Where Is It Used?

Quantum Algorithms

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.

Quantum Cryptography

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.

Quantum Simulation

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.

🐍 Python Hands-On: Lesson 3: Quantum Measurement with a One-Qubit Circuit

Construct a 1-qubit circuit with Hadamard superposition, measure on Aer simulator, and plot measurement counts using matplotlib.

Open Colab

1Install Required Packages

For Google Colab or Jupyter notebooks, run this shell command to install the required dependencies:

Terminal / Notebook Install Commandbash
!pip install qiskit qiskit-aer matplotlib
Packages:
qiskitqiskit-aermatplotlib

2Import Libraries

Import Statementspython
1from qiskit import QuantumCircuit
2from qiskit_aer import Aer
3from qiskit.visualization import plot_histogram
4import 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.

3Demonstration Code & Logic

Python Execution Codepython
1# Create a quantum circuit with 1 qubit and 1 classical bit
2qc = QuantumCircuit(1, 1)
3
4# Apply Hadamard gate to create superposition
5qc.h(0)
6
7# Measure the qubit
8qc.measure(0, 0)
9
10# Use Qiskit's Aer simulator
11simulator = Aer.get_backend('aer_simulator')
12
13# Run the circuit on the simulator
14job = simulator.run(qc, shots=1000) # 1000 measurements
15result = job.result()
16
17# Get the measurement results
18counts = result.get_counts(qc)
19print(f"Measurement Counts: {counts}")
20
21# Convert dictionary keys and values into lists
22labels = list(counts.keys()) # ['0', '1']
23values = list(counts.values()) # [490, 510]
24colors = ['blue', 'red']
25
26# Plot the bar chart
27plt.bar(labels, values, color=colors)
28plt.xlabel("Measurement Outcome")
29plt.ylabel("Count")
30plt.title("Quantum Measurement Results (Lesson 3)")
31plt.show()
Step-by-Step Code Breakdown:

# 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.

📋 Complete Script (All-in-One)

Click "Copy for Colab", open Google Colab, paste into a single cell, and run.

Google Colab Notebook Scriptpython
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
10from qiskit import QuantumCircuit
11from qiskit_aer import Aer
12from qiskit.visualization import plot_histogram
13import matplotlib.pyplot as plt
14
15# Step 3: Run Demonstration
16# Create a quantum circuit with 1 qubit and 1 classical bit
17qc = QuantumCircuit(1, 1)
18
19# Apply Hadamard gate to create superposition
20qc.h(0)
21
22# Measure the qubit
23qc.measure(0, 0)
24
25# Use Qiskit's Aer simulator
26simulator = Aer.get_backend('aer_simulator')
27
28# Run the circuit on the simulator
29job = simulator.run(qc, shots=1000) # 1000 measurements
30result = job.result()
31
32# Get the measurement results
33counts = result.get_counts(qc)
34print(f"Measurement Counts: {counts}")
35
36# Convert dictionary keys and values into lists
37labels = list(counts.keys()) # ['0', '1']
38values = list(counts.values()) # [490, 510]
39colors = ['blue', 'red']
40
41# Plot the bar chart
42plt.bar(labels, values, color=colors)
43plt.xlabel("Measurement Outcome")
44plt.ylabel("Count")
45plt.title("Quantum Measurement Results (Lesson 3)")
46plt.show()
⚡ How to Run in Google Colab (3 Quick Steps)
  1. Click "Copy for Google Colab" above.
  2. Click Open New Google Colab Notebook (opens in a new tab).
  3. Click on the first empty code cell, press Ctrl + V (or Cmd + V) to paste, then press Shift + Enter to execute!

🔄 Algorithmic Execution Flow

1
Circuit Allocation

Create QuantumCircuit(1, 1) initializing qubit 0 in ground state |0>.

→
2
Apply Hadamard Gate

Transform |0> into equal superposition (|0> + |1>)/sqrt(2).

→
3
Perform Measurement

Collapse quantum wavefunction into classical bit 0 with Born rule probabilities.

→
4
Simulate on Aer Backend

Run 1,000 shots on AerSimulator to observe statistical 50/50 convergence.

→
5
Histogram Visualization

Plot measurement distribution comparing |0> and |1> outcomes.

📥 Input / Initial State
QuantumCircuit(1, 1) with H gate and projective measurement.
📤 Expected Output
Measurement Counts: {'0': 502, '1': 498}
💡 What Does This Demonstration Show?

A single qubit in superposition collapses with 50% probability to outcome 0 and 50% probability to outcome 1, visually verified across 1000 simulated shots.

Course Learning Resource • Slide DeckLesson 311 Slides

Lesson 3: Quantum Measurement with a One-Qubit Circuit

Hadamard, measurement, histogram, and probability collapse in single-qubit quantum systems.

Author: Dr. Syed Muzamil Basha• FDP Approved Curriculum
Open in New Tab

📝 Learning Check

Test your understanding with these questions. Remember, this is for learning, not examination!

Question 1: What is the main difference between a classical bit and a qubit?

Question 2: What does the normalization condition |α|² + |β|² = 1 ensure?

Question 3: If a qubit is in the state |ψ⟩ = (1/√2)|0⟩ + (1/√2)|1⟩, what is the probability of measuring |0⟩?

Question 4: What happens to a qubit's superposition when it is measured?

Question 5: Can we directly observe a qubit while it is in superposition?