# QUANTUM COMPUTING

## Mats Tage Axelsson introduces you to quantum computing, the coolest tech around; learn how it works, and how you can get started

An introduction to the coolest tech around; learn how it works, and how to get started.

QUANTUM COMPUTING has caught the attention of large companies, academics, and hobbyists. We’re going to cover the history, the different ways to make a quantum computer, and the logic behind programming. You’ll also learn about some programming toolkits that you can use to get started.

To run a quantum computer, the physics has to be understood, so programmers can manipulate and measure the final results. Scientists have observed quantum effects in photons, electrons, and isotopes of many materials. This means engineers use superconducting materials, such as niobium and aluminum, to construct workable quantum computing systems.

The logic gates are made of silicon wafers, and are controlled using microwave emitters. These solutions may not be the best in the long run, but they’re the ones that are running now. To use quantum computers, you need logic that takes advantage of the two core concepts: superposition and entanglement. When you start exploring these concepts, the Bloch sphere helps visualize what to do with different gates. Programmers can use classical bit gates together with quantum gates to create the algorithms needed.

The mainstream media hails quantum computers as significantly faster than current models. It turns out they’re only fast in specific areas: cryptography, optimization, simulation, and database searches. In cryptography, many algorithms are safe, because factorizing large prime numbers with classical computers takes far too long to be practical. Shor’s quantum algorithm can do it in minutes. Optimization and simulations can benefit from a quantum computer’s ability to test many solutions at once.

Database searches are faster by a factor of four. And with speedier database searches, machine learning also becomes much faster.

Thehistoryofquantumcomputers begins with quantum physics. In 1900, Max Planck first proposed

that light comes in discrete packets, called quanta. This discovery later led Einstein to show that Planck was right. When measuring the photoelectric effect, scientists could observe packet behavior. These two discoveries later led to quantum physics. Yet the deeper scientists dived into the quantum nature of things, the harder it got to explain how it works. For quantum computing, the most interesting developments are entanglement and superposition.

Superposition is where a particle exists in many positions at the same time. Considering this, scientists concluded that a quantum computer should be possible to build. A quantum computer is one that can do many calculations per operation.

THE CAT IN THE BOX The famous physicist Schrödinger created a thought experiment. In it, he describes a cat and a gas container inside a box. The gas will poison the cat after the radioactive decay of an atom that releases the gas. The process is random, so observers won’t know if the cat is dead or alive until they open the box. In quantum physics, this means that the cat is both alive and dead before anyone observes it. In the case of the cat, this is absurd, but in quantum physics, it’s normal. What Schrödinger was saying was that there must be another explanation— one as yet undiscovered.

Entanglement is where two particles can have intertwined states. This means that the state of one particle is always the opposite of the other, even when they are apart. In quantum computers, the software creates entanglement; a CNOT gate creates this state.

To make use of all the phenomena demonstrated in quantum physics, scientists needed a way to describe what happens on a small scale. To program a computer, it needs logical operations, or logical gates. Quantum gates and classical logic gates are the same only up to a point. Quantum gates add features for changing states and entanglement.

It took until the 1970s for the first attempt at a theory to use quantum effects for computers. Shannon information theory describes classical gates and other aspects of data processing. For quantum computers, this is insufficient, because it doesn’t specifically describe quantum effects.

Quantum information theory was first tried in 1976. During the 1980s, scientists made more progress, in part thanks to quantum computing conferences organized by MIT and IBM. Other developments included quantum cryptography and the first universal quantum computer.

To use all the states of the particle you measure, programmers need a formal language. Quantum information theory needed to improve. The different gates are the foundation for such a scheme.

Keeping track of what the different quantum states are is

confusing. First of all, the way it works is counter-intuitive at best. Second, there are many different spin axles to keep track of. The system isn’t complicated, but it involves atypical approaches that are tricky to grasp. To make sense of all the state transitions, physicists created the Bloch sphere.

Peter Shor discovered Shor’s algorithm in 1994. This algorithm solves the problem of finding the prime factors of large numbers. The basis of all encryption is that you can’t, in a reasonable time, solve this problem. Quantum computers may solve this problem in minutes. Interest in quantum computers subsequently sky-rocketed.

Shortly after Shor’s discovery, Lov Grover invented the Grover algorithm. This is best known as the database search algorithm, but it’s also useful for other tasks.

Through the coming decades, scientists invented new features. Quantum error correction and fault-tolerant quantum computers were among the major ones. The first demonstration of a quantum computer took place in 1998. After this, development accelerated.

THE ION AGE

To date, there is a range of quantum computers in use. Researchers are using ion traps, light-based, and microwave-controlled BoseEinstein condensates. These types need different control mechanisms. The ion traps use an electromagnetic field to trap the ions. Lasers create the field, keep the ion trapped, and “pump” the state of the electron of the ion. The electron will emit light only when the state matches the laser’s frequency.

This is the logical 1 state, while the logical 0 state is the opposite. This makes it simple to measure, but achieving precision is still a challenge. Manufacturing is also expensive using current technologies. Meanwhile, a BoseEinstein condensate is a gas cooled to millikelvin temperatures. When the gas reaches this temperature, all electrons take the same quantum state. Uses for this solution are, so far, limited to simulators—any actual computers are pipe dreams.

