Take the 2-minute tour ×
Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. It's 100% free, no registration required.

Consider the classical XOR Gate:

Given a 2 bit system: $G = [u_1, u_2]$

$$XOR(G) = (u_1 + u_2) \ mod \ 2$$

Is the following a good generalizaiton of a Quantum XOR Gate:

Given a 2-qubit system: $Q = a_1|00] + a_2|01] + a_3|10] + a_4|11]$

We now write:

$$XOR(Q) = a_1|0] + a_2|1] + a_3|1] + a_4|0] = (a_1 + a_4)|0] + (a_2 + a_3)|1]$$

Notice that if we set $a_i = 1$ and the rest to $0$ that the quantum XOR behaves exactly like a classical XOR but it also has the ability to generalize to fractional and complex $a_i$

share|improve this question
add comment

2 Answers

Usually, a XOR quantum gate is implemented by the function :

$XOR(Q) = a_1|00 \rangle + a_2|01 \rangle + a_4|10\rangle + a_3|11 \rangle$

The first bit is conserved, while the second bit is the result of an XOR operation between the first and second bit.

For instance, if we have the combination $|11\rangle$, this means, after the transformation : $1$ for the first bit (conserved bit) and $1$ XOR $1 = 0$ for the second bit, so $|11\rangle$ transforms in $|10\rangle$

share|improve this answer
add comment

The XOR gate is almost always called the NOT gate in quantum information and computation. To implement the XOR gate unitarily one must do it in a reversible way, since unitary gates must be invertible; conversely, any reversible logic gate defines a physical unitary operation. The XOR gate is itself not invertible, since e.g. both inputs "00" and "11" yield the same output: "0".

The standard way to implement a reversible XOR gate is by means of a controlled-NOT gate or CNOT; this is the "standard quantum XOR operation". The action of this gate on a two-qubit computational basis states is

$$\text{CNOT}|a, b\rangle \rightarrow |a, a\oplus b\rangle,\quad\text{where $a,b\in\{0,1\}$}. $$

That is, the gate leaves the first bit unchanged (the control qubit) and computes the XOR gate of the two bits in the second register.

Intuitively, you can imagine the action of the CNOT gate as if it were "reading the first qubit" and doing a controlled XOR in the second qubit depending on this value. However, it is important that the gate actually performs the operation coherently (ie. without measuring the physical state)!; the action of this gate on an arbitrary input state $|\psi\rangle = \sum_{a,b}\psi_{a,b} |ab \rangle$ is

$$\text{CNOT} |\psi\rangle = \text{controlled}-\text{XOR}(Q) = \sum_{ab}\psi_{a,b}|a, a\oplus b\rangle = \sum_{ab}\psi_{a,b}|a, \text{XOR}(a,b)\rangle.$$

For the particular state $Q$ that you gave us, you would obtain $$\text{CNOT}(Q) = a_1|00 \rangle + a_2|01 \rangle + a_4|10\rangle + a_3|11 \rangle$$

share|improve this answer
add comment

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.