# A New Approach to Multiplication Opens the Door to Better Quantum Computers

## Introduction

When I was 9, my family got a new computer. It was better than our old computer in every way save one: It couldn’t run my favorite racing game. What’s the point of a fancy new computer, I remember thinking, if it can’t run the program I care about most?

A similar issue applies to quantum computers. In theory, they can do anything that a classical computer can. In practice, however, the quantumness in a quantum computer makes it nearly impossible to efficiently run some of the most important classical algorithms.

Which is why a paper posted on April 15 is good news. In it, Craig Gidney, a software engineer at Google AI Quantum in Santa Barbara, California, describes a quantum version of a classical algorithm for quickly multiplying very large numbers. Classical computers have been running this algorithm for a long time. Before Gidney’s paper it was unclear whether it would be possible to retrofit it for quantum machines.

Even more important, the multiplication algorithm is part of a class of nearly ubiquitous algorithms in computer science. Gidney expects that his new technique will allow quantum computers to implement this class of algorithms, which until now appeared to be too cumbersome to be used in a quantum machine.

The multiplication algorithm in question takes advantage of a discovery that was the first advance in multiplication made in thousands of years. The traditional grade-school method for multiplication requires *n*^{2} steps, where *n* is the number of digits of the numbers you’re multiplying. For millennia, mathematicians believed there wasn’t a more efficient approach.

But, as *Quanta* reported in our recent story “Mathematicians Discover the Perfect Way to Multiply,” in 1960 a mathematician named Anatoly Karatsuba found a faster way. His method involves splitting long numbers into shorter numbers. To multiply two eight-digit numbers, for example, you would first split each into two four-digit numbers, then split each of these into two-digit numbers. You then do some operations on all the two-digit numbers and reconstitute the results into a final product. For multiplication involving large numbers, the Karatsuba method takes far fewer steps than the grade-school method.

When a classical computer runs the Karatsuba method, it deletes information as it goes. For example, after it reconstitutes the two-digit numbers into four-digit numbers, it forgets the two-digit numbers. All it cares about is the four-digit numbers themselves. The classical version of the Karatsuba method is like a climber shedding gear on the way up a mountain — you can move faster when you don’t have to carry everything with you the whole way.

But quantum computers can’t shed information.

Quantum computers perform calculations by manipulating systems of quantum bits, or “qubits.” These qubits are intertwined, or entangled, with one another. This entanglement is what gives quantum computers their massive power — instead of just storing information in individual bits, quantum computers make use of the complex relationship that exists among all the qubits. As a result, for certain problems quantum machines can bring to bear exponentially more processing power than classical machines.

But the same feature that makes quantum computers powerful makes them fragile. Because the qubits are entangled, you can’t change a few of them without affecting all the others. That makes it impossible to selectively erase information the way a classical computer can. Tossing away qubits is like snipping strands in a spider’s web — even a single snip can unravel the whole thing.

This requirement to retain information makes it hard to create quantum versions of algorithms that are “recursive,” meaning that they feed back into themselves. Recursive algorithms are widely used in computer science, yet to work best they require that the computer discard information at every step. Without that ability, the calculations would quickly become impractical. “If every time you do an operation you’re storing information, the amount of space scales with the amount of operations,” said Ashley Montanaro, a quantum information scientist at the University of Bristol. Any practical machine would quickly run out of memory.

In his new paper, Gidney describes a quantum way of implementing Karatsuba multiplication that doesn’t impose huge memory costs. Instead of generating intermediate values to produce a final value, he uses a method called “tail call optimization” to directly mutate inputs to outputs. This allows the algorithm to avoid creating intermediate information that a quantum computer can never discard. “He gets rid of the issue of having to deal with extra qubits by not having extra qubits,” said Thomas Wong, a quantum information scientist at Creighton University.

Gidney expects that his method will work for adapting many classical recursive algorithms to quantum computers. For now, quantum computers are so rudimentary that they can barely carry out single-digit multiplication. But there’s an algorithm ready and waiting, so when their design improves, they’ll be able to do a whole lot more.