The interesting types are the Josephson junction types; these actually are running in practical setups. IBM’s versions are even available for anyone who registers on the Q Experience web page.

The D-wave machine uses Josephson junctions. These are superconducting niobium and aluminum-oxide gates. At temperatures near absolute zero, a sensitive magnetometer measures their magnetic properties. The values show the quantum state of the junction, making the circuit a qubit. The principle this computer uses is quantum annealing.

IBM uses Nuclear Magnetic Resonance (NMR). The qubit is still a Josephson gate. That solution uses microwave transmitters to interact with the qubit.

The difference between the two is that the IBM solution controls qubits to a higher degree. This has made it easier for Canadian company D-Wave to manufacture bigger chips. At the same time, this limits D-wave to fewer applications. For example, an annealing system can’t run Shor’s algorithm or Grover’s. It’s useful for optimization and machine learning—no wonder Google already has one of its own D-wave quantum computers.

MORE IS LESS WORK

As mentioned, the algorithms in quantum computers are different. To explain what the difference is, you must bear in mind the physics involved. You probably already know that a conventional computer uses gates. The system uses Boolean logic to create the algorithms for calculating everything. The most important aspect of this is that it’s deterministic, so we only deal in certainties. The answer is either yes or no—at least on the circuit level.

In contrast, quantum computing involves all answers having a probability attached to them. No

answer is certain—rather, it is probabilistic. For this to be efficient, the algorithms must be adapted.

Quantum gates have an effect on one or several qubits at a time. When you measure qubits, the system usually does a complete analysis of the entire system. So, if you’re searching for one qubit, that one will stick out like a sore thumb in one operation. Note that one operation is made up of many shots of the same gates. This is one of the reasons why quantum computers are faster than a conventional one.

The most common scenario is to find the special number of many, such as a database search. The other most cited case is for breaking encryption. Using Shor’s algorithm, you measure the solution by the action of the gates. The gates run the input a fixed number of times before finding the answer. That number doesn’t change when the input is a higher number. A classical computer forces you to test all possible answers. This means that when the number reaches 2,048 you are facing a potential million years to solve it. More numbers mean an exponential workload increase. The effort to solve the problem does not increase in a quantum computer.

LET’S HAVE A BLOCH PARTY Once you know how many states and transitions you have in each qubit, it’s time to code. Not so fast, though—there’s a visual way to describe the gates. The Bloch sphere is the basis for all gates. The graph looks like a music score, so it’s called a quantum score. It looks a bit different depending on the platform, but in general, the strings across are qubits. When you want to change the state of a qubit, you place a gate on the string. To create entanglement between two qubits, you drop the gate on one string and connect it to the other.

To describe the quantum state of a particle, you use spin, like a spinning ball. More precisely, the angle the “ball” spins. Even though there are no balls in the classical sense, the math describes it well. When the equipment measures an electron, it’s in spin up or spin down in one axis. The system can only measure in one dimension at a time. The three are x, y, and z. If you measure x, you lose all information about the spin state on the z and y axes. When you describe the quantum state, you use an imaginary arrow in the Bloch sphere.

The top of the sphere represents the qubit’s logical 0 and the bottom is logical 1. These are the only two states that the system can measure with 100 percent certainty. To get a result in a quantum computer, you make many “shots” and get the most probable answer.

A matrix contains co-ordinates that show the arrow’s angle. The length of the arrow is always 1. The values we use to calculate the probability describe the components of the axes for the arrow. The Bloch sphere rules the gates and their naming.

The available gates depend on the application and type of quantum computer. But the following are the common ones. The Pauli X gate rotates the state around the x-axis, changing the value of z. This gate is also a bit-flip gate. The Pauli Y gate rotates around the y-axis, changing the x value and the z value. This gate is a bit-flip and a phase-flip gate.

So far, the gates only flip the bits and phases. These don’t deal with superposition or entanglement. The Hadamard gate puts the qubit in a superposition. To make that clear, the qubit will have a 50 percent chance of being 0 or 1, flipping between X and Z.

It will act like a dice, only using two in a row will always give the starting value. More gates that extend the Hadamard gate are S and its transformed conjugate.

To use entanglement, you use a CNOT gate, usually depicted with a plus sign in a circle and a line down to another qubit. The gate flips the target qubit when the control is 1.

Those are the basic gates you’ll encounter as you start out. On the IBM Q Experience, you have the chance to also create subroutines. A better idea, though, is to use a development kit. There are many available, and you can extend your IDE with them. Eclipse, Netbeans, and Visual Studio have modules. They use several languages. The programming tools for Python, for example, are available from IBM. Note that the routines prepare scripts for the quantum computer— it doesn’t run Python on it.

So get cracking! You won’t create much at first, but we guarantee you will have a lot of fun.

Programmers use the Bloch sphere to illustrate how quantum gates manipulate the qubits.

When starting out, programmers use a score, like a music score. The picture shows Quirk, an online simulator. The circuit is showing a Quantum Fourier transform.

Here, we’re employing Eclipse to develop our own quantum computing programs. Note that this particular toolkit is using Python as the supporting programming language.