r/askscience • u/datums • May 16 '13
Physics If a quantum computer is basically trying all the solutions at once, how does it know which is the correct solution?
347
Upvotes
r/askscience • u/datums • May 16 '13
216
u/amateurtoss Atomic Physics | Quantum Information May 16 '13 edited May 17 '13
Quantum computers don't "try all solutions at once". This statement is predicated on real-world (i.e. classical physics assumptions) that don't all hold up. There is a model of computation that does "try all solutions at once" called a Non-deterministic Turing machine, but it is widely believed to be impossible to simulate by a conventional Turing machine in polynomial time. (The P v NP question).
When you say "try a solution," you imagine an oracle of some kind, like in Nethack or Delphi that will answer your questions. When you try many solutions at once, you may imagine that you ask every query to every oracle at once.
But that's not how quantum computers work, really. In a classical computer, you could imagine a model like that. Each gate is performing a query on some inputs and using those queries, they perform other queries. At each stage in the computation, you could measure the state of the computer and have some answers to some questions.
Example: You want to add 3 + 3. Computer looks at this as 11 + 11 in binary.
It adds the units digits together to get the first digit is 0 and the second digit is 1 + 1 + 1 mod 2 = 1. And the third digit is 1. Each of these computations involves partial information. For instance, after the first computation, we know that our solution is an even number, thus eliminating half of the possibilities.
So now we think about quantum computers and we realize they work very differently. Instead of performing queries and storing them in a register, they build up massive superposition states and perform partial measurements. So those are kind of made-up words (made up by quantum physicists in the 1920's) but quite invaluable.
A superposition state is an explicitly quantum state where the true state of a system (a state is a variable that stores all meaningful physical information about something) is given by a set of possible outcomes rather than by a single outcome. This is not a very strange concept naively. For instance, we consider ordinary matter to have a Temperature which specifies a set of possible energy states that the matter can be in. We don't know the exact energy of every molecule in a cup of coffee, but we have a pretty good idea of the average.
In quantum computing, however, the superposition state of a system is not just a statement of our uncertainty about the state variable. The state just has many measurement outcomes.
Someone had the bright idea that if we purposely create this bizzare state of matter up correctly, we can prepare it in massively superposed ways and then interfere states with eachother.
Thus, we can build up computations with special rules, where some final states are allowed and others are not. Instead of thinking of the quantum computer as "trying every solution at once", it may better to think about it as "imposing certain special rules on a big state and then seeing what that implies".
The principle difference is that quantum computers don't have any partial queries.
Another way to look at this is the difference between classical and quantum information. We believe that there is a different type of information content contained in quantum systems that has weird properties: It can travel faster than light; it cannot be cloned or copied; we don't know very much about it.
This quantity is fundamental to our advances in quantum computing but it works very differently than many articles lead one to believe.
tl;dr:
Thanks, Velcommen
51
u/RckmRobot Quantum Computing | Quantum Cryptography May 16 '13 edited May 16 '13
Short answer: it doesn't know which is the correct solution. It gives what it thinks is a solution and it should be easy to check that answer using classical computers.
For example, with Shor's algorithm for factoring numbers, you get guesses with high probabilities of being factors of the number. Say you give a quantum computer running Shor's algorithm the number 15 to factor. It runs through its factorization technique and then uses a Quantum Fourier Transform (QFT) to try to narrow down the "most likely" answers by increasing the probability of those numbers being outputted on measurement.
Since a quantum computer can only provide a single answer, there is always a non-zero probability that it is straight-up wrong, like saying that maybe 4 is a factor of 15. Sometimes it isn't wrong, it provides a useless answer, like saying that 1 is a factor of 15. Often, though, it will provide an answer like 3 or 5.
If it only provides guesses, then what is the advantage? Its that problems like factoring large numbers
areNP-completeappear to be difficult problems, which here means that while its very difficult to factor large numbers quickly, it is extremely simple to check if a number is a factor of another number. So we take all of these outputs of the quantum computer and check them, and even if it takes the quantum computer 100 guesses, that's still orders of magnitude faster than how much time a classical computer would have taken to do the task.Edit: Fixed a mistake pointed out by /u/Olog
5
u/smog_alado May 16 '13
I would highly recomend checking out this article by Scott Aaronson if you want a quick overview of what quantum computers are about and what they can and can't do.
The TLDR is that quantum computers do not work by trying all the solutions at once and picking the correct one. Instead of checking each alternate solution, you magically add all of them up back together and this sum will be the answer (assuming you set the computations very carefully so that this is the case)
2
u/ShaggySham May 16 '13
Would the use of a quantum computer basically make all of us vulnerable to hacking?
1
u/garblz May 17 '13
This is by far the best explanation I read on the web.
It explains how Shor's algorithm works, which is the quantum algorithm. Meaning that if we could make it work, we'd be able to break all current computer encryption in no time.
This is the first article I saw that uses only arithmetic to explain the topic, I'd risk saying in a concise, clear style, resembling Richard Feynman's. You need to have some techincal inclination to understand it, but not much beyond primary school (do they teach modulo arithmetic there these days? Jeez I'm so old...).
It also explains how quantum computing is not exponential parallelism.
-10
u/rlbond86 May 16 '13 edited May 16 '13
Quantum algorithms are good at solving BQP problems. In layman's terms, these problems are hard to solve worth classical computer algorithms (but not with quantum algorithms), but it is very easy to check if a potential solution is correct. So they use a classical algorithm to verify the solution.
EDIT: My bad, they solve BQP problems, some of which are NP problems, but the relation between BQP and NP is unknown.
-9
u/0r10z May 16 '13
Let me simplify the answer. All solutions are tested at the same time. The one or more tests that come back with a "true" are the solutions.
-4
u/foofdawg May 17 '13
Do you know about IP network concepts?
It's a bit like asking which IP addresses fit a certain subnet mask and network address.
It just has to compare 1's and 0's and determine if they fit into a particular pattern.....only on a MUCH MORE complicated level.
-5
u/Troll-Boy May 17 '13
The one that works. Thank you