# Quantum circuit, two control not gates

Consider the quantum circuit in the picture below:

We have a Hadamard gate followed by a CNOT gate, this puts the 2nd & 3rd state in the bell state $\beta_{00}=\frac{1}{\sqrt2}(\mid 00\rangle +\mid 11\rangle$

This occurs because the CNOT gate flips the target qubit iff the control qubit is $\mid 1 \rangle$. The two qubits are now entangled.

When we proceed to the second CNOT gate we only care about what state the second wire is in? Would someone be able to help explain how we can compute how the top wire acts in this situation?

Or if someone would be able to explain in general how we treat qubits entangled such as this if we want to say something about them separately? At the end of the circuit we have two detectors $x$ and $y$, these will collapse wave function, two two lower qubits will carry on unchanged in their bell state, how would we describe the middle wire being measured by $x$?

-

Now, the calculation in some detail. After the first CNOT gate (i.e., at place 2) you have $$(\alpha|0\rangle+\beta|1\rangle)\frac{1}{\sqrt{2}}(|00\rangle+|11\rangle).$$ When the first qubit is in the state $|0\rangle$ nothing happens, when it is in the state $|1\rangle$, the second qubit is flipped, so that we have $$\frac{\beta}{\sqrt{2}}(|110\rangle+|101\rangle).$$ Combining the two terms gives the state at 3 $$\frac{1}{\sqrt{2}}[\alpha(|000\rangle+|011\rangle)+\beta(|110\rangle+|101\rangle)].$$
Finally, when you have a detector placed at the end you can see what happens by taking the scalar product of the state after the last Hadamard gate (i.e., the state at 4 that I will denote for now by $|\psi_4\rangle$) and the eigenstates of the measured observable. For example, when measuring $x$ [with the eigenstates $(|0\rangle\pm|1\rangle)/\sqrt{2}$] of the first qubit you calculate $\frac{1}{\sqrt{2}}(\langle 0|\pm\langle 1|)_1|\psi_4\rangle$ to see what state you get after detection of $(|0\rangle\pm|1\rangle)/\sqrt{2}$. (The subscript 1 means that the bra represents a state of the first qubit.) Similarly, you can proceed for any state and any measurement. Note that the state obtained in this way is not normalized; $|\frac{1}{\sqrt{2}}(\langle 0|\pm\langle 1|)_1|\psi_4\rangle|^2$ gives the probability of measuring $(|0\rangle\pm|1\rangle)/\sqrt{2}$.