# Why are these circuits not producing the expected output?

This circuit was created on the Quirk platform. I'm trying to implement a basic case of phase estimation. For some reason, I'm getting this strange result.

When the Inverse QFT is broken down, it seems to yield the expected answer:

I have no idea why this is happening. I tried playing around with the endian-ness of the qubits, but it didn't seem to work.

The endian-ness of the qubits is the answer. Both QFT and phase estimation rely on certain endianness of the register, and the representations used in the controlled-unitary part has to match the endianness used in the QFT part (and in the answer). This circuit produces the expected outcome with the inverse QFT block:

• But why am I getting this result? I am trying to implement the phase estimation algorithm, and this doesn't seem to be the expected outcome of this circuit. Dec 5 '18 at 21:03
• Additionally, when I try to flip the circuit to correct for the endian-ness on the preprogrammed inverse qft circuit, it doesn’t work. Dec 5 '18 at 21:52
• Except the outputted result from that circuit is $|10\rangle$, while the expected output is $|01\rangle$. Why does that happen? Dec 5 '18 at 21:55
• Is it simply dependent on how the endian-ness of the qubits is initialized? Dec 5 '18 at 22:29
• @JackCeroni In Quirk, the top qubit is the least significant qubit. You might be assuming that the bottom qubit is the least significant? Dec 6 '18 at 13:07