Quick Reference
Cheatsheet
Core Concepts
Qubit
Quantum bit. Can be |0⟩, |1⟩, or superposition of both.
Superposition
Qubit in multiple states simultaneously: α|0⟩ + β|1⟩
Entanglement
Qubits correlated so measuring one affects the other instantly.
Measurement
Collapses superposition to |0⟩ or |1⟩. Probabilistic outcome.
Common Gates
Gate
Qiskit
Action
X (NOT)
qc.x(0)
Flip |0⟩ ↔ |1⟩
H (Hadamard)
qc.h(0)
Create superposition
CNOT
qc.cx(0, 1)
Flip target if control = |1⟩
Z
qc.z(0)
Phase flip (|1⟩ → -|1⟩)
RY(θ)
qc.ry(θ, 0)
Rotate around Y-axis
Measure
qc.measure(0, 0)
Collapse and read qubit
Qiskit at a Glance
# Setup
from qiskit import QuantumCircuit
from qiskit_aer import AerSimulator
from qiskit.visualization import plot_histogram
# Create circuit with 2 qubits, 2 classical bits
qc = QuantumCircuit(2, 2)
# Add gates
qc.h(0) # Hadamard on qubit 0
qc.cx(0, 1) # CNOT: control=0, target=1
qc.measure([0,1], [0,1])
# Draw the circuit
qc.draw('mpl')
# Run simulation
simulator = AerSimulator()
job = simulator.run(qc, shots=1000)
result = job.result()
counts = result.get_counts()
# Plot results
plot_histogram(counts)Key Formulas
Qubit State
|ψ⟩ = α|0⟩ + β|1⟩ where |α|² + |β|² = 1
Measurement Probability
P(0) = |α|², P(1) = |β|²
Bell State
|Φ+⟩ = (|00⟩ + |11⟩) / √2
Grover Iterations
Optimal iterations ≈ (π/4)√N
Common Patterns
Create Superposition
qc.h(0)Create Bell State
qc.h(0); qc.cx(0,1)Flip a Qubit
qc.x(0)Measure All
qc.measure_all()