Very carefully.
All joking aside, quantum computers take advantage of what is colloquially known as “quantum weirdness” to compute in different ways from traditional computers. The two pertinent parts of quantum weirdness are superposition – what you called “being both on and off” and entanglement – what Einstein called “spooky action at a distance.”
Superposition is an attribute of quantum systems, basically it means that until you measure the state of the system it exists in a kind of fuzzy state where it’s all of the values and none of the values simultaneously. There’s more to it than that and I’m glossing over the finer points, but this is ELI5 so we’ll just roll with it.
Entanglement is another attribute of quantum systems. When two quantum systems are entangled, it basically means that the state of one is correlated with the state of the other. When you eventually “collapse” the entanglement, the two systems will be either correlated – they’ll both be in the same state – or anti-correlated – they’ll both be in an opposite state. Exactly which way it will be depends on the type of entanglement, but it always holds true.
We’re almost to the answer, the final bit you need to know before we get there is that quantum states are *very* sensitive to outside interference. This is why building a quantum computer is difficult – it’s hard to build a large system that exhibits quantum effects without accidentally collapsing it before your calculation is complete.
So, to make a quantum computer, you need to create a vast number of independent quantum entities, entangle them together, line them up such that their states will propagate in accordance with the algorithm you’re running, allow them to compute as long as possible in an entangled and superposed state, and then finally read out the results of your algorithm to find the answer.
The advantage of doing this is that the superposition allows you to calculate multiple possible answers at once. Specifically, you can use every single possible value simultaneously. To use an example – imagine you wanted to factor a number. Let’s say… 2,257. If you don’t know what the factors are of that number, you would need to check each potential factor to find them. In a classical computer, assuming you don’t know a more efficient factoring algorithm, you would need to brute-force check every prime number until you found the prime factors of that number. In this case, you would need to run your algorithm 12 times before you found 37 and 61 as the factors.
With just an 12 quantum bits (or qubits), you could find that answer in a single pass, because your qubits could take on every value from 0 to 4096. So instead of running a 12-bit system 12 times, you just run the 12-bit system once. And obviously, the more bits you have and the larger the problem you’re tackling, the advantages of a quantum computer become more pronounced.
In practice, though, it’s not quite as efficient for a number of reason. The first is that quantum results are *probabilistic*, not deterministic. In other words, quantum calculations don’t give you an exact answer. They give you a range of potential results from your calculation. Sometimes, because of this nature, your quantum system will give you the wrong answer. The real answer to the factors of 2,257 are 37 and 61, but sometimes a quantum system would tell you that it’s 35 and 63 (or any other figure). 37 and 61 are the *likeliest* answer, but any other answer is possible. So to combat this, you often have to run your calculation multiple times so that you can identify the “correct” answer.
The second reason it’s not as efficient is because calculating on quantum states is *hard*. There are a number of ways to create qubits, but all of them require rather extreme situations. Something like… 150 cesium atoms suspended in an ultracold state at 0.1 degrees Kelvin in a laser trap, with calculations performed by nudging individual electrons with a laser pulse. And each attempt to manipulate the system risks collapsing the quantum state into a classical state. And finally, while a quantum system can calculate many states at once, it doesn’t compute those states as quickly as a traditional computer will. Yes, I can calculate my factors in one pass instead of 12, but it probably took me longer to do that one pass than it did my 12 passes on a modern computer.
So, the tl;dr: Quantum computers work by manipulating quantum elements to perform calculations for you. This lets you take advantage of massive parallelism to do multiple calculations at once. That’s why quantum computers are a subject of research. But the drawback is that quantum computers, at present, are finicky, difficult and expensive to deliver performance that isn’t even comparable to modern computers.
Latest Answers