# How do qubits in quantum computers work? [closed]

I was reading about quantum computers and qubits. While a classical bit can be either 0 or 1, a qubit can be 0 or 1 or both at the same time (can it be none too?). But how is this useful at all?

If it is 0 and 1 at same time then this isn't helpful at all because I need exact value.

I feel you, I hate when the somebody explains a qubit using the "0 and 1 at the same time" phrase.

I prefer the following analogy: A qubit is like a coin being tossed. It is not heads and tails at the same time. It's in a probabilistic position.

While flying, the state of the coin is not determined yet and it can be described as a probability. In case of a fair coin, we can describe the state of a flying coin as 50%-heads/50%-tails. Once the coin is "observed" (lands on the ground) its state "collapses" on the heads or tails state.

Any quantum system can be in so-called superposition state. Imagine that the system's possible states are $$s_1$$, $$s_2$$...$$s_n$$. There is also an amplitude for each state $$a_1$$, $$a_2$$...$$a_n$$ (a probability that the system is in state $$s_i$$ is $$p_i =|a_i|^2$$). Then the system can be in superposition $$\sum_{i=1}^n s_i a_i.$$ The system remains in this "uncertain" state until it is measured. At the moment of the measurement, one particular state is picked up with probability $$p_i$$ and the system collapses into this state .

In case of qubit, you have only two states denoted $$|0\rangle$$ and $$|1\rangle$$.

Besides the superposition, there is a phenomenon called entanglement. In crude description it is a link between two or more quantum systems (e.g. two, three, four...qubits). In this arrangement, behavior of one system is dermined by behavior of other systems. For example, when you have two qubits, measure one qubit and get result 0, the other qubit is automatically in state 0. To get more comprehensive description of entanglement, please check for example Wiki.

These two phenomena, i.e. superposition and entanglement, are basic building blocks of quantum computation. By exploiting them, it is possible to construct algorithms which gave quantum computers advantage (speed-up) above classical computer for specific tasks, for example searching in database (Grover algorithm), factoring integers (Shor algorithm), solving linear equations (HHL algorithm) and many others in finance, chemistry and of course physics. It is difficult to explain how these algorithms work in few words and without math. If you are more interested in quantum computing, I recommend to take a course on QC, see for example this thread for advice.