Quantum

How Quantum Computers Work

By CourseTron Team ·  6 min read ·  Updated Oct 2026 💬 𝕏 in f
Table of Contents
    ? Print / Save as PDF

    In short: A quantum computer prepares qubits in a known state, spreads them into superposition, applies a short sequence of gates that steer amplitudes so wrong answers cancel and right answers reinforce, then measures to collapse the result into classical bits, repeating the run many times to read out probabilities.

    The five-stage pipeline

    Interviewers rarely want the Hilbert-space lecture. They want you to walk a run from start to finish and say what physically happens at each step. If you are new to the basics, start with what is quantum computing; here we follow one algorithm execution end to end.

    Anatomy of one quantum algorithm run 1. Initialise2. Superpose3. Gates4. Interfere5. Measure reset to |0…0⟩Hadamardsoracle, CNOTsamplitudes addcollapse to bits T1 relax / laserequal amplitudesphase taggingor cancelrepeat 1000 shots Quantum part: stages 1 to 4 (coherent, no peeking) | Classical part: stage 5 and post-processing CourseTron · coursetron.com
    The pipeline every gate-model algorithm follows, from reset to readout.

    Stage 1: initialising qubits

    Every run starts from a known state, almost always |0⟩ on every qubit. On superconducting chips (IBM, Google) this means waiting several multiples of T1, the energy-relaxation time, which is typically 100 to 300 microseconds on current devices, or using active reset with a measurement and a conditional pulse. On trapped ions, optical pumping with a laser drives each ion into its ground state with over 99.9% fidelity. A register of n qubits in |0…0⟩ is a single basis state out of 2n; nothing quantum is happening yet.

    Key fact: n qubits are described by 2n complex amplitudes. 50 qubits means about 1015 amplitudes, which is why classical state-vector simulators run out of memory near 45 to 50 qubits.

    Stage 2: superposition with Hadamard gates

    A Hadamard gate maps |0⟩ to (|0⟩+|1⟩)/√2. Applying H to all n qubits produces an equal superposition of all 2n basis states, each with amplitude 1/√2n. This is not "trying every answer in parallel and reading them all out." Measuring now would just give a random bit string. The value of superposition is that the following gates act on every amplitude at once, so you can manipulate a huge vector with a short circuit.

    Stage 3: gate sequences and entanglement

    Single-qubit gates (X, Z, H, rotations Rx, Ry, Rz) are unitary 2x2 matrices. Two-qubit gates such as CNOT or CZ create entanglement. The textbook example is a Bell pair: H on qubit 0, then CNOT with qubit 0 as control, gives (|00⟩+|11⟩)/√2. Neither qubit has a definite value alone, yet the two outcomes are perfectly correlated.

    from qiskit import QuantumCircuit
    qc = QuantumCircuit(2, 2)
    qc.h(0)          # superposition
    qc.cx(0, 1)      # entangle
    qc.measure([0, 1], [0, 1])
    # 1000 shots -> roughly 500 "00" and 500 "11", never "01" or "10"

    Hardware reality matters in interviews. A single-qubit gate takes about 20 to 50 ns, a two-qubit gate 100 to 500 ns, with two-qubit error rates around 0.1% to 1%. The compiler (Qiskit transpiler, Cirq) must map your logical circuit onto the chip's connectivity, inserting SWAPs, and decompose gates into the native set. Circuit depth is limited by decoherence: if T2 is 100 µs and a layer costs 300 ns, you have only a few hundred layers before noise wins.

    Stage 4: interference does the real work

    Amplitudes are complex numbers that can be negative. An oracle flips the sign (phase) of the amplitude on the correct answer without changing probabilities. A second operation, such as Grover's diffusion operator (reflection about the mean), converts that hidden sign difference into a visible amplitude difference. Wrong paths destructively interfere, the right path constructively interferes.

    Grover search, N = 4: one iteration is enough After H and oracle After diffusion +0.5+0.5+0.5-0.5 0001.0 00011011 (target) 00011011 Mean = 0.25, reflection about the mean: 2(0.25) - 0.5 = 0 and 2(0.25) + 0.5 = 1 CourseTron · coursetron.com
    Before: amplitudes are equal, one carries a negative sign. After: all probability sits on the marked state.

    For N = 4 a single Grover iteration lands on the target with probability 1. For general N = 2n you need about (π/4)√N iterations; over-rotating makes the answer worse again. Shor's algorithm uses the same idea differently: a quantum Fourier transform makes amplitudes of the period of a modular function interfere into sharp peaks.

    Stage 5: measurement and repeated shots

    Measurement projects the state onto a basis state with probability equal to the squared amplitude magnitude (the Born rule). You get one classical bit string and the superposition is gone. So every real run is executed 1,000 to 10,000 times ("shots"), and you read the answer from the histogram. Readout is itself imperfect, with 1% to 5% error per qubit, so error mitigation corrects the histogram afterwards.

    Animated: |0⟩ through H, then measured |0⟩ H Meter certain 0 50% / 50% random 0 or 1 P(0) 1.0 → 0.5 CourseTron · coursetron.com
    The qubit moves left to right: certain, then balanced after H, then a single random outcome at measurement.

    Key fact: Quantum speedup comes from interference, not from reading out all branches. If your explanation never mentions amplitudes cancelling, an interviewer will assume you described a lookup table.

    Putting it together: a comparison table

    StageOperationTypical hardware costMain failure mode
    InitialiseReset to |0…0⟩about 1 µs (active), 500 µs (passive)Thermal residual excitation
    SuperposeH on each qubit20 to 50 nsControl pulse miscalibration
    GatesOracle, CNOT/CZ100 to 500 ns per 2-qubit gateGate error 0.1% to 1%
    InterfereDiffusion, QFTMany layers deepDecoherence (T1, T2)
    MeasureProjective readout0.5 to 2 µsReadout error 1% to 5%

    Behind this sits a classical stack: microwave pulse generators, FPGAs for real-time feedback, and cryogenic control ASICs. That electronics is designed with the same tools as any mixed-signal SoC, using Cadence Virtuoso and Synopsys flows. If you want to build such control chips, ChipXpert VLSI training covers the design side. Error correction, the next big step, is covered in quantum error correction explained: a surface code may need roughly 1,000 physical qubits per logical qubit.

    How to answer in an interview

    • State the five stages in order and give one number for each (reset time, gate time, shots).
    • Use a tiny worked example: Bell state for entanglement, N = 4 Grover for interference.
    • Say plainly that measurement is destructive and answers are probabilistic, hence repeated shots.
    • Name the limit: depth is capped by T2 and gate error, which is why today's devices are called NISQ.

    Ready to go deeper? Build and run these circuits yourself in the hands-on modules on our CourseTron courses page, and practise interview-style walkthroughs with feedback.

    FAQ

    Does a quantum computer try all answers at once?

    No. It holds amplitudes for all answers, but measurement returns only one. Algorithms are designed so interference concentrates probability on the correct answer before you measure.

    Why are circuits run thousands of times?

    Measurement is probabilistic and destructive, and hardware is noisy. Collecting 1,000 or more shots gives a histogram from which the most likely outcome and its confidence can be estimated.

    What limits circuit depth today?

    Decoherence times (T1, T2 around 100 µs on superconducting qubits) and gate errors of 0.1% to 1%. Errors accumulate multiplicatively, so a few hundred two-qubit gates already degrade results.

    Which programming tools should I learn first?

    Qiskit (IBM) and Cirq (Google) are the most common. Both let you build circuits, simulate them on a classical machine, and submit them to real hardware.

    Advertisement