# What happens to the elements of the simulated state vector when we set a qubit to $|0\rangle$?

In IBM's Qiskit online simulator, we have the (non-reversible) ability to set a specific qubit to $$| 0\rangle$$. This is convenient but I'm left confused as to what happens to the elements of the statevector. The amplitudes must go somewhere so the probability is conserved, and I imagined at first that the 0 component for each 'Hadamard pair' absorbs the missing amplitude. But this does not take the phase into account.

What happens in the simulator when we set a qubit to $$|0\rangle$$?

Applying a reset to a qubit is equivalent to measuring it, and then applying a bit flip to it conditioned on the measurement result.

def reset(qubit):
if measure(qubit) == ON:
X(qubit)


For example, in this Quirk circuit, you can see that the post-reset state matches the state you'd get when conditioning on a measurement-via-ancilla+bit-flip of the target qubit:

An equivalent reset, but perhaps more "physically accurate", is to swap the qubit for a fresh ancilla, then discard the ancilla.

def reset(qubit):
ancilla = new_zero_qubit()
swap(ancilla, qubit)

• Perfect, thank you! Are there instances where these results would give states which differ by a global phase (In my attempts to implement an ancillary qubit reset, I succeed in most cases, but in some am off by a global phase of $\pi$ when compared to IBM)? Jan 10 at 4:11