Kryentech logo Electrical engineering article

How does a quantum computer work?

Qubits, superposition, entanglement, quantum gates and algorithms explained clearly and with technical accuracy

Illustration of qubits, superposition, entanglement and Shor's algorithm
Quantum computers use controlled quantum states. They are not simply faster classical computers.

Quantum computers are often described as machines that try out all possible solutions at the same time. That statement sounds impressive, but it is only partially true and can quickly lead to misconceptions.

A quantum computer is not a particularly fast ordinary computer. It works according to different physical rules. While a classical computer processes information with bits, a quantum computer uses so-called qubits. These qubits follow the laws of quantum mechanics.

This allows quantum computers to solve certain mathematical problems in a way that is hardly possible for classical computers. However, this does not mean that they are faster at every task. For word processing, the internet, games or ordinary control tasks, quantum computers offer no fundamental advantage.

In short: A quantum computer does not simply try out all solutions at once. It manipulates probability amplitudes so that unwanted computational paths are weakened and suitable results become more likely through interference.

Table of contents

Bits in a classical computer

To understand how a quantum computer works, you first need to look at how a classical computer processes information.

A classical computer works with bits. A bit can have exactly two states: 0 or 1. Electronically, these states can be represented, for example, by different voltage ranges.

Several bits together can represent larger numbers and more complex information. With two bits, four combinations are possible:

00
01
10
11

With three bits there are eight combinations:

000
001
010
011
100
101
110
111

In general, n bits can represent 2n different states.

However, a classical register of three bits is always in exactly one of these states at any given time. It can, for example, hold the value 101, but not 000, 011 and 101 at the same time.

A classical processor changes these bit states with logical operations such as AND, OR, NOT or XOR.

The qubit

Instead of bits, a quantum computer uses so-called quantum bits, or qubits for short.

A qubit also has two fundamental states: |0⟩ and |1⟩. The notation with angle brackets comes from quantum mechanics and is called Dirac notation.

The decisive difference from a classical bit is that a qubit is not restricted to the state |0⟩ or |1⟩. It can also be in an overlay of both states. This overlay is called superposition.

Mathematically, the state of a qubit can be described like this:

|ψ⟩ = α|0⟩ + β|1⟩

The values α and β are called amplitudes. They do not directly represent probabilities. Only the squared magnitudes of the amplitudes determine the probability of measuring a 0 or a 1.

The following holds:

|α|² + |β|² = 1

If a qubit is in an equal superposition, its state can be written in simplified form as:

|ψ⟩ = 1/√2 |0⟩ + 1/√2 |1⟩

A measurement then yields a 0 with a probability of 50 percent and a 1 with a probability of 50 percent.

Is a qubit 0 and 1 at the same time?

It is often said that a qubit is 0 and 1 at the same time. As a simplified explanation, this is usable. Physically, however, it is more accurate to say that a qubit has a quantum state that contains components of the states |0⟩ and |1⟩.

The qubit does not simply store two ordinary values at once. It has one state that is described by several amplitudes.

As soon as the qubit is measured, you obtain only one classical value: 0 or 1. After the measurement, the superposition is no longer directly present. This process is often referred to as the collapse of the wave function.

Important: A quantum computer cannot simply read out the many states and print them as a long list. The real advantage comes from deliberately manipulating the amplitudes before the measurement.

Multiple qubits

With multiple qubits, the number of possible basis states grows very quickly. Two qubits have four basis states:

|00⟩
|01⟩
|10⟩
|11⟩

The overall state can be a superposition of these four states:

|ψ⟩ = α₀|00⟩ + α₁|01⟩ + α₂|10⟩ + α₃|11⟩

Three qubits have eight basis states. Ten qubits already have 1024 basis states. For n qubits, a total of 2n amplitudes must be described.

For 50 qubits that would be:

250 = 1 125 899 906 842 624

possible basis states. This is one of the reasons why larger quantum systems are so hard to simulate completely with classical computers. The required memory grows exponentially.

