# For CNOT gate with control qubit set to 1, the measured state of the second qubit unexpectedly depends on the measurement

I have the following circuit in qiskit. It is a simple CNOT operation with the control qubit set to 1, by running the control qubit through an X-gate.

However, when I measure the 2nd qubit, I get the state $$|00\rangle$$, not $$|11\rangle$$.

If I add a measurement of the control qubit, I do see $$|11\rangle$$ as the final result.

I fully expected $$|11\rangle$$ as the outcome regardless of whether I measure a single or both qubits

from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit
from qiskit import execute
from qiskit import BasicAer
from math import *
q0 = QuantumRegister(2, "q0") # one ancilla qubit
c0 = ClassicalRegister(2, "c0") # n classical bits for output
qc = QuantumCircuit(q0,c0)
qc.x(q0)
qc.cx(q0, q0)
#qc.measure(q0,c0) <= when commented out I measure |00>
qc.measure(q0,c0)
qc.draw()
job = execute(qc,backend=BasicAer.get_backend('qasm_simulator'))
job.result().get_counts() • This is not an answer (but I'm not allowed to comment as a newbie!). I saw something similar with BasicAer and posted a bug report in the Aer provider. It seems that BasicAer might be part of Terra instead, so maybe I posted in the wrong place. In my case, I get the expected behavior with Aer, but not with BasicAer. github.com/Qiskit/qiskit-aer/issues/70 – Greg Byrd Mar 3 '19 at 20:40

• Use Aer instead of BasicAer (always the best thing to do when possible).
• Use LegacySimulators instead of BasicAer (this will give a deprecation warning).