# How to measure the first qubit in two qubit system? QC

I was wondering how to measure the first or even the second qubit in a quantum computing system after for example a Hadamard Gate is applied to the system of these qubits: A|00>+B|01>+C|10>+D|11>?
A mathematical and intuitive explanation would be nice, I am a undergraduate sophomore student doing research with a professor and my task over winter break is to write a Mathematica code that can simulate measurement for a quantum computing operation. I understand that this system has to be normalized throughout and it's probabilities in check.

Related Quantum Physics News on Phys.org
vanhees71
Gold Member
2019 Award
How much do you already know about the quantum formalism, for example, the tensor product and the difference between a product state and an entangled state?

I'm asking this because typically in quantum computing one starts in the computational basis (##\{ |00\rangle, |01\rangle ,|10\rangle, |11\rangle \}## in the two-qubit case) and measure in the same basis. A Hadamard gate is a single-qubit gate so you might not even need to consider the second qubit. For an arbitrary state that you have written, the probability of getting the outcome 0 for the first qubit is ##|A|^2 + |B|^2## and the probability of getting the outcome 1 is ##|C|^2+|D|^2##. Can you derive this using what you know? A good reference is the second chapter of Nielsen and Chuang.

Frank Schroer
vanhees71
Gold Member
2019 Award
Well, of course you must define the linear operators describing the system (e.g., the self-adjoint operators representing observables or the unitary operators describing interactions of the qbits with some device like a quarter-wave plate in quantum optics or the q-gates in quantum-information theory) on the Hilbert space (or, sufficiently, on any basis spanning this Hilbert space) in the Hilbert space at hand.

If you have a two-spin system, you thus must define how the operator in question acts on the four product states. The Hadamard gate acts on one of the qbits only, i.e., it's given by
$$\hat{H}=\hat{h} \otimes \hat{1}.$$
The definition for the single-spin Hadamard gate is
$$\hat{h}=|1 \rangle \langle+ | + |0\rangle \langle -|$$
with
$$|\pm \rangle=\frac{1}{\sqrt{2}} (|1 \rangle \pm |0 \rangle).$$
This means
$$\hat{H} |a \rangle \otimes |b \rangle=(\hat{h} |a \rangle) \otimes |b \rangle$$
for any product state. The rest follows from the fact that by definition ##\hat{H}## acts linearly on the two-q-bit state as well as this holds for ##\hat{h}## acting on a single-q-bit state.

Frank Schroer
How much do you already know about the quantum formalism, for example, the tensor product and the difference between a product state and an entangled state?

I'm asking this because typically in quantum computing one starts in the computational basis (##\{ |00\rangle, |01\rangle ,|10\rangle, |11\rangle \}## in the two-qubit case) and measure in the same basis. A Hadamard gate is a single-qubit gate so you might not even need to consider the second qubit. For an arbitrary state that you have written, the probability of getting the outcome 0 for the first qubit is ##|A|^2 + |B|^2## and the probability of getting the outcome 1 is ##|C|^2+|D|^2##. Can you derive this using what you know? A good reference is the second chapter of Nielsen and Chuang.
Thank you for the response, my research professor gave me a physical copy of the textbook that you referenced. I have a pretty good understanding of quantum formalism. I believe I can derive a proper formula in order to write a code for a numerical method for measurement procedure given an input state.