# How do I "add" two qubit states?

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$$?

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

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

• $\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
– glS
Jul 20 '20 at 12:38
• @glS, Thanks for pointing that out. I did mean to say the latter. I'll fix that right up Jul 21 '20 at 6:38