Let's say I have a superposition of qubit defined as

$\frac{1}{2} (| 000 \rangle + | 001 \rangle + | 111 \rangle + | 110 \rangle)$

(as given in the answer here: Explanation of output produced by the following quantum circuit)

I want to know how to perform reverse operation compared to that task, where the circuit was given. How can one looking at superposition create a circuit consisting of 3 qubits, the superposition of which is defined above?

  • 1
    $\begingroup$ This is pretty broad right now; could you consider editing the question to focus on, for example, only three qubits and asking how to construct a circuit to map $\vert 000\rangle$ to an explicitly given vector in a Hilbert space of three qubits? $\endgroup$ Nov 14, 2021 at 20:50

1 Answer 1


Generally, working this out requires identifying certain conditional relationships between the various terms of the superposition so you can "factor out" those gates first. Looking at the state, it is possible to identify one such relationship, which is that if we flip the leftmost qubit based on the state of the middle qubit, we get back to a uniform superposition on the two rightmost qubits

$$ \begin{align} \frac{1}{2} (|000\rangle + |001\rangle + |110\rangle + |111\rangle) = CNOT_{2,3}(\frac{1}{2} (|000\rangle + |001\rangle + |010\rangle + |011\rangle)) \end{align} $$

The gate $CNOT_{2,3}$ means flip the state of qubit 3 conditioned on the state of qubit 2. I'm using the convention where the rightmost index is the least significant. Now we can see that the leftmost qubit is always $|0\rangle$, and the remaining two qubits span all possible states with equal weight, which is suggestive of a Hadamard gate on each. So the final circuit becomes

enter image description here

It's only really possible to eyeball these kinds of state preparation circuits for simple cases of a couple qubits. Actually finding the right conditional behavior can be a bit tedious but with practice, and using a circuit tool like the one I used to check (see here), it's not too bad.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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