Nevertheless, you must not conclude that a quantum computer with 50 qubits automatically has more than a quadrillion classical numbers at its disposal. The amplitudes cannot be read out individually. Each measurement yields only a single classical state.

The art of a quantum algorithm is to change the amplitudes in such a way that correct solutions are measured with high probability.

The Bloch sphere

The state of a single qubit can be represented geometrically with the so-called Bloch sphere.

The state |0⟩ lies at the top pole of the sphere and the state |1⟩ at the bottom pole. All other points on the surface correspond to possible superpositions.

Classical bit

Could only sit at one of the two poles of the Bloch sphere: top for 0 or bottom for 1.

Qubit

Can occupy any point on the sphere's surface. Quantum operations correspond to rotations of this state vector.

The Bloch sphere also shows that a qubit has more properties than just the probabilities for 0 and 1. In addition, the relative phase between the states plays an important role.

Two different states of a qubit can have the same probabilities for 0 and 1 when measured in the standard basis and still behave differently, because their relative phases differ. This phase is crucial for quantum interference.

1) Bit vs. qubit on the Bloch sphere

A classical bit knows only 0 or 1. A qubit can occupy any point on the sphere's surface. θ controls the measurement probabilities, φ the relative phase.

Classical bit

State: 0

A classical bit always sits at one pole only. There are no intermediate states.

Qubit (Bloch sphere)

Quantum interference

Quantum interference is one of the most important mechanisms of a quantum computer.

The amplitudes of different computational paths can reinforce or cancel each other. This resembles the superposition of waves.

When two water waves with the same phase meet, a bigger wave forms. When a wave crest and a wave trough meet, they can cancel each other out. Quantum amplitudes can behave in a similar way.

A quantum algorithm is constructed so that:

At the end, the quantum system is measured. If the algorithm was constructed correctly, the desired solution appears with high probability.

So the quantum computer does not simply try out all solutions and then read off the right one. It manipulates a system of amplitudes so that certain results become more likely through interference.

3) Interference: the phase decides the result

Circuit: |0⟩ → Hadamard → phase shift on |1⟩ → Hadamard → measurement. The phase φ controls whether the paths reinforce or cancel each other. This is exactly what distinguishes quantum computing from classical trial and error.

Relative phase φ

Result after interference
P(0)
P(1)

Quantum entanglement

Another important effect is quantum entanglement.

Two qubits are entangled when their joint state can no longer be described as two independent individual states. One example is the state:

|ψ⟩ = 1/√2 |00⟩ + 1/√2 |11⟩

A measurement yields either 00 or 11. Each of the two results occurs with a probability of 50 percent. However, you never obtain 01 or 10.

The two qubits are therefore correlated with each other. Before the measurement, neither of the two qubits independently has a fixed classical value. Only the joint state is fully described.

Entanglement allows a quantum computer to represent relationships between qubits that would not be possible in the same way with independent classical bits. It plays a central role in many quantum algorithms and in quantum error correction.

No faster-than-light trick: Entanglement does not enable information transfer faster than light. Although the measurement results are correlated, each individual result is random. To compare the results, an ordinary communication channel is still required.

4) Entanglement vs. independent bits

In the Bell state |Φ⁺⟩ = (|00⟩+|11⟩)/√2, the measurement results are strongly correlated. With two independent random bits, 01 and 10 are also possible.

Choose mode

Mode: entangled Last pair: –

Frequencies of the pairs
00
0
01
0
10
0
11
0

Quantum gates

A classical processor processes bits with logic gates. A quantum computer uses quantum gates.

Quantum gates change the amplitudes and phases of the qubits. Mathematically, they are described by so-called unitary matrices. Unitary means, simply put, that the operation is reversible and the total probability is preserved.

X gate

The X gate resembles the classical NOT gate. It swaps:

|0⟩ → |1⟩    and    |1⟩ → |0⟩

On the Bloch sphere, this corresponds to a rotation of 180 degrees around the X axis.

Hadamard gate

The Hadamard gate is frequently used to create an equal superposition.

The state |0⟩ becomes:

1/√2 |0⟩ + 1/√2 |1⟩

The state |1⟩ becomes:

