# How Are Quantum Computers Able to Store Any Data at all?

So if qubits can have more than two states, and according to this video, https://www.youtube.com/watch?v=T2DXrs0OpHU you don't know what you get until you actually "open the box", if its all randomness and probability,then how can it store anything? Like, if you tried opening your word document, won't it show up differently everytime you opened it? Sorry if some of my questions seem stupid, I'm a high school student who has just recently gotten interested in quantum computing.

• It's not "all randomness and probability". Actually, none of it is, but you have to study quantum mechanics in some detail to understand the difference between "randomness" and "uncertainty. The result of a quantum computation is perfectly classical and intermediate results can only be stored in the computer itself and they can not be read out, that would destroy the computation. That's a major difference to classical computers. A QC can't just stop a computation and then do something else and later go back to it, which is the way we operate classical computers. For QCs it's all or nothing. – CuriousOne Apr 6 '16 at 15:58

When you measure a qubit, you force it to be (and find out if it's) either all-On or all-Off. If it was all-On, flip it over. Now the qubit is definitely all-Off.

Use that process to zero as many qubits as you need, then run your computation.

Note that the process I described isn't creating neg-entropy (which would violate thermodynamics). It's moving neg-entropy out of the environment and into the qubit. Which becomes very clear to me when I look at a circuit diagram of the process:

If the bottom wire didn't start out in a known state (Off in this case), the circuit wouldn't do what the state displays say it's doing. Fortunately we happen to have this giant space nuclear furnace providing an ample supply of neg-entropy.

With quantum computers, as with classical computers, the initial states (variables) are set at the beginning of the process.

Suppose you write an ordinary computer program to find the largest prime number less than $N$; you might use the Sieve of Eratosthenes. At the end of the process your computer program has many numbers in its working memory, and you must select the result and share it with the outside world through some output channel, such as a display or a message.

There are currently only a few quantum computing algorithms, and each has a method for extraction of the solution. Quantum information and cryptography are related fields which use the same quantum techniques.

It is a very rich field, and requires a background in mathematics and computer science; if you are interested in building such devices, it requires a very strong background in physics and engineering.

Just as in the early days of computing, there are no programming languages. Instead you work with a series of quantum logic gates, each of which can be represented by a matrix. This means that the mathematics required is linear algebra, which includes the study of matrix algebra.

In a computer program, how would you go about swapping the contents of two variables? It is a basic, but well-noted problem in programming because once you assign the value of one variable to the other, you've lost the information contained to perform the operation on the other variable.

So, a common approach is to use a third variable:

Swap a, b
c = a
a = b
b = c


A lesser known approach is to have one variable hold information of both, without requiring the use of a third variable:

Swap a, b
a = a + b
b = a - b
a = a - b


The end result is identical. The value of a and b are swapped, but in the second case, you did so without requiring additional storage. There are several complications that I won't delve into as to why the second technique could be problematic, but with relatively small values of a and b, you can do it this second way.

A qbit could be thought of as holding the cumulative states of 0 and 1. By performing operations on these qbits, similar to how variable a and b temporarily held the values for both a and b without requiring a third variable. And, in a certain sense, it holds much more information than a 0 or 1 ever could hold. Once it is measured, the wave collapses and you're given what is very likely to be a very close approximation if not a perfect answer. The fact that it can represent a value between 0 and 1 means that it can compound operations that all values in the solution space would have and so rather than having to deal with every possibility, you're only dealing with one, reducing the amount of time significantly.

As of now, only specialized calculations can be performed so it isn't likely going to replace the functionality of modern CPUs, but we're always trying to imagine new ways of using this new technology. Your generation may yet see the creation of CPUs with quantum cores.

Many quantum algorithms (such as Grover's algorithm for efficient searches) do have a probabilistic result- after you run the algorithm and make a final measurement, there is some probability that you would get the correct result, and some probability that you'll get a wrong result. But the probability of getting the wrong result decreases with each successive time that you run the core algorithm, so all you have to do is run it until you only have 0.01% chance of error or whatever acceptable margin you choose.

As Peter Diehr has said, designing a good quantum algorithm is difficult, because you have to find some trick that will result in the probability of the correct answer increasing each time. If you can't manage this, then indeed you do basically get a random result each time you run the algorithm, and it is completely worthless. For now it seems that this is only possible for certain very specific algorithms, so most likely quantum computers will be used only for these special jobs and will not replace regular computers for things like running a word processor.

What does it mean to say that a system can be used to store information? It means you can change the state of the system so that if you look at it you will find out something you may not have known before.

In general, quantum mechanics predicts probabilities of outcomes of measurements of a system. And quantum mechanics doesn't just apply to microscopic objects, it also applies to everything around you. A quantum computer would be capable of simulating any physical system to any desired degree of accuracy, and so it could simulate the behaviour of a relatively large object like your computer.

The probability of a particular outcome when measuring some particular property of a quantum system may be one. For example, if the fourth letter in your Word document is "a", the probability of seeing the fourth letter is "a" is one. A quantum computer simulating your computer would then store the value of that letter. This wouldn't be a good use of a quantum computer, but the laws of physics don't rule it out.

For some other systems the probability of a particular outcome may not be one. For example, the probability of an atom undergoing radioactive decay after two minutes may be 1/5, say. If a quantum computer was simulating the atom accurately, then the probability of the outcome of seeing a value in the computer that said the simulated atom had decayed would be 1/5. You could find that out by running the computer many times. Now, if you programmed the computer with an inaccurate model, it may give a value for the probability of the decay different from 1/5, let's say 1/6. You would then find out that the model you had programmed into the computer didn't accurately represent what the system was doing. So since you have found something out by measuring the computer, it was storing information. The fact that the information happens to be about probabilities doesn't change the fact that it is information.

For some more explanation of quantum computing, see "The Fabric of Reality" by David Deutsch, Chapters 2 and 9 and "The Beginning of Infinity" by David Deutsch, Chapter 11.

## protected by Qmechanic♦May 14 '16 at 12:36

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).