# What observable do we measure at the end of a quantum search algorithm?

In the quantum search algorithm below, also known as Grover's algorithm, what observable do we measure at the end of the protocol?

That is, in the red box, it says "measure the first $$n$$ qubits", but which observable are we measuring?

Thanks.

Usually, when we don't specify, we measure in the computational basis, i.e. each qubit is measured using the observable $$Z$$.
• I see, but in that case, how can we output the string of classical bits $x_0$ by measuring Z on the final state of the algorithm? Since the possible outcomes of Z are 1 and -1. Do we simply agree to associate the outcome 1 to the bit 0, and the outcome -1 to the bit 1? – Stephen Feb 11 '20 at 21:04
• Yes exactly. We measure every qubit in Z basis, and if you get a 1 as output for the nth qubit, then you set the nth bit of $x_0$ to be 0, if you get a -1 then you set the bit to 1. – Léo Colisson Feb 11 '20 at 23:26