# Question about implementation of a “reflection” w.r.t a state in quantum computing

I'm going through a paper that uses quantum amplitude estimation, and one of the ingredients to the algorithms is an operator that flips the sign of a state based on the state of a control qubit. Basically,

$$S_\psi |x\rangle = |x\rangle$$ if least significant bit of $$x$$ is 0 and $$-|x\rangle$$ if it's 1..

Now, naively I would have thought that just applying the $$Z$$ gate to the qubit that represents the relevant bit of $$x$$ would achieve that, would it not? If my qubit starts out in state $$\alpha |0\rangle + \beta |1\rangle$$ then after applying $$Z$$ it'll be in state $$\alpha |0\rangle - \beta |1 \rangle$$, which is exactly what I need.

The paper, on the other hand, says we need to include an ancilla bit, use the $$X$$ gate to prepare it in state $$1$$, then act on this ancilla qubit with a controlled $$Z$$ gate (controlled by the qubit representing the lsb of $$x$$) and then apply another $$X$$ gate to "uncompute" the ancilla.

But if I follow along with that logic, I'm just left with the ancilla unchanged and essentially $$Z$$ being applied to my original qubit, just as I had in the "naive" implementation.

Am I missing something subtle here or were the authors of the paper overthinking?

Later on, that whole operation that I just describes needs to be in turn controlled via some other bits, but I don't see how my naive implementation would not be able to be turned into a controlled one...

Reference: Section V in the paper "Credit Risk Analysis Using Quantum Computers". arxiv:19007.03044v1 [quant-ph] 5 Jul 2019 https://arxiv.org/abs/1907.03044

• Please give some references etc.! As you phrase it, a Z looks fine. – Norbert Schuch Aug 29 at 21:58
• it's not clear from a quick read of the relevant paragraph, but maybe they want to use the ancilla qubit to determine which state is the target one? Or there might be a reason why they cannot directly use a $Z$ on the relevant qubit? – glS Aug 30 at 20:44
• The target qubit is always the same. I don't see why you couldn't use Z directly on the relevant qubit, because it's part of other operations as well. – Lagerbaer Sep 3 at 16:03