Quantum computing is a type of computation that uses quantum-mechanical phenomena, such as superposition and entanglement, to perform calculations that are exponentially faster than classical computers for specific tasks. While classical computers use bits (0 or 1), quantum computers use qubits that can exist in multiple states simultaneously.

A common misunderstanding is that quantum computers simply try every possible answer at once to find the right one. In reality, they use interference to cancel out wrong answers and amplify the correct one, similar to how noise-canceling headphones eliminate sound waves.

What Is a Qubit and How Does It Work?

A qubit, or quantum bit, is the basic unit of quantum information. Unlike a classical bit, which is a physical switch that is either on or off, a qubit is typically a subatomic particle like an electron or a photon.

The state of a qubit is described as a linear combination of two basis states, denoted as |0⟩ and |1⟩ in Dirac notation. This means a qubit can be in state |0⟩, state |1⟩, or any superposition of both. When you measure a qubit, it collapses into one of the two basis states based on the probability amplitudes assigned to each.

The physical implementation of a qubit changes how it is manipulated and how stable it remains. Different hardware approaches lead to different error rates and operational temperatures.

Qubit Type Physical Medium Operating Temperature Primary Challenge
Superconducting Josephson junctions Near absolute zero (mK) Decoherence/Noise
Trapped Ion Electromagnetic fields Room temp or Cryogenic Gate speed
Photonic Light particles Room temperature Qubit interaction
Topological Anyons/Braiding Near absolute zero (mK) Experimental stability

How Do Superposition and Entanglement Scale Power?

Superposition allows a quantum computer to hold a vast amount of information. If you have 1 classical bit, you have 1 piece of information (0 or 1). If you have 2 classical bits, you can represent one of four possible states (00, 01, 10, or 11) at any single moment.

With 2 qubits in superposition, the system represents all four states simultaneously. The capacity grows exponentially: $2^n$ states for $n$ qubits. For example, 300 qubits can represent more states than there are atoms in the observable universe.

Entanglement is a quantum correlation where the state of one qubit is tied to the state of another, regardless of the distance between them. If two qubits are entangled in a Bell state, measuring one immediately tells you the state of the other. This allows qubits to work in unison rather than as isolated switches, enabling the complex coordination required for quantum algorithms.

The Role of Quantum Interference

Interference is the mechanism used to extract a useful answer from a superposition. Quantum algorithms use constructive interference to increase the probability of the correct output and destructive interference to decrease the probability of incorrect outputs. Without interference, measuring a superposition would simply yield a random result from the set of possibilities.

What Are Quantum Gates and Circuits?

Quantum gates are the building blocks of quantum circuits, acting as operations that rotate the state of a qubit on a mathematical sphere called the Bloch Sphere. Unlike classical logic gates (AND, OR, NOT), all quantum gates must be reversible.

Single-Qubit Gates

The Pauli-X gate acts as the quantum NOT gate, flipping |0⟩ to |1⟩ and vice versa. The Hadamard gate (H) is perhaps the most critical, as it puts a qubit into a perfect superposition of |0⟩ and |1⟩, creating a 50% probability for either result upon measurement.

Multi-Qubit Gates

The CNOT (Controlled-NOT) gate is the primary tool for creating entanglement. It flips the state of a target qubit only if a control qubit is in the state |1⟩. By combining a Hadamard gate on one qubit and a CNOT gate on a second, you create a Bell pair, the simplest form of entanglement.

A quantum circuit is a sequence of these gates. Because qubits are fragile, the depth of a circuit (the number of gates in a sequence) is limited by the coherence time—the duration a qubit can maintain its quantum state before interacting with the environment and losing its information.

How Does Shor's Algorithm Work?

Shor's algorithm is a quantum algorithm for integer factorization. It can find the prime factors of a large composite number significantly faster than any known classical algorithm. This has major implications for RSA encryption, which relies on the difficulty of factoring large numbers.

The algorithm does not "guess" the factors. Instead, it converts the factoring problem into a problem of finding the period of a specific mathematical function. Finding the period of a function is a task where quantum computers excel because they can use the Quantum Fourier Transform (QFT) to identify the frequency of the function across all possible inputs simultaneously.

Factoring 15

To factor the number 15 using the logic of Shor's algorithm:

  1. Pick a random number $a$ that is smaller than 15 and coprime to 15 (e.g., $a = 7$).
  2. Find the period $r$ of the function $f(x) = a^x \pmod{15}$. This means finding the smallest $r$ such that $7^r \pmod{15} = 1$.
  3. Calculate the sequence: $7^1 \pmod{15} = 7$; $7^2 \pmod{15} = 4$; $7^3 \pmod{15} = 13$; $7^4 \pmod{15} = 1$. The period $r$ is 4.
  4. Use the period to find the factors using the greatest common divisor (GCD) formula: $\text{GCD}(a^{r/2} \pm 1, 15)$.
  5. $\text{GCD}(7^{4/2} - 1, 15) = \text{GCD}(48, 15) = 3$.
  6. $\text{GCD}(7^{4/2} + 1, 15) = \text{GCD}(50, 15) = 5$.
  7. The prime factors of 15 are 3 and 5.

While a classical computer can do this for 15, a quantum computer uses the QFT to find the period $r$ for numbers with hundreds of digits in a fraction of the time.

Why Do Quantum Computers Have High Error Rates?

Quantum states are extremely sensitive to their environment, a phenomenon known as decoherence. Any interaction with heat, electromagnetic radiation, or air molecules can cause a qubit to lose its superposition and collapse into a classical state.

This leads to "bit-flip" errors (where |0⟩ becomes |1⟩) and "phase-flip" errors (where the mathematical sign of the superposition changes). Because you cannot measure a qubit without collapsing it, you cannot use classical error correction (which involves copying the data).

To solve this, researchers use Quantum Error Correction (QEC). This involves spreading the information of one "logical qubit" across many "physical qubits." By checking the parity of these physical qubits using auxiliary qubits, the system can detect and fix errors without measuring the actual data stored in the logical qubit.

The ratio of physical to logical qubits is typically high. Depending on the hardware and the required accuracy, it may take 100 to 1,000 physical qubits to create a single stable logical qubit. This is why a machine with 433 physical qubits is not yet capable of breaking modern encryption, which would require thousands of stable logical qubits.