# CNOT entangling a third qubit and how measurement impacts entanglement

I'm trying to understand entanglement, superposition and the effects of measurement on entangled qubits a bit better.

I know that the circuit below will entangle the two qubits:

The question is, if I add a third qubit and a CNOT gate, as below, can we say that q2 is entangled with q0 as well?

I mean, can I actually use the CNOT gate to entangle multiple qubits like that (considering that the first two are already entangled)?

What if I apply another CNOT like below, will it kill entanglement between q2 and the other two qubits? or will it just have no effect?

And if I measure q2 at that point, will q0 and q1 still be entangled? I assume that if q2 is at any point entangled with the other two qubits, if you measure q2, then the other two qubits will collapse immediately (as per the "spooky action at a distance" behaviour).

• These are all fine questions, but have you worked out the state yourself? Do you know what the GHZ state is? Aug 18, 2022 at 12:57
• yes, I tried this in IBM quantum composer, but I don't know how to check if the states are still entangled after measurement of q2, for example. Thus the conceptual questions to figure out if there is entanglement at all. I didn't know about GHZ.. googling it now. Thanks for the tip! Aug 18, 2022 at 13:13

The question is, if I add a third qubit and a CNOT gate, as below, can we say that q2 is entangled with q0 as well?

Yes.

I mean, can I actually use the CNOT gate to entangle multiple qubits like that (considering that the first two are already entangled)?

Yes.

What if I apply another CNOT like below, will it kill entanglement between q2 and the other two qubits? or will it just have no effect?

In that specific case, yes. Because applying $$CNOT(0,1)$$ with a consequitve $$CNOT(1,2)$$ - For $$q_2$$ it's like applying $$CNOT(0,2)$$ (Given that the initial state of $$q_1$$ is indeed $$|0\rangle$$).

And if I measure q2 at that point, will q0 and q1 still be entangled?

Yes, $$q_0$$ and $$q_1$$ will still be entangled after you measure $$q_2$$ because as aforementioned, the combination of gates being applied canceled the entanglement created at first.

I assume that if q2 is at any point entangled with the other two qubits, if you measure q2, then the other two qubits will collapse immediately (as per the "spooky action at a distance" behaviour).

This assumption is wrong. If $$q_2$$ would have been entangled at this moment, then a collapse would have occured in the qubits entangled to $$q_2$$. But $$q_2$$ is not entangled when measured.

I have added some barriers to your circuit so that we can speak easily on the statevector's evolution:

Using little-endian - as in Qiskit:

1. In the first line the statevector of the system is $$|\psi_1\rangle = \frac{1}{\sqrt{2}}(|000\rangle + |011\rangle)$$. $$q_0$$ and $$q_1$$ are entangled with each other.
2. In the second line the statevector of the system is $$|\psi_2\rangle = \frac{1}{\sqrt{2}}(|000\rangle + |111\rangle)$$. Now all the 3 qubits are entangled.
3. In the third line the statevector of the system is again $$|\psi_3\rangle = \frac{1}{\sqrt{2}}(|000\rangle + |011\rangle)$$. $$q_2$$ is no longer entangled.
4. In the fourth line - $$q_2$$ is "out of the game" because we measured it. $$q_2$$ is not entangled at the point of measurement so it doesn't affect the statevector of the system (which is now consisted of the qubits $$q_0$$ and $$q_1$$). So in the fourth line the statevector of the system is $$|\psi_4\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$$.

I think that treating entanglement as a "spooky" or some magical phenomenon causes confusion. Try thinking about entanglement as correlation created between quantum bits due to superposition and controlled operations. Any unitary operation in a quantum circuit is reversible so it's not surprising that entanglement can be undone - like any other unitary operation in a quantum circuit.

• @Maruicio It is a bell state times a $|0\rangle$ - I am using little endian notation as Qiskit does. Or I misunderstood something..?
Aug 18, 2022 at 13:18
• you are right I misread your state. Aug 18, 2022 at 13:20
• you guys are amazing! thank you so much for these great answers! Aug 18, 2022 at 13:35

Yes CNOT gates are entangling gates and yes you can use non-local CNOT operations to entangle distant qubits. For the first and second figures they did generated entangled states. I will use the ZX-calculus in what follows because I think they are very intuitive. The circuits in the ZX-calculus can be read as:

which is an entangled state with entanglement between two qubits. The first equality is simply a translation between the circuit depicted into the ZX-diagrams. In the diagram it is intuitively expressed the idea that measurement on one qubit affects the other by the 'c shape'. For the second diagram we have,

This is also an entangled state; (both entangled states considered are very famous!) It is true that two CNOTs may destroy entanglement as well because essentially CNOTs are identity when applied twice. In the ZX-calculus this is expressed by the fact that sequentially applied CNOTs will be affected by the Hopf rule.

That will imply for your third circuit-diagram,

which clearly depicted the fact that we have no longer entanglement between all 3 qubits. I hope that this was helpful at least from a conceptual point of view.

Can you go on reasoning about the measurement part?

• indeed, it was very helpful! Thanks for that. You mentioned two concepts I hadn't heard about before: ZX-calculus and the Hopf rule. And that's great. As a computer scientist, I miss the physics background when working with the circuits, so it's great when I stumble upon new things to learn. Thanks again for the the detailed answer! About measurement, I would like to know if I can find out if two qubits are entangled just by running these operations and measuring an ancilla qubit. I thought this measurement in q2 would mess up the state of the other two qubits (q0 and q1) Aug 18, 2022 at 13:27
• I'm happy my answer was useful. I hope you have a good time learning quantum computing.
– R.W
Aug 18, 2022 at 13:29

Start with $$|000\rangle$$.

1. Apply $$H$$ to qubit 0, you get $$\frac1{\sqrt{2}}(|0\rangle+|1\rangle)|00\rangle$$

2. Apply CNOT to qubit 1 controlled by qubit 0, you get $$\frac1{\sqrt{2}}(|00\rangle+|11\rangle)|0\rangle$$. Now qubit 0 and 1 are (maximally) entangled.

3. Apply CNOT to qubit 2 controlled by qubit 0, you get $$\frac1{\sqrt{2}}(|000\rangle+|111\rangle)$$. This is called a GHZ state, in this state all the qubits are entangled. Notice that if you know the state of qubit 2, you know the state of the rest.

4. Finally, apply apply CNOT to qubit 2 controlled by qubit 1, $$\frac1{\sqrt{2}}(|00\rangle+|11\rangle)|0\rangle$$. So we basically undid step 3.

When you only have Clifford gates ($$X,Y,Z,H,$$CNOT) and a reduced number of qubits it is better to just work out the calculation by hand.