1/√2 |0⟩ − 1/√2 |1⟩

The difference lies in the minus sign. This minus sign does not directly change the measurement probabilities, but it influences later interference. If the Hadamard gate is applied twice in a row to the same qubit, the original state is restored.

Phase gates

Phase gates change the relative phase between |0⟩ and |1⟩. They can ensure that amplitudes reinforce or cancel each other in later operations.

CNOT gate

The CNOT gate works with two qubits. The first qubit is the control qubit, the second the target qubit.

If the control qubit is |1⟩, the target qubit is flipped. If the control qubit is |0⟩, the target qubit remains unchanged. With a combination of Hadamard and CNOT gates, two qubits can be entangled.

Example: entangling two qubits

Initially, both qubits are in the state |00⟩. A Hadamard gate is applied to the first qubit. This produces:

1/√2 |00⟩ + 1/√2 |10⟩

The first qubit is now in a superposition. Then a CNOT gate is used. The first qubit serves as control and the second as target.

The joint state afterwards is:

1/√2 |00⟩ + 1/√2 |11⟩

The two qubits are now entangled. A measurement yields either 00 or 11.

How a quantum program runs

A quantum program consists, in simplified form, of five steps.

  1. Initialization: The qubits are brought into a known initial state, usually |000…0⟩.
  2. Creating superpositions: Quantum gates put certain qubits into superposition states.
  3. Entanglement and computation: Further quantum gates create dependencies between the qubits and carry out the actual quantum computation.
  4. Interference: The circuit is built so that unwanted amplitudes cancel out as much as possible and desired amplitudes are amplified.
  5. Measurement: The qubits are measured. The result is a classical bit string.

Since the result can be probabilistic, the same quantum circuit is often executed many times. These repetitions are called shots. If, for example, 1000 measurements are performed, a probability distribution can be determined from the frequency of the different results.

Why do quantum programs need to be repeated?

A quantum computer often does not deliver the same result on every run. Suppose an algorithm produces the following probabilities:

Result Probability
101 80 %
011 10 %
000 5 %
others 5 %

A single measurement could still yield 011. Only after many repetitions does it become visible that 101 occurs much more often. The most likely result is then interpreted as the solution.

A quantum algorithm therefore does not necessarily need a success probability of 100 percent. It is often enough if the correct solution is clearly more likely than all other results.

2) Measurement and shots

A measurement yields only 0 or 1. Only many repetitions (shots) reveal the probability distribution. The theoretical probabilities come from the θ value of the Bloch sphere demo above.

Experiment

Last result: –

Shots: 0 · zeros: 0 · ones: 0

Histogram
|0⟩
0%
|1⟩
0%

A simple example of a quantum advantage

A well-known quantum task is the Deutsch–Jozsa algorithm.

The task is to decide whether a given function is constant or balanced. A classical deterministic algorithm needs up to 2n−1+1 evaluations in the worst case.

A quantum algorithm can determine the sought property with a single quantum query, using superposition, phase changes and interference.

The advantage does not come from reading out all function values directly. Rather, the individual results are encoded in the phases of the quantum states. Interference then ensures that only the sought global property becomes visible.

This example is not particularly useful in practice, but it demonstrates well how a quantum algorithm works.

Note: Using randomness, a classical algorithm often succeeds with only a few queries and high probability. The clear advantage holds mainly against deterministic classical methods.

Well-known quantum algorithms

Not every problem can be solved faster with a quantum computer. For some tasks, however, significant advantages are known.

Shor's algorithm

Shor's algorithm can factorize large integers.

Many classical encryption schemes rely on the fact that decomposing a large number into its prime factors is extremely expensive for classical computers. A sufficiently large, error-corrected quantum computer could break certain encryption schemes used today.

Current quantum computers, however, are still far too small and too error-prone for this. Yet the resource estimates keep shrinking: in 2019, around 20 million noisy physical qubits were estimated for RSA-2048; in 2025 this estimate was reduced to under one million – with a runtime of about one week. For comparison: today's processors with suitable error rates have roughly 100 to 1000 qubits. This is why post-quantum-safe schemes are already being standardized, for example by NIST.

