From what I'm reading, building the constant-1 and constant-0 operations in a quantum computer involves building something like this, where there are two qubits being used. Why do we need two?

enter image description here

The bottom bit in both examples is not being used at all, so has no impact on the operation. Both operations seemingly only work if the top qubit's initial value is 0 so surely what this is just saying is that this is an operation which either flips a 0 or leaves it alone - in which case what is the second qubit needed for? Wouldn't a set-to-0 function set the input to 0 whatever it is and wouldn't need one of its inputs to be predetermined?

Granted, the 'output' qubit is for output, but it's value still needs to be predetermined going into the operation?

Image is from this blog but I've seen it come up in other blogs and videos.

  • 1
    $\begingroup$ The idea is that all quantum operations are unitary and hence reversible. If you map all the input to the value 0 or 1 then it is not a reversible operation since you can't reconstruct the input if I just give you the output value. For instance, the XOR function, which takes $\{x_1 = 0, x_2 = 0\} \to 0$ , $\{x_1 = 0, x_ 2= 1\} \to 1$, $\{x_1 = 1, x_2 = 0\} \to 1$, and $\{x_1 =1, x_2 = 1\} \to 0$ is not a reversible function. Similarly, AND operation is also not reversible and so to implement this on a quantum computer you need to add additional ancilla qubits as well. $\endgroup$
    – KAJ226
    Commented Oct 27, 2020 at 21:22
  • $\begingroup$ Sure, but it only works, like I said, if you have an input Qbit that is already set to 0 - it's not like an XOR where the inputs can be anything and it still works. Or is your point that because we have this constraint of $constant-0$ and $constant-1$ only accepting $\{x_1 = 0, x_2 = 0\}$ and $\{x_1 = 0, x_2 = 1\}$ as input what makes it non-reversible? (because if we thre away the $x_1 = 0$ constraint the circuit would be reversible) $\endgroup$ Commented Oct 28, 2020 at 15:08

1 Answer 1


Indeed, the second qubit is doing nothing in these circuits, so you can ignore it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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