Quantum Computing Tutorial: Learn Quantum from Scratch (2026)
Quantum computing is not a faster classical computer — it is a fundamentally different model of computation that exploits superposition, interference, and entanglement. After implementing Shor's algorithm on a simulator and running Bell-state circuits on IBM's superconducting hardware, I can say the learning curve is steep but surmountable with linear algebra and patience.
This tutorial builds intuition from the ground up: qubits, gates, circuits, and algorithms. You will run real circuits on IBM Quantum using Qiskit and understand where quantum advantage actually exists versus where it is marketing hype.
Qubits and the Bloch Sphere
A classical bit is either 0 or 1. A qubit is a vector in a 2-dimensional complex Hilbert space: |ψ⟩ = α|0⟩ + β|1⟩, where |α|² + |β|² = 1. When measured, the qubit collapses to |0⟩ with probability |α|² or |1⟩ with probability |β|².
The Bloch sphere represents a single qubit's state as a point on a unit sphere. The north pole is |0⟩, the south pole is |1⟩, and every other point is a superposition. Gates are rotations on this sphere. The Hadamard gate (H) rotates from a pole to the equator, creating equal superposition.
from qiskit import QuantumCircuit
qc = QuantumCircuit(1)
qc.h(0)
qc.save_statevector()
from qiskit_aer import AerSimulator
sim = AerSimulator()
result = sim.run(qc).result()
sv = result.get_statevector(qc)
print(f'Amplitudes: {sv}')
Quantum Gates and Universality
Quantum gates are unitary operators (U†U = I) applied to qubits. The single-qubit gates include Pauli X (NOT), Y, Z, Hadamard (H), phase (S, T). The CNOT (CX) gate is the canonical two-qubit entangling gate: it flips the target qubit if the control qubit is |1⟩.
A set of gates is universal if any quantum operation can be approximated by a sequence of those gates. The standard universal set is {H, S, CX, T}. In practice, IBM hardware uses a different native gate set and the compiler decomposes your circuit automatically.
# Bell state: the simplest entangled circuit
qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.measure([0, 1], [0, 1])
from qiskit.primitives import Sampler
result = Sampler().run(qc).result()
print(f'Counts: {result.quasi_dists}')
Entanglement and Bell Tests
Entanglement is a correlation between qubits that cannot be explained by classical probability. When two qubits are maximally entangled (Bell state), measuring one instantaneously determines the outcome of the other — regardless of distance. Einstein called this 'spooky action at a distance,' but it does not allow faster-than-light communication.
Bell's theorem proves that no local hidden variable theory can reproduce all quantum mechanical predictions. In practice, CHSH games are used to certify that a quantum device is truly generating entanglement. A score above 2 proves non-locality.
# CHSH game circuit
def chsh_circuit(theta):
qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.ry(theta, 0)
qc.ry(theta, 1)
qc.measure_all()
return qc
for th in [0, 3.14/4, 3.14/2, 3*3.14/4]:
counts = Sampler().run(chsh_circuit(th)).result().quasi_dists[0]
print(f'theta={th:.2f}: {counts}')
Grover's Search Algorithm
Grover's algorithm searches an unsorted database of N items in O(√N) steps — a quadratic speedup over the best classical algorithm (O(N)). It works by amplitude amplification: repeatedly applying an oracle that marks the target state and a diffusion operator that amplifies marked amplitudes.
For N = 4 (2 qubits), Grover finds the target in exactly 1 iteration. For larger N, the optimal number of iterations is approximately π√N/4. More iterations overshoot and reduce probability.
from qiskit.algorithms import Grover, AmplificationProblem
oracle = QuantumCircuit(2)
oracle.cz(0, 1)
problem = AmplificationProblem(oracle, is_good_state=['11'])
grover = Grover()
result = grover.amplify(problem)
print(f'Top measurement: {result.top_measurement}')
Noise, Error Correction, and NISQ
Today's quantum computers are NISQ (Noisy Intermediate-Scale Quantum) devices with 50-1000 noisy qubits. Qubits decohere in microseconds. Gate fidelities are 99-99.9% — good, but not good enough for deep circuits. Error correction codes (like the surface code) require thousands of physical qubits to encode one logical qubit.
Working with noise means you must use error mitigation techniques: measurement error correction, dynamical decoupling, and zero-noise extrapolation. Qiskit's Estimator primitive includes built-in error mitigation options.
from qiskit_ibm_runtime import Estimator, Options
options = Options()
options.resilience_level = 2
options.optimization_level = 3
estimator = Estimator(session=backend, options=options)
job = estimator.run(circuits=[qc], observables=[observable])
result = job.result()
print(f'Expectation value: {result.values}')
Where Quantum Advantage Exists
As of 2026, quantum advantage has been demonstrated for: simulating quantum chemistry (molecular ground state energies), factoring large integers (Shor's algorithm, though only for small numbers so far), and certain optimization problems (QAOA for MaxCut on specific graph topologies). Cryptography, drug discovery, and finance remain aspirational rather than practical.
The honest assessment: no quantum computer today can break RSA-2048 or solve a real-world logistics problem faster than a classical heuristic. Practical quantum advantage for commercial applications is still 5-10 years out.
from qiskit.algorithms import Shor
shor = Shor()
result = shor.factor(15)
print(f'Factors of 15: {result.factors}')
Frequently Asked Questions
Will quantum computers replace classical computers?
No. Quantum computers excel at specific problems but are slower than classical computers for general-purpose tasks. The future is hybrid: classical machines running most code, offloading quantum kernels to QPUs when beneficial.
How many qubits do I need to run useful algorithms?
Useful quantum error correction requires thousands of logical qubits, which translates to millions of physical qubits. Current devices have ~1000 physical qubits. For NISQ applications without full error correction, 200+ high-fidelity qubits can demonstrate useful chemistry simulations.
What programming languages are used for quantum computing?
Python is dominant (Qiskit, Cirq, Pennylane). Q# (Microsoft) and Julia (Yao.jl) are alternatives. The code is classical Python that builds and submits quantum circuits to simulators or hardware.
How do I get started with real quantum hardware?
IBM Quantum offers free access to its machines through IBM Cloud. Sign up for an IBM Quantum account, get your API token, and run circuits via Qiskit. AWS Braket provides access to IonQ, Rigetti, and D-Wave hardware on a pay-per-task model.
Originally published on Ayodhyyya. Last updated June 1, 2026.