# IBM quantum experience: Why are intermediate measurements ignored?

Why am I getting here a measurement outcome of $$00$$? I measure after the first $$X$$ gate in a separate output bit c[1] which should result in a $$1$$ and I measure again after a second $$X$$ gate in a separate output bit c[0] which should result in a $$0$$, so $$10$$ in total. Why do I get the output $$00$$ as if both measurements are performed after the whole circuit? And how can I do intermediate measurements as expected?

The problem is that IBM Q shows results of measurement of a final quantum state (I found this after some trial and error).

When you apply first $$X$$ gate, qubits switches from $$|0\rangle$$ to $$|1\rangle$$. The measurement result is of course 1 and this value is stored in classical register, hence you see 10 in Measurement probabilities window.

Now you apply another $$X$$ gate and this switches your qubit back to state $$|0\rangle$$. So, after measurement you see 0 in classical register. As I mentioned above, only final state probabilities is shown Measurement probabilities window. So, yes, the first measurement is really ignored and it seems that this is a feature of IBM Q environment, although logic says that if you save results to different classical bits, they should be preserved.

• I think the IBM devices are not even capable of performing intermediary measurements... – JSdJ Dec 10 '20 at 9:57
• Maybe getting the state vector after the quantum operation and then randomly pick one state(although there might be technical issues obstacle this strategy) according to the probability distribution to initialize another quantum register is a possible way to perform intermediary measurements. But this is a pureely coding job and seems more like "I do so"? – Yitian Wang Dec 16 '20 at 1:13

The first measurement is not being ignored.

Your quantum state started in the state $$|0\rangle$$ and after the $$X$$ gate, it is now in the state $$|1\rangle$$. Measuring the qubit collapsed it into the state $$|1\rangle$$ again... since $$|1\rangle$$ is already an eigenvector of the $$Z$$ Pauli operator.

So your state never changes after the first measurement, you still in the state $$|1\rangle$$. Thus, after applying another $$X$$ gate, you get back to $$|0\rangle$$. That is the reason why you only see $$0$$ is being measured.

Edit: My comment about the first measurement "not" being ignored when looking at the measurement probabilities is incorrect.

However, the first measurement is not being ignore in the experiment overall... That is, say you start in the state $$|0\rangle$$ then apply Hadamard gate $$H$$ to it, make a measurement, apply another Hadamard gate $$H$$ and then make another measurement. If the first measurement is being ignored, then you would get back $$|0\rangle$$.. but in fact we don't:

Now, if you put the first measurement in the first cbit1 and the second measurement on the second cbit2 then you get something like:

This was being simulated on the qasm_simulator as current device is not capable of yet doing this intermediate measurement. So on the real hardware, you can't perform any additional operations after the first measurement.

Another note is that if you do this in the circuit composer environment, you get something like:

• Still hard to understand why measurement result of clbit[1] is changed. – Yitian Wang Dec 10 '20 at 9:04
• Actually, the measurement is ignored since first result (1) is stored in classical bit c1 and the second result(0) is stored in classical bit c0. But this is probably feature of IBM Q. See my answer below for details. – Martin Vesely Dec 10 '20 at 9:13
• @YitianWang I didn't see that clearly. I was just reading the right hand graph... so yes, that was a mistake. – KAJ226 Dec 10 '20 at 15:53