I am wondering what a circuit should look like if I want to prepare the state of the following form: $$ |0\rangle^{\otimes n} \mapsto \dfrac{ |1000\ldots0\rangle + |0100\ldots0\rangle + |0010\ldots0\rangle + \ldots + |00\ldots001\rangle }{\sqrt{n}} $$ Is this something well-known and trivial?


Apparently, this question was asked here.

The Q# realization is provided in katas 15-17 here.


1 Answer 1


Your state is a generalization of so-called W-state.

Here is a implementation of the state for three qubits.

You can also use method described in paper Transformation of quantum states using uniformly controlled rotations for preparing W-state with any qubits you want. When you use this method, set probability of states $|10\dots0 \rangle$, $|01\dots 0\rangle$,...$|00\dots1 \rangle$ to $\frac{1}{n}$ and probability of other states to zero.


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.