I have a GHZ state. I want to measure the third qubit in Hadamard basis, after which the state left behind should be a maximally entangled state as mentioned here.

But when I measure the third qubit, the entire state collapses into either $|000\rangle$ or $|{111}\rangle$

I am representing the quantum state as a statevector then measuring that.

#Create a circuit to generate GHZ state
circ = QuantumCircuit(3)

circ.cx(0, 1)
circ.cx(0, 2)

#Get the statevector from circuit
ghz_statevec = Statevector(circ)

H_matrix = 1/np.sqrt(2)*np.array([[1, 1],

#To measure in X basis, apply the Hadamard transform
evolved_state = ghz_statevec.evolve(H_matrix, [0])


The output after applying Hadamard to the third qubit is $ \frac{1}{2} |{000}\rangle + \frac{1}{2} \ |001\rangle + \frac{1}{2} |110\rangle - \frac{1}{2} |111\rangle$

outcome, state = ghz_statevec.measure([0])


But the state after measuring the third qubit is $|000\rangle$

When I use the circuit representation and do measurement, I get the expected outcome but not in the statevector representation.


2 Answers 2


The problem is that you measure ghz_statevec instead of evolved_state.

The following line gives the correct result:

outcome, state = evolved_state.measure([0])

Be aware though that this will return the complete system, including the qubit which has been measured. For instance, if outcome is equal to '1', then your resulting state would be $\frac{|001\rangle-|111\rangle}{\sqrt{2}}=\frac{|00\rangle-|11\rangle}{\sqrt{2}}\otimes|1\rangle$.


What outcome are you seeing? What did you expect?

I'm also not sure whether you meant ghz_statevec.measure([0]) or evolved_state.measure([0]) in the next to last line.

In either case, I'm seeing exactly what I expect. If I measure on ghz_statevec, then I either get an outcome of 0 or 1 and a corresponding state of $|000\rangle$ or $|111\rangle$

If I measure on evolved_state, then bit 0 has been decoupled from the entanglement, I still get an outcome of 0 or 1, but the other two bits can still both be 00 or both be 11.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.