I have two states $|{\psi}\rangle = \begin{pmatrix} a_1\\a_2 \end{pmatrix}$ and $|{\phi}\rangle = \begin{pmatrix} b_1 \\ b_2 \end{pmatrix} $ that I want to "add" together. By "add," I of course mean perform the xor operation $|{\psi} \oplus {\phi}\rangle$.

I have an intuitive understanding of what this means since I'm familiar with bitwise operations, but I'm struggling to understand what the resulting state would look like.

My initial thought was to split the states into the logical basis and sum the components.

$a_1|{0}\rangle + a_2|{1}\rangle + b_1|{0}\rangle + b_2|{1}\rangle$

But this doesn't seem right. If my assumption that $|{0}\rangle + |{\psi}\rangle = |{\psi}\rangle$ is correct, then $a_1|{0}\rangle + b_1|{0}\rangle = a_1(|{0}\rangle + \frac{b_1}{a_1}|{0}\rangle) = a_1(\frac{b_1}{a_1}|{0}\rangle) = b_1|{0}\rangle$ which misses the point of the sum altogether.

What is my misunderstanding, and what is $|{\psi} \oplus {\phi}\rangle$ is in terms of $a_1, b_1, a_2, b_2$?

  • 1
    $\begingroup$ Does this answer (parts of) your question? $\endgroup$ Jul 18, 2020 at 4:18
  • $\begingroup$ @keisuke.akira, it does, thanks. I'll post a full response to my own question in a bit. $\endgroup$
    – Visipi
    Jul 18, 2020 at 5:30

1 Answer 1


The XOR operation is not a well defined action in quantum computing since it is non-reversible. (For example: $|0 \oplus 0\rangle = |1 \oplus 1\rangle = |0\rangle $) However, XOR is implicit in the CNOT operation, as CNOT$(|a,b\rangle) = |a, a \oplus b\rangle$ Hence to answer my own question:

CNOT$(|\psi \otimes \phi\rangle) = \begin{pmatrix} a_1b_1 \\ a_1b_2 \\ a_2b_2 \\ a_2b_1\end{pmatrix}$

If I'm not mistaken, the state of the target qubit is then given by:

$(a_1b_1 +a_2b_2)|0\rangle + (a_1b_2 + a_2b_1)|1\rangle$

Under some normalization

  • 1
    $\begingroup$ $\lvert\psi\rangle\oplus\lvert \phi\rangle$ would be simply $(a_1,a_2,b_1,b_2)$ What you are writing is the tensor product not the direct sum. If you have both states, you essentially already have their direct sum. Unless you meant to write something like $\lvert \psi\oplus\phi\rangle$, that is, you want as output the vector whose components are the bitwise sum of the components of the original states $\endgroup$
    – glS
    Jul 20, 2020 at 12:38
  • $\begingroup$ @glS, Thanks for pointing that out. I did mean to say the latter. I'll fix that right up $\endgroup$
    – Visipi
    Jul 21, 2020 at 6:38
  • $\begingroup$ I am confused, so are you saying it is not possible to sum two quantum states such that if $|\psi\rangle$ and $|\phi\rangle$ are defined as above you cannot obtain $(a_1 + b_1)|0\rangle$, $(a_2 + b_2)|1\rangle$ ? $\endgroup$ Apr 29, 2022 at 18:53

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.