Can we use classical XOR gate in a quantum circuit? Or are there any alternatives for XOR gate?


You can't directly use a classical XOR gate inside a quantum circuit because the usual construction of such a gate is a classical construction - it won't preserve coherence. In other words, it will function just fine if you input a 0 or a 1 as each input, but it won't perform as you'd need it to if you supplied it with a superposition.

Instead, you can build XOR out of quantum circuit elements, so that it behaves in exactly the same way as it would for classical inputs, but it does preserve superposition. Indeed, XOR is simple as a reversible circuit, just use a controlled-not! The target qubit is the output you want enter image description here You can readily verify this just by constructing the truth table.

Indeed, you can construct all classical gates in this way. For example, the AND gate: enter image description here

  • $\begingroup$ I asked the question because I came across a I-indexed journal article, in which they've used the classical XOR gate. $\endgroup$ – Govind Sep 5 '18 at 17:13
  • $\begingroup$ @user4505 I would imagine that they were implicitly recognising that quantum computers can realise classical computations. So it's absolutely fine to talk about classical computations. (It's like if you read about Shor's algorithm, there's a bit about modular exponentiation that people usually just leave out because there's a good classical circuit for doing that part, so you just implement that in your quantum computer.) $\endgroup$ – DaftWullie Sep 6 '18 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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