Back

How do you measure magic in a quantum computer?

12 November 2026 | By: Newcastle University | 4 min read
A photograph of a quantum computer

Quantum computers could one day outpace ordinary computers, but only if they can correct their errors and hold a fragile ingredient called ‘magic’.

Our new research links the two, and for some error-correcting codes, can measure how much ‘magic’ is left after each round of correction.

 

Contents:

  1. What is a quantum computer?
  2. What is ‘magic’ in quantum computing?
  3. How does quantum error correction work?
  4. Why is quantum error correction hard?
  5. Our work: linking magic and error correction
  6. Why does this matter for quantum computing?
  7. Looking ahead

 

What is a quantum computer?

Quantum computers are a new type of computing technology that harnesses the unusual behaviour of particles at the quantum scale.

Rather than processing information as simple 0s and 1s, they use quantum bits, or qubits, which can exist in multiple states simultaneously. This allows quantum machines to tackle some complex problems in ways that conventional computers cannot.

Unfortunately, however, when we measure, or 'read out', our qubits, we can only see one of these possible states, so a lot of the difficulty in quantum computing is making sure the state we see is one which is useful.

 

What is ‘magic’ in quantum computing?

Another issue for quantum computing, alongside finding algorithms which give the right “read-out”, is that a large family of quantum operations, called stabiliser operations, can be simulated efficiently on an ordinary computer, regardless how many qubits are involved.

Magic is the extra ingredient that takes a quantum computer beyond this family – without it there is no quantum advantage.

Physicists define this magic as how far a quantum state is from the states these simulations can handle. There are several ways to measure it, each telling us how useful a state is for quantum computing.

Magic is also linked to contextuality, a distinctly quantum feature whereby the result of a measurement cannot be thought of as fixed in advance, independent of which other measurements are made alongside it, without leading to paradoxes. Magic therefore in some sense comes from the “paradoxical-ness” of quantum mechanics.

 

How does quantum error correction work?

Quantum error correction (QEC) studies how to protect quantum information from errors. It is one of the most active areas of quantum computing research, because errors are one of the main obstacles to useful quantum computers.

Many kinds of error can affect a quantum computer. A bit-flip error swaps a qubit’s 0 and 1. A phase-flip error changes the relative sign between them. Amplitude damping describes the system losing energy to its surroundings, for example a photon leaking out of a cavity.

Together, these errors can destroy the information a quantum state holds.

Quantum error-correcting codes protect against these errors. A code spreads the information of k qubits across n > k qubits, or across other systems such as oscillators (for example, the light field in a cavity). This redundancy lets us find and undo errors without looking at the protected information. In each round of error correction, we measure a set of checks (the syndrome) that reveals which error occurred, then apply the operation that reverses it.

Many codes are described by three numbers: how many physical qubits they use, how many logical qubits they protect, and their distance, the smallest number of errors that can corrupt the encoded information without being detected.

 

Why is quantum error correction hard?

The main reason QEC is much harder than classical error correction is the no-cloning theorem, which says that an unknown quantum state cannot be copied.

A classical bit can always be copied, so the simplest classical code stores several copies and takes a majority vote. This is not possible for qubits.

Looking at a qubit directly also disturbs it. Quantum codes get around both problems by spreading the information across multiple entangled qubits (or other larger physical systems), and measuring only the syndrome, which reveals the error but not the encoded information.

 

Our work: linking magic and error correction

In our paper, Phase-space representations of quantum error-correcting codes, published in Physical Review Research, we study how magic and error correction fit together.

Our tool is phase space: in classical mechanics, the space of positions and momenta used to describe moving objects.

Quantum states can also be drawn there, as quasiprobability distributions. These behave like probability distributions, except that they can take negative values, which have no classical counterpart. For qubits and other systems with a finite number of levels, phase space becomes a grid of points.

We show which codes have a phase space tailored to them: those, and only those, that are unchanged by a regular grid (a lattice) of shifts in phase space.

Two families qualify: the ideal Gottesman-Kitaev-Preskill (GKP) codes, which store information in an oscillator and for which such a phase space was already known, and every qudit stabiliser code, where a qudit is a quantum system with d levels. When d is an odd prime, as for the three-level qutrit, the negative part of the code’s phase-space distribution measures the magic of the encoded information, averaged over the possible syndromes.

For qubits (d = 2), the tailored phase space still exists, but its negative part can no longer be interpreted as magic.

Other codes, such as the cat and binomial codes used in superconducting devices, have no tailored phase space: we prove that only the usual one is available, and its negative part describes the physical oscillator rather than the stored information. For these codes, when the stored information is a qudit of odd prime dimension, we can still measure its magic by building the phase-space picture from the decoding step instead. This version depends on the choice of decoder, and errors no longer act on it as simple shifts.

 

Why does this matter for quantum computing?

Quantum computers need magic to outperform ordinary ones, but tracking how much is left after rounds of errors and corrections is hard. For the codes where negativity measures magic, our method turns a model of the noise into a magic budget. This works like a fuel gauge: it shows how much magic is left and when it will run out.

As an example, we take a GKP code storing a qutrit in a magic state called the strange state, under random shifts in phase space, a standard noise model for oscillators. In a single round, the magic is gone once the chance of a logical error reaches two-thirds. At one noise level, the magic lasts six rounds of correction and vanishes at the seventh. Cut the size of the shifts by a third, and it lasts 53 rounds. After that, an ordinary computer can efficiently simulate what remains.

In the longer term, tools like this could help engineers check that their machines still have an advantage over ordinary computers.

 

Looking ahead

Our work is one step towards quantum advantage: the point where quantum computers solve useful problems that ordinary computers cannot solve in reasonable time. Quantum computers will not beat ordinary computers at everything, but could make a real difference for tasks such as simulating molecules and materials, or solving mathematical tasks like optimisation.

As a next result, we want to find a magic gauge that works for qubits, which most current machines use, and to work out magic thresholds for more codes. We also want to extend another tool from the paper, based on Kirkwood-Dirac quasiprobabilities, into a way of diagnosing noise across repeated rounds of error correction.

For anyone worried about their bank account, machines able to break today’s encryption are not just around the corner, and the UK’s National Cyber Security Centre has set 2035 as the target for switching to new encryption designed to resist them. In the meantime, quantum computers promise to be an enormous resource for humankind.

 

You might also like

 

Sign up for the latest research insights. Subscribe.