This repository contains a Jupyter Notebook demonstrating quantum superposition and entanglement using Qiskit, a Python framework for quantum computing. The notebook provides hands-on examples to help students understand fundamental quantum computing concepts.
Qiskit_Superposition_Entanglement.ipynbβ Main notebook demonstrating:- Superposition of a single qubit.
- Entanglement (Bell state) of two qubits.
The notebook is divided into three main parts:
Installs the required packages:
!pip install qiskit
!pip install qiskit-aerImports the necessary modules from Qiskit and visualization tools:
from qiskit import QuantumCircuit, Aer, execute
from qiskit.visualization import plot_histogram, plot_bloch_multivector
from qiskit.quantum_info import Statevector
import matplotlib.pyplot as plt- Creates a single qubit circuit.
- Applies a Hadamard (H) gate to place the qubit in superposition.
- Measures the qubit and plots the histogram of outcomes.
- Visualizes the state on the Bloch sphere.
- Creates a 2-qubit circuit.
- Applies H to the first qubit, then CNOT to entangle both qubits.
- Measures both qubits and plots the histogram.
- Shows the statevector of the entangled qubits.
After exploring the notebook, students can try these small tasks:
- Create a single qubit circuit.
- Apply a Hadamard gate.
- Measure and plot the histogram.
- Observe equal probabilities for
0and1.
- Create a 2-qubit circuit.
- Apply H to qubit 0, then CNOT (0β1).
- Measure and plot the histogram.
- Observe correlated outcomes (
00or11).
The notebook includes visualizations for:
- Bloch sphere β Shows the qubit state for superposition.
- Histogram β Shows measurement probabilities for superposition and entangled states.
- Clone the repository:
git clone <repository-url>- Open the notebook
Qiskit_Superposition_Entanglement.ipynbin Jupyter Notebook, JupyterLab, or VS Code. - Run the cells step by step to explore superposition, entanglement, and perform student tasks.