In the algorithm “Testing in Pairs”, we test which pair has resulted in the phase flip, but when writing the algorithm, we only test for the last qubit. Can it be possible that the secret key is somewhere in the middle?
I am not able to understand why we only focus on the last qubit and apply Hadamard gates only to the last qubit?
Hi @Krishna_Bhatia, welcome to the Forum!
Are you referring to Codercise A.3.1?
In this Codercise each pair of possible solutions x and y is represented by \tilde{x}, which is the input state for the first n-1 qubits.
So what we’re looking for here is not “where is the secret key”. The question is “is either x or y the right solution?”.
If the answer is yes, then the last qubit will be in state |1\rangle. If the answer is no, then the last qubit will be in state |0\rangle.
So what this means is that we only need to measure the last qubit to know whether the secret key is contained in the pair that we sent as an input.
Is this more clear?
I hope this helps and let me know if you have any further questions.
1 Like