Say for 3 qubits, I want a super position of 0 (000), 2 (010), and 7 (111). Is there a general algorithm for building this superposition? Or for an even super position of N integers?

Part of me feels like I am looking to trisect an angle.



1 Answer 1


You certainly can do this, because there's a general algorithm for producing any state that you want. In this specific case, you can do so more directly. There's a few options, but imagine you want to produce the state $$ \alpha|000\rangle+\beta|010\rangle+\gamma|111\rangle. $$ I would probably start from the state $|000\rangle$ and perform a single-qubit rotation on the first qubit to create $$ (\sqrt{|\alpha|^2+|\beta|^2}|0\rangle+\gamma|1\rangle)|00\rangle. $$ Then performing two controlled-nots, both controlled off the first qubit, I can convert this into $$ \sqrt{|\alpha|^2+|\beta|^2}|000\rangle+\gamma|111\rangle. $$

Next, imagine the single-qubit unitary $U$ such that $$ U|0\rangle=(\alpha|0\rangle+\beta|1\rangle)/\sqrt{|\alpha|^2+|\beta|^2}. $$ All I have to do is apply this to qubit 2 controlled off qubit 1 being in the $|0\rangle$ state, and I'm done!

  • 1
    $\begingroup$ Thank you for doing the quick math I avoided for too long! $\endgroup$
    – Craig
    Nov 6, 2021 at 6:59

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.