# How do we measure the probability of outcomes in a quantum computer if qubits collapse when measured?

I understand the idea behind Quantum Computing being that we superpose all possible states of a system of qubits and amplify the probabilities of whatever it is that we want depending on the circuit we are making. However when using something like Qiskit the output comes as the frequency of observations, so for example, the $$\left|00\right>$$ state was measured 150 times, and the $$\left|01\right>$$ state 300 times. At first, I thought that when you measured a system of qubits you would find it for example in the $$\left|00\right>$$ state. Still, then if you measured it again right after you would be able to find it in another state like $$\left|01\right>$$, so you just have to measure lots of times (like 1000) to more or less get an idea of what the probability of each output is. This is also what would make quantum computing so efficient since you run the circuit once and then you only have to measure repeatedly. However, qubits apparently collapse when measured, so if you measure the $$\left|00\right>$$ state and you measure again, it will always be in a $$\left|00\right>$$ state. How do we work out the output of a quantum circuit then? Do we have to repeat the whole process of the circuit 1000 times? Wouldn't that make it as inefficient as classical computing?

Cross-posted on physics.SE

• I think that it might be helful for you to read some introductory paper about quantum computing Commented Jul 5, 2023 at 13:58

Do we have to repeat the whole process of the circuit 1000 times? Yes, the idea of (many) quantum circuits is that they produce the desired output with some probability, and thus to ensure the success probability being high enough you run the entire thing multiple times.

Wouldn't that make it as inefficient as classical computing? No, because efficient quantum algorithms take this into account. Roughly speaking, the point is that increasing the success probability of an algorithm (that has a sufficiently high success probability to begin with) requires polynomially many additional runs, and therefore does not affect exponential advantages (if any exists).

I think you are mixing two important concepts here :

• The first one is measurement, indeed when realizing a quantum process, before measurement your system is likely to be in some superposition. More formally :

$$|\psi\rangle=\sum_{i=0}^{2^n}a_i|i\rangle= C|0^{\otimes n}\rangle$$

From a circuit $$C$$, applied on the initial n-quibit basis state $$|0^{\otimes n}\rangle$$.

When measuring, we, in the "classical realm" are going to interact with $$|\psi\rangle$$, wich is still in the "quantum realm", in superposition. A fundamental concept in quantum mechanics, is the notion of wave function collapse https://en.wikipedia.org/wiki/Wave_function_collapse, when interacting with a classical observer, $$|\psi\rangle$$ will collapse to a classical state, wich in this case will be one of the $$|i\rangle$$ (supposing it is your measurement basis) with the probability $$p_i=|a_i|^2$$

Wich is given by the Born rule https://en.wikipedia.org/wiki/Born_rule, another key concept.

After that measurement, if you again measure your state, the state you will get as an output will depend on the new basis in wich you will measure it, to get intuition about this you need to get familiar with observables https://en.wikipedia.org/wiki/Observable. If you measure it in the same basis, you will indeed get the same state. Moreover, in reality (experiments), sometimes it is not even possible to retrieve a state after a measurement, sometimes the state is "destroyed" during the measurement, and what you get is just the bit-string corresponding to the basis state measured.

• Then their is quantum computations, it is important to understand what you want to get from processing quantum information. Sometimes indeed, you'll need to realise a certain number of measurement in order to get the results (bitstring) that you want (hence need to realise a couple of time your circuit), it usually depends on the probability of getting the right bit-string at the end of your process, the efficiency/complexity of you quantum computation will depend on this probability, sometimes, for specific tasks, you'll get what you want with a single measurement, for this, you can check https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm.

To give a less theoretical example, quantum generative modelling https://arxiv.org/abs/2111.12738, wich is a classical machine learning inspired quantum process, wich aims at generating ouputs that mimic a specific model, here a fun example of famous classical generative modelling https://this-person-does-not-exist.com/en (where the model is the way human faces are). In the quantum version, measurement and process come into play in differents ways, first you need to train a quantum circuit (as in classical machine learning) for it to tailor the specific model/distribution, wich requires measurements. Once your model is trained (and suppose it's well trained), a single measurement can generate an outcome that is relevant for the purpose of the process, wich is in this case, generate new bit-strings that mimic the model it was trained for (similarly as new faces were generated in the classical examples).

I tried to give you hints of what sounded weird in your question, the bottom line being that theoretical study of quantum computing is key to get the right intuition on what could or could not be more efficient than classical computing. Quantum computing is far from being just "superpose all possible states of a system of qubits and amplify the probabilities of whatever it is that we want depending on the circuit we are making".

Hope this was a bit helpfull, cheers.

• Thanks for your answer! One final question, so then once a system of qubits is measured in the 00 state any further measurements will give the same result? I ask because in other discussions about the wave function I've read that "After it has collapsed into an eigenstate, the particle's wave function will then evolve in accordance with the Schrodinger equation. A subsequent measurement of the same attribute could result in collapse into a different eigenstate and hence a different measured value.". If this is true then after collapse a second measurement could result in for example 11. Commented Jul 6, 2023 at 11:11
• Here the problem is related with observables. When you measure a system you measure an observable. Once you have chosen wich observable to measure (wich basis in my answer), your system will end up in one of the eigenstate of the observable (one of the basis states). If, before redoing any measurment on you state, your system does not undergo any evolution/interaction, basically satying the same, another measurment for the same observable/basis will yield the same result. The only way in this case to get another result would be to change the observable to measure (change the measurment basis) Commented Jul 6, 2023 at 16:40
• In the case where, after being measured, your system undergo another unitary evolution (that can be defined by a circuit or an hamiltonian), then yes your state will evolve according to shrodingers equation and depending on the evolution, can end up in any new superposition of eigenstates of the original observable. Commented Jul 6, 2023 at 16:44

To add a small thing to the previous answers:

Usually, quantum algorithms are designed such that you will get the "correct'" answer about 2/3 of the runs. Therefore, you need to run the circuit relatively only a few times and use the majority vote method to get the correct results with a very high probability (the success probability grows exponentially with the number of circuit runs).

It is challenging to design an algorithm to get the correct answer from the measurements with high probability. This requires, for example, creating destructive interference for the wrong results, and also designing the circuit such that the final measurement results can be interpreted as the answer to the question. Since this is difficult, we do not have many useful quantum algorithms yet.