Hands-on labs
56 labs with automatic grading. Each lab belongs to a lesson; work through the lesson first.
Complex Numbers & Euler's Formula
- Multiply by a phase1 step · best score 0/100
Compute in Cartesian form, using Euler's formula and polar multiplication.
Complex Vector Spaces $\mathbb{C}^n$
- Coordinates in the ± basis1 step · best score 0/100
Express in the basis of .
Inner Products, Norms & Gram–Schmidt
- Gram–Schmidt in C^31 step · best score 0/100
Orthonormalise and with Gram–Schmidt, using the conjugate-linear inner product .
Dirac Bra–Ket Notation & Outer Products
- Build a rank-one projector1 step · best score 0/100
Write the matrix of using .
Linear Operators & Matrix Representations
- Hadamard in the ± basis1 step · best score 0/100
Represent the Hadamard operator in the ordered basis using matrix elements .
Hermitian & Unitary Operators
- Spectrum of a Hermitian matrix2 steps · best score 0/100
Diagonalise the Hermitian matrix : find its real eigenvalues from the characteristic polynomial, then the normalised eigenvector for the largest eigenvalue.
Spectral Theorem & Functions of Operators
- Exponentiate a Pauli generator1 step · best score 0/100
Use to sum the power series of in closed form and write the matrix of .
Tensor (Kronecker) Products
- Build the product state |+⟩ ⊗ |1⟩1 step · best score 0/100
Use single-qubit gates only to prepare on two qubits, and see why the Kronecker order (qubit is the left factor) decides which qubit gets which gate.
Postulate 1: State Space & Global Phase
- Prepare exactly |−⟩ (global phase included)1 step · best score 0/100
Prepare the exact vector from . Physically is the same state, but this lab compares vectors component by component, so the global phase must be .
Postulate 2: Unitary Evolution & the Schrödinger Equation
- Rabi evolution as a rotation1 step · best score 0/100
Solve the Schrödinger equation for (with ): . Set the rotation angle for and reproduce the exact state, phases included.
Postulate 3: Projective Measurement & the Born Rule
- Hit three expectation values1 step · best score 0/100
Use , , to prepare a qubit with , , .
Postulate 4: Composite Systems
- Build a product-state joint distribution1 step · best score 0/100
Prepare a product state whose joint distribution is , , using the factorisation and the big-endian ordering (qubit 0 is the leftmost bit).
Density Operators: Pure vs Mixed
- Bloch vector and purity of a mixed qubit1 step · best score 0/100
Read the Bloch vector with and the purity directly off the entries of a density matrix, using the Bloch-ball form .
Partial Trace & Reduced States
- Purify a mixed qubit1 step · best score 0/100
Prepare a two-qubit pure state whose reduced state on qubit 0 is the mixed state . Mixedness of a marginal cannot come from a single-qubit gate: it must come from entanglement with qubit 1.
Von Neumann & Entanglement Entropy
- Hit entanglement-entropy targets2 steps · best score 0/100
Compute the entanglement entropy of a Schmidt state from its Schmidt coefficients, then prepare a three-qubit state whose marginals , and each carry exactly one bit of entropy. All entropies are in bits; qubit 0 is the leftmost bit.
The Qubit
- Normalise a qubit state1 step · best score 0/100
Normalise and read off its Born probability .
The Bloch Sphere
- Hit the target on the Bloch sphere2 steps · best score 0/100
Place the state on the Bloch sphere, first by choosing directly and then by preparing it from with at most two gates from .
Pauli Gates & the Pauli Algebra
- Pauli products and the Pauli decomposition2 steps · best score 0/100
Multiply two Pauli matrices by hand to see (and why the order matters), then expand a Hermitian matrix in the Pauli basis using .
Hadamard, S and T Gates
- Build X from H and S1 step · best score 0/100
Implement the bit flip on one qubit, up to a global phase, using only the Hadamard gate and the phase gate , with at most four gates.
Rotation Gates & ZYZ Euler Decomposition
- Prepare a Bloch state with R_Y and R_Z1 step · best score 0/100
Use the identity to prepare the state with Bloch angles , from with at most two rotation gates.
Controlled Gates: CNOT, CZ, SWAP
- SWAP from three CNOTs1 step · best score 0/100
Build the two-qubit SWAP gate, which exchanges the states of the two wires, using only CNOT gates and at most three of them.
Toffoli, Reversible Logic & Universality
- Decompose the Toffoli gate1 step · best score 0/100
Build the Toffoli gate (controls , target ) on three qubits from the Clifford+ set with at most six CNOTs and fifteen gates in total.
Entanglement & the Bell States
- Prepare the singlet state1 step · best score 0/100
Starting from , prepare the singlet with at most four gates from . The grader checks the state fidelity and, separately, the perfectly anti-correlated measurement statistics, so it can tell a wrong relative sign from a wrong pair of basis states.
The No-Cloning Theorem
- How good is the CNOT copier?2 steps · best score 0/100
The CNOT gate maps and , so it copies basis states perfectly. Compute its copy fidelity for the superpositions and .
Quantum Teleportation
- Teleport a qubit2 steps · best score 0/100
Teleport the state from Alice's qubit to Bob's qubit through the pre-shared pair . First implement the protocol with the corrections moved before measurement (principle of deferred measurement), then with real mid-circuit measurements and classically conditioned corrections. The grader compares Bob's reduced density matrix with in trace distance.
Superdense Coding
- Send the message 11 with one qubit1 step · best score 0/100
Alice (qubit ) and Bob (qubit ) share , prepared by a locked . Encode the two-bit message with Pauli gates on Alice's qubit only, then decode with the inverse Bell circuit so that the register ends in . The grader checks the joint distribution and each bit separately, so it can tell which of the two bits went wrong.
The Deutsch–Jozsa Algorithm
- Deutsch–Jozsa with one oracle query1 step · best score 0/100
Surround a black-box oracle with gates from so that a single query decides whether is constant or balanced. The grader runs your circuit four times, once for each of the oracles , , and , and inspects the measurement distribution of the two input qubits.
The Quantum Fourier Transform
- Build the three-qubit QFT1 step · best score 0/100
Build the quantum Fourier transform on three qubits, , from Hadamard gates, controlled-phase gates and one SWAP, using at most seven gates.
Quantum Phase Estimation
- Three-bit phase estimation of a phase gate1 step · best score 0/100
Complete a three-qubit phase-estimation circuit around the controlled powers , , of a black-box phase gate , whose eigenvector is with eigenvalue . For the phase is . The grader substitutes , , and and requires the counting register to read with with certainty.
Grover's Search & Amplitude Amplification
- Grover search on three qubits1 step · best score 0/100
Build Grover's algorithm for items and one marked item : the uniform superposition followed by two iterations of the phase oracle and the diffuser . The grader substitutes three different oracles (, , ) into the placeholder and requires the distribution with , every other outcome having probability .
The HHL Algorithm for Ax = b
- HHL on a 2×2 system2 steps · best score 0/100
Solve for and with the HHL algorithm on four qubits: read the clock values produced by phase estimation, then choose the controlled- angles that divide each eigencomponent by its eigenvalue, so that post-selection yields .
Supervised Learning & Gradient Descent
- Gradient of the mean-squared error1 step · best score 0/100
Implement the vectorised gradient of the mean-squared-error loss of a linear model, namely and with residuals . The function is graded on one visible worked example and five hidden random problems with up to samples and features, to absolute tolerance .
Kernel Methods & Support Vector Machines
- The RBF Gram matrix1 step · best score 0/100
Implement the Gram matrix of the Gaussian (RBF) kernel, the matrix that the SVM dual and every kernel method consume. The grader checks your values on a visible three-point example and on three hidden sets of random points in (), and verifies the two structural properties that every valid Gram matrix has: symmetry and positive semidefiniteness.
RKHS, Representer & Mercer's Theorem
- The feature space of a polynomial kernel1 step · best score 0/100
Read off the explicit feature space of the inhomogeneous quadratic kernel on and evaluate the kernel at a pair of points, confirming that the kernel trick and the explicit inner product give the same number.
Basis Encoding
- Basis-encode the bit string 10111 step · best score 0/100
Prepare the basis encoding of the bit string on four qubits, using at most three gates. Qubit 0 is the leftmost (most significant) bit, so the target is the basis vector with index of .
Amplitude Encoding & State Preparation
- Amplitude-encode the vector (1, 2, 3, 4)1 step · best score 0/100
Prepare the amplitude encoding of on two qubits with at most five gates from : one rotation for the split on qubit and a uniformly controlled on qubit , compiled into two rotations and two CNOTs.
Angle & Phase Encoding
- Angle-encode a two-feature datum1 step · best score 0/100
Write the angle-encoding feature map for a datum as a circuit that uses the data symbols , so that it works for every datum. The grader re-binds the symbols to three data points and checks and on both qubits.
Hamiltonian-Evolution Encoding & Trotterisation
- Compile the ZZ evolution from CNOT and RZ1 step · best score 0/100
Implement the two-qubit evolution exactly, using at most three gates from . This is the elementary building block of every diagonal (IQP-type) feature map, including the ZZ feature map of Havlíček et al.
Quantum Kernels & Fidelity Kernels
- Evaluate a quantum kernel entry1 step · best score 0/100
Compute one entry of a quantum kernel matrix by hand: the fidelity kernel of the two-qubit product encoding at and , using the closed form derived in the lesson.
The SWAP Test
- Build the SWAP test1 step · best score 0/100
Build the SWAP test on three qubits and read the fidelity of two one-qubit states from the ancilla alone: with and the overlap is , so the ancilla must return with probability .
The Inversion (Compute–Uncompute) Test
- Build the inversion test of an angle-encoding kernel1 step · best score 0/100
Build the compute–uncompute circuit of the two-qubit product encoding for and with gates only, and read the kernel value off the probability of the outcome .
End-to-End Quantum-Kernel SVM
- Quantum-kernel SVM on two moons2 steps · best score 0/100
Build the complete quantum-kernel classifier of the lesson in Python. First implement the fidelity kernel of the two-qubit ZZ feature map with one repetition by simulating its circuit with NumPy; the grader compares your matrices with the platform's statevector engine and checks symmetry and positive semidefiniteness. Then train scikit-learn's
SVC(kernel="precomputed", C=1.0)on the training Gram matrix of the two-moons data scaled to and predict the held-out points; the grader computes the test accuracy from your predictions and requires at least (the reference pipeline reaches ).
Variational Quantum Circuits: Architecture
- Train a one-qubit variational classifier1 step · best score 0/100
The circuit with observable is the smallest variational quantum classifier: feature map , ansatz , model output and prediction . Choose the single weight so that all four training points are classified correctly.
Hardware-Efficient Ansatz
- Train a hardware-efficient ansatz to GHZ1 step · best score 0/100
The circuit is a fixed hardware-efficient ansatz on qubits with layers: in each layer every qubit gets then , followed by the CNOT ladder , . All angles start at , where the circuit outputs . Choose angle values so that the output is the GHZ state , using the identity-at-zero and basis-state tracking arguments of the lesson.
Strongly Entangling Layers
- Build strongly entangling layers1 step · best score 0/100
Implement PennyLane-convention strongly entangling layers as a list of Circuit-IR operations: on every wire the general rotation , then the cyclic CNOT block with the layer-dependent range . The grader compares the unitary of your circuit with the reference unitary on weight tensors of shapes , , and , requiring process fidelity at least .
Matrix Product States & Sequential Circuits
- Prepare the W state and measure its entanglement2 steps · best score 0/100
The three-qubit W state has bond dimension at both cuts, so a short sequential circuit prepares it. In the first step you build such a circuit from , , controlled- and CNOT gates. In the second step you compute the entanglement entropy of one qubit from its Schmidt spectrum.
Why Backpropagation Fails on Quantum Hardware
- Shot-noise variance of gradient estimators1 step · best score 0/100
Compare the two gradient estimators available on quantum hardware for of the state : the central finite difference with step and the parameter-shift rule. Both use two circuit evaluations of shots; you compute the exact shot-noise variance of each and see a factor between them.
The Parameter-Shift Rule
- Gradients with the parameter-shift rule1 step · best score 0/100
Implement the parameter-shift gradient of a variational circuit using only a black-box
evaluate(params)that returns the exact expectation value . Every parameter sits in a single Pauli rotation , so is exact. The grader checks the values on one visible and four hidden random three-qubit circuits, separately checks that your function callsevaluateexactly times, and finally checks that the values are exact to , which no finite-difference quotient achieves.
Quantum Natural Gradient & the Fubini–Study Metric
- The Fubini–Study metric and one natural-gradient step2 steps · best score 0/100
Compute the Fubini–Study metric of the single-qubit model at , then use it to take one quantum-natural-gradient step on the loss and compare it with the vanilla gradient step.
Barren Plateaus
- Global versus local costs on a barren plateau2 steps · best score 0/100
Quantify the barren plateau of the exactly solvable product model on . First compute the exact gradient variances of the global cost and the local cost at ; then estimate them by Monte Carlo from a black-box cost function, using the parameter-shift rule with exactly two circuit evaluations per random parameter vector.
Noise, Decoherence, $T_1$ and $T_2$
- Amplitude damping, T1 decay and engineered dephasing2 steps · best score 0/100
Compute the energy-relaxation probability of an idling qubit and its surviving excited population, then build a one-qubit noisy circuit that prepares the mixed state from with one gate and noise channels simulated on the density-matrix backend.
Error Mitigation: ZNE & Readout Correction
- Zero-noise extrapolation with Richardson weights1 step · best score 0/100
An expectation value was measured at the noise scale factors produced by global unitary folding. Combine the three measurements with the Richardson (Lagrange) weights into an estimate of the noiseless value .
- Readout-error mitigation by confusion-matrix inversion1 step · best score 0/100
A qubit's readout flips with probability and with probability . Undo this classical noise on a measured distribution by inverting the confusion matrix.
Quantum Convolutional Neural Networks
- Train a QCNN to tell horizontal from vertical bars1 step · best score 0/100
Train the 4-qubit quantum convolutional neural network of the lesson, with shared weights, on images of horizontal and vertical bars. Your TypeScript function receives training images and returns the weights
p0top11. You write the loss, the gradient and the optimiser. For the gradient, the engine'sparameterShiftGradientapplies the two-term rule to the weights and the four-term rule to the / pooling weights. The grader binds your weights into the fixed QCNN circuit and classifies held-out images by ; at least must be correct.
Quantum Reservoir Computing
- Train the ridge readout of a quantum reservoir1 step · best score 0/100
The -qubit quantum reservoir of the lesson is fixed: its Ising Hamiltonian, the input injection on qubit and the virtual nodes per input are never trained. Only the linear readout is learned. Your TypeScript function receives the feature matrix of the training window (the expectation values plus a bias column) and the targets of a short-term memory task, and returns the ridge-regression weights . The grader recomputes the reservoir and scores your weights on unseen time steps: recalling the input of one step ago must reach , recalling the input of two steps ago .
Capstone: Data Re-uploading Hybrid Classifier
- Capstone: train a data re-uploading classifier on the circle1 step · best score 0/100
The capstone of the course: train the two-qubit data re-uploading classifier of the lesson to tell points inside a circle from points outside it. Your TypeScript function receives labelled training points, chooses the depth , computes the gradient with your own parameter-shift rule, runs an optimiser of your choice and returns the trained weights. The grader binds them into the chosen circuit and classifies held-out points by ; at least must be correct.