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.h(0)
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],
[1,-1]])
#To measure in X basis, apply the Hadamard transform
evolved_state = ghz_statevec.evolve(H_matrix, [0])
evolved_state.draw('latex')
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])
state.draw('latex')
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.