# A Puzzling Quantum Puzzle

In my article titled *Reverse Engineering Quantum Black Boxes*, I peeked inside the black box featured in this *Turn the Qubits Off* puzzle. And while my version of the black box accurately created the puzzle’s quantum states, it did so in a very different manner than the black box in the actual puzzle. I have thus far identified two reasons how this happened.

**Quirk vs IBM Q**

The setting for the puzzle is a stripped down version of the Quirk online quantum computing simulator. If you play around with the drag-and-drop circuit builder, you’ll see that you can create a wide variety of multi-qubit operations.

*the minimalist solution, image used with permission from **Quantum Intuition (@explore_quantum)*

However, I am not a regular user of Quirk; I am a regular user of IBM Q. Therefore, I restricted myself to gate operations I would use if building the circuit using OpenQASM (Quantum Assembly Language). This is evident, perhaps, by the fact that I actually ran my circuit on ibmqx2.

*my solution*

It is important to note that non-standard gates can be built in IBM Q. However, these custom gates have to be broken down into standard gates first. For example, I once saw a circuit with a cccccZ gate (I don’t remember exactly how many control qubits there were), but implementing it in IBM Q required a fairly large number of Taffoli gates. Consequently, I never would have tried the cRyRy gate as it appears in the minimalist solution above, since it is not a standard IBM Q gate, and this is what led to a solution which worked with a Fredkin gate and a CNOT instead.

**Quantum Fourier Transform (QFT)**

I honestly never would’ve guessed that the actual black box hid a slightly-modified version of the Quantum Fourier Transform (QFT). It turns out to be impossible to reverse engineer.

*the actual black box, image used with permission from **Quantum Intuition (@explore_quantum)*

For starters, the entire six-step QFT can be performed in only one step. A major reason that my black box works is that a NOT on the top qubit, an Rx on the middle qubit, and a Z on the bottom qubit happens to have the exact same effect as this particular QFT. Therefore, it seems highly unlikely that anyone would work backwards and apply three or four operations on any of the qubits, especially when two of the most basic operations — X and Z — solve two of them.

*my solution with my black box*

Beyond that, the third and fifth steps of the QFT have no effect on the circuit. The cS gate rotates around the z axis while the target qubit is |1>, so the target stays at |1>. And the control qubit of the cST is |0 >, so the gate does nothing. Unless you somehow know that the circuit has a QFT, there would be no way of discerning that either of those gates are there.

**Further Experimentation**

As previously mentioned, the entire six-step QFT can be replaced with a NOT, an Rx, and a Z. That leaves a cRyRy in one circuit, and a CNOT and a Fredkin gate in the other. Curiously, these sections of gates are not interchangeable. For example, I substituted a cRyRy into my circuit and had to slightly modify my solution. Because there are four possible permutations of the black box (QFT and cRyRy, X-Rx-Z and cRyRy, QFT and CNOT-Fredkin, and X-Rx-Z and CNOT-Fredkin), I will save that analysis for another article.