# Qiskit flipped representation of qubits in CNOT gate?

The conventional CNOT gate is shown on the right, and the Qiskit version is on the left. Since Qiskit defines it has a flipped representation kindly explain what is happening to the 11 position?

It depends on which qubit is the control qubit. Depending on this we will have different matrix representations. Here is a code that may help to identify the ordering in Qiskit:

from qiskit import *
simulator = Aer.get_backend('qasm_simulator')

circuit_cx_01 = QuantumCircuit(2, 2)
circuit_cx_10 = QuantumCircuit(2, 2)

circuit_cx_01.x(0)
circuit_cx_01.x(1)
circuit_cx_01.cx(0, 1)
circuit_cx_01.measure(0, 0)
circuit_cx_01.measure(1, 1)

circuit_cx_10.x(0)
circuit_cx_10.x(1)
circuit_cx_10.cx(1, 0)
circuit_cx_10.measure(0, 0)
circuit_cx_10.measure(1, 1)

result_cx_01 = execute(circuit_cx_01, simulator, shots=1024).result().get_counts()
result_cx_10 = execute(circuit_cx_10, simulator, shots=1024).result().get_counts()

print("After cx(0, 1) applied on '11' state \n{}".format(result_cx_01))
print("\nAfter cx(1, 0) applied on '11' state \n{}".format(result_cx_10))


The output is:

After cx(0, 1) applied on '11' state
{'01': 1024}

After cx(1, 0) applied on '11' state
{'10': 1024}


where in the cx(i, j) the i qubit is the control qubit and j is the target qubit. From this, one can see that in Qiskit 0 index corresponds to the rightmost qubit.