# What does superposition do for quantum probabilistic sampling?

The idea of a qubit being able to exist for several values between 0 and 1 (superposition) makes it sound like it can do alot for probabilistic math problems, but for one task that comes instantly to mind, probabilistic sampling, or random number generation from a target probability distribution, how would the quantum version of doing this be implemented, and where exactly does superposition kick in? For this task, does superposition get its edge due to it capturing the entire distribution all at once somehow? And are other quantum properties like entanglement also being exploited.

Besides sampling, the usage of quantum to map and pre-emptively evaluate all possible outcomes for a utility, reward or loss function, for example, all seem to be related somehow, but I still can’t see what role superposition is playing in these sort of probabilistic tasks mathematically, compared to the binary 0 (false/off/no) and 1 (true/on/yes) classical case, which itself doesn’t invoke some correspondence to the task at hand either.

Classical computers are inherently deterministic, so they either generate pseudorandom numbers, or use an external physical process with statistically random noise to generate random numbers.

Quantum computers are inherently probabilistic, so generating true random numbers is very natural for them. Quantum random number generators are already on the market (e.g., IDQ).

This circuit generates 0 or 1 on $$c_0$$, both with probability 0.5. Using $$n$$ quantum and classical registers configured identical to those above would randomly generate a number between $$0$$ and $$2^n-1$$.

In the circuit above, the Hadamard gate ($$H$$) transforms the qubit from a known state $$\vert 0 \rangle$$ to a superposition of states described by

$$H \vert 0 \rangle = \frac{\vert 0 \rangle + \vert 1 \rangle}{\sqrt{2}}.$$

If the Hadamard gate was removed, i.e. no superposition, there would be no randomness in the output since the measurement would read $$\vert 0 \rangle$$ every time (apart from noise).

More complicated circuits can be built to do more interesting sampling tasks, but I'm not sure what you are looking for specifically. This talk goes into more detail on the subject.

If you are new to quantum computing, you might need to work through a good textbook on the subject (the standard text is Nielson and Chuang) before any of this will make much sense.

• thanks for explaining the underlying concept and math. it seems like it only changes the probability of a number being sampled from the classical 0.5, but is there more on superposition possessing the existence of multiple values/probabilities at once? how would this extend to 'optimizing' an actual utility/reward/loss function in practice? also, is there a demonstrated example that is the quantum counterpart to say Python's numpy.random.randn function, for example, showing outputted real values generated by that quantum sampling function compared to a classical sampling function? – develarist Nov 15 at 9:58