2
$\begingroup$

I have QC like this

enter image description here

The final state before measure should be $|1⟩ ⊗ |-⟩$, and it will be $\frac{1}{\sqrt{2}}(|10⟩ - |11⟩)$, so the probability of this QC should be a half is $|10⟩$ and other half is $|11⟩$. But the result of this QC is a half is $|01⟩$ and other half is $|11⟩$.

enter image description here

Can someone explain me why? The script is down below.

from qiskit import QuantumCircuit, transpile
from qiskit.providers.aer import AerSimulator
from qiskit.visualization import plot_histogram

simulator = AerSimulator()
circuit = QuantumCircuit(2)
circuit.x(0)
circuit.x(1)
circuit.h(1)
circuit.measure_all()
circuit.draw('mpl')

compiled_circuit = transpile(circuit, simulator)
job = simulator.run(compiled_circuit, shots = 1000)
result = job.result()
counts = result.get_counts(circuit)
plot_histogram(counts)

print(counts)
$\endgroup$
0

1 Answer 1

3
$\begingroup$

Could it be that states are labeled from right to left? Try the H gate on q0 and see if the labeling reverses.

$\endgroup$
1
  • 1
    $\begingroup$ Oh, you are right, the result become |10⟩ and |11⟩, should read the label from right to left. $\endgroup$
    – Joe_LL
    Commented Dec 28, 2023 at 3:23

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