Grover's algorithm

Grover's algorithm speeds up searching in an unsorted set.

A classical computer needs about N checks in the worst case. Grover's algorithm needs about √N checks. That is a quadratic speedup. It is significant, but not exponential.

5) Classical search vs. the Grover idea

Find one marked element among 16 cells. Classically, you check cell by cell. Quantum mechanically (simplified), you amplify the amplitude of the marked cell in about √N steps.

Classical: check one by one

Checks: 0 · not found yet

Quantum: amplify amplitudes (simplified)

Quantum simulation

A particularly natural field of application is the simulation of other quantum systems.

Molecules, electrons and chemical bonds themselves follow the laws of quantum mechanics. Classical computers need enormous resources for an exact simulation of very large quantum systems. Quantum computers could model such systems more directly.

Possible applications lie in:

Quantum optimization

Quantum computers are also being investigated for optimization problems, for example:

For many of these applications, however, it is not yet certain whether practical quantum computers will actually outperform classical methods significantly.

Why quantum computers are so sensitive

Qubits must be controlled without losing their quantum properties. This is difficult because every qubit can interact with its environment.

Disturbances arise, for example, from:

When a qubit loses its quantum mechanical superposition, this is called decoherence. The time during which a qubit retains its quantum state sufficiently well is called the coherence time. A quantum computation must be completed before the stored quantum information is rendered unusable by disturbances.

Quantum errors

In classical computers, individual bit errors are relatively rare. In addition, data can simply be copied and stored multiple times. With qubits, the situation is more difficult.

Different types of errors can occur:

An unknown quantum state cannot simply be copied at will. This is ruled out by the no-cloning theorem. Direct checking by measurement is also impossible, because a measurement changes the state.

Quantum error correction

Nevertheless, quantum errors can be corrected.

To do this, the information of one logical qubit is distributed across several physical qubits. The full quantum state is not measured. Instead, certain relationships between the qubits are checked. These measurements yield so-called error syndromes.

From an error syndrome, it can be deduced which error probably occurred, without directly reading out the actual quantum information.

A well-known approach is the surface code. Many physical qubits are arranged in a two-dimensional structure.

Depending on the quality of the hardware, a great many physical qubits may be needed for a single reliable logical qubit. A quantum computer with 1000 physical qubits therefore does not automatically have 1000 reliably usable logical qubits.

Current state of research: Quantum error correction is one of the biggest challenges in building powerful quantum computers. An important advance is the demonstration of error correction below the surface code threshold (Google Willow, 2024/2025): as the code grows, the logical error rate decreases. For practically useful error rates, however, very many physical qubits per logical qubit are often still required.

How is a qubit physically built?

A qubit is not a specific component. Various physical systems can be used as qubits.

Superconducting qubits

Superconducting qubits consist of extremely small electrical circuits. They are cooled to temperatures close to absolute zero. At these temperatures, quantum mechanical states can be created in the circuits and controlled with microwave signals.

Advantages are fast quantum gates and established manufacturing techniques. Disadvantages are short coherence times, elaborate cooling and, in some cases, high error rates.

Ion traps

Here, electrically charged atoms, so-called ions, are held in place with electromagnetic fields. Lasers control the internal states of the ions.

Ions often have long coherence times and very precise quantum gates. However, the operations are comparatively slow and scaling to very many qubits is technically demanding.

Neutral atoms

Neutral atoms can be arranged with laser fields in optical lattices or tweezers. Targeted laser excitation makes the atoms interact with each other. This technique enables large, regular qubit arrays.

Photons

Particles of light can also carry quantum information. Photonic quantum computers use, for example, polarization, phase or different light paths.

Photons interact only weakly with their environment and are well suited for quantum communication. At the same time, it is difficult to create reliable interactions between individual photons.

Spins in semiconductors

The spin of an electron or atomic nucleus can also be used as a qubit. Such qubits could potentially integrate well into existing semiconductor technologies.

Why do some quantum computers need extreme cooling?

