# Generic maths for two-qubit gates [closed]

How's the generalized behaviour of a two-qubit gate for the resulting two qubits?

Here e.g. CNOT:

If I apply the CNOT matrix to the tensor product, also the control qubit seems to get affected:

Control qubit

$$\text{ctrl} = \begin{pmatrix} x \\ y \end{pmatrix}$$

Target qubit $$\text{target} = \begin{pmatrix} \alpha \\ \beta \end{pmatrix}$$

Tensor product tp:

$$\text{tp} = \text{ctrl} \otimes \text{target} = \begin{pmatrix} x \\ y \end{pmatrix} \otimes \begin{pmatrix} \alpha \\ \beta \end{pmatrix} = \begin{pmatrix} x\alpha \\ x\beta \\ y\alpha \\ y\beta \end{pmatrix}$$

Applying the CNOT gate with control qubit a and target qubit b:

$$\text{res}_1 = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ \end{pmatrix} \begin{pmatrix} x\alpha \\ x\beta \\ y\alpha \\ y\beta \end{pmatrix} = \begin{pmatrix} x\alpha \\ x\beta \\ y\beta \\ y\alpha \end{pmatrix}$$

How to get the two results for the both qubits a and b out of this res1 vector representation (tensor product of the two resulting qubits?)?

Acc. to the linked answer, the resulting value for the target qubit b may be the vector built from the upper two values, i.e.

$$\text{res}_\text{target} = \begin{pmatrix} x\alpha \\ x\beta \end{pmatrix}$$

Does the control qubit also get affected in that case? e.g.

$$\text{res}_\text{ctrl} = \begin{pmatrix} y\beta \\ y\alpha \end{pmatrix}$$

Clearly building the tensor product of those two results wouldn't result in the

You seem to be confusing tensor product and direct sum. Direct sum is the stacking of top two over bottom two, but tensor product is as you wrote with quadratic combinations of the coefficients. This is because of the unfortunate situation that $$2*2=2+2$$.

So you are correct in getting

$$\begin{pmatrix} x\alpha\\ x\beta\\ y\beta\\ y\alpha \end{pmatrix}$$

for the composite system. But you can't just take top two and bottom two entries to get results for target and control. That would be the direct sum decomposition not the tensor product decomposition.

That was just a coincidence in in the other answer. $$x=1$$ and $$y=0$$ there so the top two happened to give you the correct coefficients for something you could interpret as $$res_{target}$$.

But in this case you can't get back to something of the form $$res_{control} \otimes res_{target}$$, let alone being able to read them off from a direct sum decomposition.

• thanks - all answers are actually useful by indicating that I didn't read/understand the properties of the CNOT gate properly: The CNOT creates an entangled state, thus the two qubits can not be described independently, apart from some exceptions (e.g. the control qubit being |1> or |0>). – radix May 23 at 15:17

So it is easier to understand if we properly write out the state of the system:

$$|\phi\rangle = (x|0\rangle + y|1\rangle)\otimes(\alpha|0\rangle + \beta|1\rangle) = x\alpha|00\rangle + x\beta|01\rangle + y\alpha|10\rangle + y\beta|11\rangle$$,

you can see now that the cnot will only invoke $$\sigma_x$$ on the second qubit when the first qubit is $$1$$, so the output state afterwards will be:

$$C^1(\sigma_x)|\phi\rangle = x\alpha|00\rangle + x\beta |01\rangle + y\beta |10\rangle + y\alpha|11\rangle$$,

so you can see in your vector output you are correct, but you have to remember the actual states and the basis you are corresponding to rather than the amplitudes representing the states as you had assumed.

The main issue is that CNOT gate creates an entangled state, i.e. state of one qubit is dependent on other one. If a state is entangled, you cannot write it down (decompose) as a tensor product of two (or more) qubits.

You can see this nicely on coefficents. While $$x\alpha$$ and $$x\beta$$ remained on same places in output vector, $$y\alpha$$ and $$y\beta$$ are switched. It is not possible to find tensor product of two vectors which would allow you to have $$\alpha$$ and $$\beta$$ on first and second coordinate, respectivelly and then $$\beta$$ and $$\alpha$$ on first (third) and second (fourth), respectively.

EDIT:

Just note that in some special cases, an output of CNOT gate can be decomposed to tensor product. For example if the input are z-basis states:

• $$CNOT(|00\rangle)=|00\rangle=|0\rangle\otimes|0\rangle$$
• $$CNOT(|01\rangle)=|01\rangle=|0\rangle\otimes|1\rangle$$
• $$CNOT(|10\rangle)=|11\rangle=|1\rangle\otimes|1\rangle$$
• $$CNOT(|11\rangle)=|10\rangle=|1\rangle\otimes|0\rangle$$