# How does a single-qubit gate affect other qubits?

An instructional quantum computing article I'm reading (How the quantum search algorithm works) states that the following circuit takes $$\vert x\rangle\vert 0\rangle$$ to $$−\vert x\rangle\vert 0\rangle$$, when $$\vert x\rangle$$ is anything other than $$\vert 00\rangle$$.

My question is: how can an operation (-Z gate) on the target qubit (the bottom one) affect the control qubits (the top 4 ones)?

I would expect the result of this circuit, when $$|x\rangle$$ is anything other than $$\vert 0000\rangle$$, to be $$\vert x\rangle(−\vert 0\rangle)$$. I understand that, algebraically, $$(x)(-y)$$ is the same as $$-xy$$, but intuitively, looking at this circuit, I don't see how those top 4 qubits would be affected by something happening to the bottom qubit. (I know, intuition doesn't have much place in quantum mechanics.) My hunch is that entanglement is at play.

• Hi! Welcome to QCSE. How are you interpreting $\vert x\rangle -\vert 0\rangle$? If $\vert x\rangle$ is four qubits, and (the bottom) qubit $\vert 0\rangle$ is only one qubit, then it's not clear that you can subtract only one qubit from four. Nov 1 '19 at 21:08
• Hi! (Thanks for the edits.) I'm not interpreting it as subtracting |0⟩ from |𝑥⟩. I'm interpreting it as -|0⟩ "next to" |𝑥⟩. And what "next to" means, I have no idea! But it appears, from what I infer from the article, that |𝑥⟩−|0⟩ is the same as −|𝑥⟩|0⟩, so I assumed these objects follow the same rules as terms that are multiplied together (i.e. (𝑥)(−𝑦) is the same as −𝑥𝑦). Nov 1 '19 at 21:27

The phase of -1 generated on the ancilla is just a global phase. You can shift it to any qubit without affecting the statistics of the system. Nothing to do with entanglement.

Quantum mechanics is a mathematical framework that describes reality insofar that it predicts the correct observable statistics of a system. Shifting around a global phase factor from one qubit to another doesn't cause any deviation in the observable statistics and thus, they're all equivalent quantum states of the 5 qubits, mathematically as well as physically.

## $$-(|x\rangle\otimes |0\rangle) \equiv |x\rangle \otimes (-|0\rangle) \equiv (-|x\rangle)\otimes|0\rangle$$

As you're beginning to learn quantum computing you'll soon also hit another conceptual block.

Though your question doesn't ask about it, I'll briefly point out a couple of things. For some reason people seem to believe that state of control qubits should not change when a controlled-$$U$$ gate is applied. The actual statement is that only the standard basis states $$|\{0, 1\}^c\rangle$$ ($$c$$ being the number of control qubits) remain unaffected by controlled-$$U$$ gates.

If the control qubits are in a state that is different from one of the standard basis states, then theoretically their state could very well be affected. Moreover, as Niel de Beaudrap beautifully illustrates here, you should not attach too much significance to the standard basis!

The phenomenon is known as phase kickback mechanism:

If we apply a controlled-$$U$$ gate to $$|\psi_k\rangle$$ (an eigenstate of $$U$$; $$e^{i\phi_k}$$ being the eigenvalue), $$|\psi_k\rangle$$ is unchanged, and $$|0\rangle\langle 0| + e^{i\phi_k}|1\rangle\langle 1|$$ is applied to the control qubit.

For a detailed explanation, check DaftWullie's answer and the subsequent discussion in the comments.

This is not an attempt to answer the question directly, but might help with the intuition. They key point is that multi-qubit gates can propagate the effect of a single-qubit rotation to other qubits. So, there's the technicality of what effect is propagated that I'll leave to other answers, but just to convince you that it can propagate:

Take a very simple circuit of two qubits. We apply the sequence SWAP - single-qubit rotation on qubit 2 - SWAP. I hope you'll agree that the net effect of this is simply that the single-qubit rotation is actually applied to the first qubit, not the second. So, it's all about those multi-qubit gates...