How are partial measurements performed on a N qubit quantum circuit?

I am trying to understand quantum computing concepts and have gone through alot of websites and books such as: Quantum Computing by Mikio and https://people.eecs.berkeley.edu/~vazirani/f04quantum/notes/lecture1.pdf So I do understand conceptually how to make measurements but I have enclosed images of a circuit i devised for an example and I am not able to attain the result of stage 5 (which is the output of the 1st two qubits only) when represented as matrices?. No paper/text explains this concept with proper examples. Any help is deeply appreciated. I have posted a similar question on the physics forum but they denied to respond as they assumed it some homework problem and had other issues. I am stuck and unable to move forward from here. Also it is not an assignment or anything. Thank you for your help.  To measure a single qubit you:

1. Split the amplitude vector into "target qubit is Off" and "target qubit is On" parts.
2. Weigh up the parts. Add up the squared magnitudes of the amplitudes within each part. This gives you the probability of each.
3. Randomly pick one of the parts. (Or keep tracking both. Just make sure you never interfere parts from one with the other anymore.)
4. Renormalize the part(s). Divide by the squared-magnitude-sum, so the result totals to 100% again.

You'll probably find the calculations a lot easier if you do one operation at a time instead of a whole column at a time.

Also, you'll probably find my quantum circuit simulator Quirk helpful. It lets you drop state displays into the middle of circuits. Useful for checking your work. Here's your circuit in Quirk, with various displays sprinkled in: The vector entries are not in quite the same order, but they agree with your results.

As you can see, the top measurement results are 50/50 random and the third qubit ends up pointing right (i.e. in the state $|0\rangle - |1\rangle$ regardless of the measurement outcome). (Trying to factor out a qubit often makes states easier to understand.)

Basically what has happened is easier to explain if you think in terms of the X gate as an X-axis control. Given the state of the third qubit during the CCNot, that "control" is satisfied. So really it's like the controls on the top two wires are a controlled-Z. This entangles the top two qubits.

• So when we have ancilla bits which we dont want to measure do we still incorporate the same method for measurement? – user7700590 Mar 13 '17 at 20:51
• @user7700590 Why would it be any different? – Craig Gidney Mar 13 '17 at 21:05