Quantum Computing for Everyone
What the rapidly developing field means for the future
Quantum computing. It’s a commonly thrown-around buzz word in science fiction and popular media, along the likes of ‘quantum entanglement’ and ‘quantum teleportation’. But what really is it?
Quantum computing is very, very linear-algebra heavy — and hence, there’s not a lot of resources on it for the everyday tech enthusiast. This article will be very light on the math in providing a realistic approach to what quantum computing is, focus not only on the theory but also the hardware & real-world implementation, and what it means for the future — for everyone.
- The Qubit and Superposition. The fundamental principles of qubits, an intuitive explanation on what superposition is, and challenges in implementing qubits in hardware.
- Multi-Qubit Systems and Entanglement. What multi-qubit systems are, an intuitive explanation of how entanglement works, and entanglement’s apparent contradictions with Einstein’s Theory of Special Relativity.
- Why are Qubits Superior? and the Future. Exponential speedup in computing time with qubits over bits, RSA encryption broken by quantum, and will quantum computers become the norm?
- Further Resources. Interested in learning more about quantum computing? Find links to helpful resources on quantum programming, quantum algorithms, and more.
The Qubit and Superposition
To understand what a qubit is, one needs to first understand what a bit is. Your computers runs on bits, which are either 0 or 1. Bits are capable of representing massive amounts of data — all the programs that your computer run on are stored in very, very long strings of bits. Bits are physically represented with transistors, in which the presence of an electron passing through a gate represents 1 and the absence represents 0. A computer chip is packed with several trillions of ultra-small transistors (the fact that information is represented by electrons is why computer chips can’t get any smaller), which makes it function.
Qubits are fundamentally different in that they are not confined to being only in a state of 0 or 1 — they can be in between. This phenomenon is called superposition, and only exists in quanta, or very small objects. A qubit can be anything that exhibits quantum behavior, like a photon.
A qubit that is in superposition, when measured, collapses into one of the two deterministic states (0 and 1), with the probability it falls into 0 or falling into 1 being determined by its superposition. If the qubit is in an equal superposition, it is half in state 0 and half in state 1. Hence, when measured, the qubit will fall into state 0 with 50% chance and state 1 with 50% chance. If the qubit is in, say, 75% state 0 and 25% state 1, when measured 100 times, the qubit will fall into state 0 approximately 75 times and state 1 approximately 25 times.
To understand superposition, one must think of the states as waves instead of mutually exclusive classes. Imagine two forms of music, which we will call music A and music B. You can either play only music A at 100% volume or play only music B at 100% volume, or you could play both simeultaneously at 50% volume each.
Because qubits collapse into one of two deterministic states when measured, it is impossible to measure the true probabilistic state of a qubit. However, it is possible to approximate it. With a qubit A 25% in 0 and 75% in 1, by measuring it 1000 times — say with results 239 times measuring 0 and 761 times measuring 1 — quantum physicists can approximate what state the qubit is in. The key word is approximate — gates cannot be applied solely on knowledge of what percent the qubit is in 0 and 1.
Superposition is a real phenomenon — the famous double-slit experiment demonstrates that certain quanta like electrons or photons are in wave states, which when passed through two slits, causes an interference pattern to show on the screen.
In hardware, the main challenge in building qubits is that their probabilistic nature (they are not deterministic) mean that their state could be very easily nudged around and changed based on external forces. Qubits are difficult to maintain for the very reason why they are so powerful — their many possible states are difficult to control for more than a few seconds. Applying quantum gates to perform operations may often result in gate errors due to an accidental mishandling of the qubit. Qubits can be anything from photons to electrons to certain molecules, as long as they exhibit quantum behavior.
Multi-Qubit Systems and Entanglement
Your computer wouldn’t get very far with only one bit — it could only hold two values. Your computer operates a massive multi-bit system. Like bits, qubits can be arranged into multi-qubit systems.
A 2-qubit system in state 00 has the first qubit in state 0 and the second qubit in state 0. A 2-qubit system in state 10 has the first qubit in state 1 and the second in state 0.
However, because of superposition, 2-qubit systems are not simply limited to the deterministic (either 0 or 1) states — they can be in superposition. A 2-qubit system in equal superposition would be one-quarter in state 00, one quarter in state 01, one-quarter in 10, and one-quarter in 11. This means that when the system is measured, it has an equal chance of landing in one of the four deterministic 2-qubit states.
Entanglement is a commonly thrown-around buzzword — and it is confusing. Albert Einstein famously called it “spooky action at a distance” because one could interpret it as violating his Theory of Special Relativity.
With two entangled qubits A and B in any superposition, when Bob measures qubit A to be, say, in state 1, Bob instantly knows without measuring qubit B to be in state 1 as well. When Bob measures B, alas, it is in state 1. If Bob measures qubit A to be in state 0, qubit B will also measure to be in state 0 — one hundred percent of the time. What’s more amazing, this phenomena still occurs when A and B are trillions of light years away — distance is not a factor in entanglement.
This may seem like witchcraft, but it’s been verified as true — entanglement is a real thing that happens. However, entanglement is not so confusing when one approaches it by looking at its qubit system. If a two-qubit system with qubits A and B are in entanglement, they could be in a state that is half in 00 and half in 11. This way, no matter what the system measures to, the two qubits will always be the same. An entangled system could also be half in 01 and half in 10, where the two states are always opposite of each other.
Albert Einstein and other physicists find fault in entanglement in that it seemingly violates Einstein’s Theory of Special Relativity, which states that nothing can travel faster than the speed of light. If Alice has qubit A and Bob has qubit B (both of which are entangled), and Bob travels billions of light years away, Alice’s qubit would measure exactly the same as Bob’s — any changes to Alice’s qubit due to Alice applying gates will affect the state of Bob’s qubit. Does this constitute communication? Some argue that the qubits ‘agree’ on which state to choose beforehand, but that doesn’t seem to fit with the random nature of probabilistic qubits. No one really knows because it is impossible to find the exact probabilistic state of the qubit, since measuring a qubit forces it into one of two deterministic states. This question is still very much under debate.
Why Are Qubits Superior? and the Future
Qubits are exponentially faster than bits in several computing problems, such as database searches and factoring (which, as we will discuss soon, may break your Internet encryption).
An important thing to realize is that qubits can hold much more information than a bit can. One bit holds the same amount of information as one qubit — they can both only hold one value. However, four bits must be used to store the same amount of information as two qubits. A two-qubit system in equal superposition holds values for four states, which on a classical computer, would need at least four bits to hold. Eight bits are needed to store the same amount of information as three qubits, since a three-qubit system can store eight states — 000, 001, 010, 011, 100, 101, 110, and 111. This pattern continues.
The below graph provides a visual for the computing power of qubits. The x-axis represents the number of qubits used to hold a certain amount of information. The blue line’s y represents the number of bits needed to hold the same amount of information as the number of qubits (x-axis), or 2 to the power of x. The red line’s y represents the number of qubits needed to hold the same amount of information as the number of qubits in the x-axis (y=x).
Imagine the exponential speedup quantum computing can provide! A gigabyte (8E+09 bits) worth of information can be represented with log(8E+09)/log(2) = 33 (rounded up from 32.9) qubits.
Quantum computers are also great at factoring numbers — which leads us to RSA encryption. The security protocol that secures Medium and probably any other website you’ve been on is known as RSA encryption. It relies on the fact that with current computing resources, it would take a very, very long time to factor a 30+-digit number m that has only one solution — namely, p times q, where both p and q are large prime numbers. However, dividing m by p or q is computationally much easier, and since m divided by q returns p and vice versa, it provides a quick key verification system.
A quantum algorithm called Shor’s algorithm has shown exponential speedup in factoring numbers, which could one day break RSA encryption. But don’t buy into the hype yet — as of this writing, the largest number factored by quantum computers is 21 (into 3 and 7). The hardware has not been developed yet for quantum computers to factor 30-digit numbers or even 10-digit numbers. Even if quantum computers one day do break RSA encryption, a new security protocol called BB84 that relies on quantum properties is verified safe from quantum computers.
So will quantum computers ever completely replace the classical PC? Not in the forseeable future.
Quantum computing, while developing very rapidly, is still in an infantile stage, with research only being conducted semi-competitively by large corporations like Google, Microsoft, and IBM. Much of the hardware to accelerate quantum computing is not currently available. There are several obstacles to a quantum future, of which a major one is addressing gate errors and maintaining integrity of a qubit’s state.
However, given the amount of innovation that has happened in the past few years, it seems inevitable during our lifetimes that quantum computing will make huge strides. In addition, complexity theory has shown that there are several cases where classical computers perform better than quantum computers. IBM quantum computer developers state that quantum computing will probably never completely eliminate classical computers. Instead, in the future we may see a hybrid chip that relies on quantum transistors for certain tasks and classical transistors for others, depending on which one is more appropriate.
Are you interested in learning a bit more about quantum computing? Below are some great resources to learn more about it.
- Quantum experiment in China breaks through distance barrier in optic fibres, 2020.
- Google Sycamore processor paper, 2019
- Chinese scientists use satellite-beaming to set new quantum entanglement distance record, 2017
- Qiskit Textbook. Produced by IBM, Qiskit is a powerful Python library that allows users to simulate quantum circuits or run them on real IBM quantum computers. The Qiskit Textbook combines a traditional quantum mechanics course with implementations in Qiskit. Discusses basics of quantum computing, quantum gates, quantum algorithms, simulating molecules with quantum circuits, and more.
- Q# Katas. Q# is Microsoft’s language for quantum computing. With a very similar structure to the C# family of languages, Microsoft has developed a series of self-guided tutorials called Katas for Q#. These Katas cover a similar range to the Qiskit textbook, but emphasize more on self-discovery (this means that there are no answers).
- IBM Quantum Experience. The IBM Quantum Experience is a circuit-based interface that allows anyone to quickly construct quantum circuits and run them on real quantum computers. Because it is not a programming-based interface, it has reduced control on algorithm implementation but is a great introduction to quantum computing.
- Grover’s Algorithm for Database Searches. Explore two visual explanations of Grover’s Algorithm, which uses quantum properties to find items in a database exponentially faster than classical searches.
- Solving Satisfiability Problems with Grover’s Algorithm. Explore a very powerful form of problem (that may hold the key to quantum-aided deep learning) and how to implement it in Qiskit.
The Future of Quantum Computing
Thanks for reading! If you enjoyed, feel free to check out some of my other work.