Superconducting qubits typically operate at temperatures of only a few millikelvin. That is colder than outer space.

The cooling is necessary because heat causes disordered motion and excitations. These would disturb the delicate quantum states. A so-called dilution refrigerator produces these extremely low temperatures.

The striking golden lines in many pictures of quantum computers mainly belong to the cooling and signal routing. The actual quantum chip usually sits far down at the bottom and is comparatively small.

Not every qubit technology requires the same cooling, however. Ion traps or photonic systems operate under different conditions.

Quantum computers still need classical computers

A quantum computer does not work alone. A classical computer is needed to:

Many of today's quantum methods are hybrid. A classical computer carries out part of the computation. The quantum computer computes a specific part, and the result is passed back to the classical computer. This cycle is repeated several times.

A quantum computer is therefore more of a special-purpose accelerator than a complete replacement for a classical computer. Much like a graphics card takes over certain computing tasks, a quantum processor could in the future be used for selected problems.

Why is a quantum computer not simply faster?

With an ordinary processor, speed can be increased, for example, through a higher clock frequency or more processor cores.

A quantum computer offers a different kind of advantage. Certain algorithms need fewer computational steps than known classical algorithms thanks to quantum interference. For many tasks, however, no quantum algorithm with an advantage is known.

A quantum computer is therefore not automatically better for:

In addition, initializing, controlling and reading out the qubits involves substantial technical effort. Only when a suitable quantum algorithm exists and the task is big enough can a real advantage emerge.

What does quantum supremacy mean?

The term quantum supremacy describes an experiment in which a quantum computer performs a specific task that is practically infeasible for a classical computer.

This can be an artificially constructed task with no direct practical use.

Such a demonstration shows that a quantum system can perform a specific computation efficiently. However, it does not mean that the quantum computer is generally more capable than classical computers. Moreover, the boundary keeps moving: early demonstrations such as Google's Sycamore in 2019 were later partially caught up with or strongly put into perspective by improved classical simulations.

For practical applications, the term quantum advantage is often more appropriate. It describes a measurable advantage on a real task, for example in runtime, energy consumption, accuracy or cost.

The biggest challenges

For a practically useful quantum computer, several problems must be solved at the same time. These include:

It is not enough to just increase the number of qubits. A large quantum computer with very faulty qubits can be less useful than a smaller but more precise system.

Important quality metrics therefore include:

A simple overall picture

Simplified, a quantum computer can be seen as a machine that controls probability amplitudes. The sequence is:

  1. Qubits are brought into a known state.
  2. Quantum gates create superpositions.
  3. Qubits are entangled with each other.
  4. Phases and amplitudes are changed in a targeted way.
  5. Quantum interference amplifies suitable results.
  6. The system is measured.
  7. The measurement yields classical bits.
  8. The process is repeated several times.
  9. A classical computer evaluates the results.

The real computational advantage does not come from superposition alone. Only the interplay of superposition, entanglement and interference makes special quantum algorithms possible.

Summary

A classical computer processes bits that are either 0 or 1. A quantum computer uses qubits that can be in superpositions of different states.

Multiple qubits can be entangled with each other. As a result, their joint state can no longer be described by independent individual states.

Quantum gates change the amplitudes and phases of these states. Through quantum interference, wrong solution paths can be weakened and correct solution paths amplified.

During measurement, the superposition is lost and the quantum computer delivers a classical bit string. Since the result is often probabilistic, the computation is repeated many times.

Quantum computers are not faster for every task. Their potential lies mainly in specific problems such as factorization, quantum simulation, search and possibly complex optimization.

The greatest technical difficulty is protecting qubits from disturbances long enough and correcting the errors that occur.

A powerful quantum computer would therefore not be a replacement for the classical computer. It would be a specialized computing accelerator for tasks where quantum mechanical algorithms offer a real advantage.

Sources and further reading

Foundations and textbooks

Algorithms

Hardware, error correction and current research

Optimization and quantum advantage

Author: Ruedi von Kryentech

Created and technically reviewed: 2026-07-20

Content aligned with the quantum report and the primary sources listed above.