Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

According to IBM's website,

[...]where we would [classically] have done an assignment (x=y), we instead initialize the target (x=0) and use exclusive or (x^=y).

This sounds like x is a copy (clone) of y, however cloning is impossible in quantum mechanics. What's going on?

share|cite|improve this question
Continue reading to example 9. – user2963 Oct 31 '12 at 21:10
up vote 4 down vote accepted

This is a standard trick in quantum computing: to allow reversibility when computing some function $f$, you keep all the inputs and you encode the result in an initially "blank" qubit set initially to $|0\rangle$. What you're describing is the simplest case: one single input qubit, and $f$ equal to the identity function.

Thus, you want your gate to take the state $|0\rangle|0\rangle$ (where the first qubit is the input and the second is blank) to $|0\rangle|0\rangle$ (i.e. keep the first one and compute on the second one), and to take $|1\rangle|0\rangle$ into $|1\rangle|1\rangle$. As the IBM website points out, one can do this with a CNOT gate controlled on the first qubit.

The no-cloning theorem, however, is not broken. Consider what happens when you input some general state $|\psi\rangle=a|0\rangle+b|1\rangle$: by linearity, the output will be $$a|0\rangle|0\rangle+b|1\rangle|1\rangle.$$ This is an entangled state, and definitely not equal to the cloned state $|\psi\rangle|\psi\rangle$.

The way to interpret this is that the standard classical logic gates - assignment, OR, AND, etc. - are indeed implementable exactly as in (reversible) classical computing for the computational basis, but their behaviour on a general state is then fixed by linearity and must then be examined to see what it comes out as. Thus "assignment" works on the computational basis but not for a superposition state. Other gates like AND or OR don't even make much sense as such if their inputs are in (separable) superpositions or even entangled.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.