# Quantum circuit simulation divergence in results

I'm learning about quantum computing in order to code a simulator. I tried the following circuit in Quirk

And ran the same circuit using OPENQASM 2.0:

Notice that the input is |11> in both cases, but it seems that the probabilities for 01 and 10 are switched. What I'm missing here? Thank you!

• Maybe Openqasm and Quirk have different conventions for the order of the qubits. – Peter Shor Aug 14 '18 at 2:17

Peter Shor nailed the reason. This is because OpenQASM and Quirk have different conventions for how the order of wires maps into the order of bits shown in the kets. The simplest way to check this is to use a circuit that toggles only the top qubit.

Quirk considers the top qubit to be the least significant qubit, and labels kets in big endian order (i.e. the ordering humans use; why 12 represents twelve instead of twenty-one). So the 4-output chance display is showing outputs in the following order: probability of top=bottom=0; probability of top=1 and bottom=0, probability of top=0 and bottom=1; probability of top=bottom=1.

The reason I chose this order when making Quirk is because it makes the displays behave better when resizing. If you resize the chance display from 2-qubits to 3-qubits, and the third qubit is off, the original four outputs stay together in the top half instead of being spread apart. Also it's just the natural thing to do when programming: the wire at index k has weight 1<<k. Quirk's tendency to expand circuits and gates downward pushed it towards a "down means more/bigger" convention in other places as well, e.g. in the arithmetic circuits.