I would like to implement a quantum program on the IBM Composer with following characteristics:

  1. The output is the observed value of 3 qubits
  2. Only one of the 3 qubits should be observed as $1$, the 2 others should be $0$
  3. The probability that a qubit is observed as $1$ is $1/3$

So the 3 possible outputs of this circuit are: $|100\rangle$,$|010\rangle$,$|001\rangle$ (all 3 having equality probability of being outputted)

So how can we best implement such a circuit on the IBM Composer ?


1 Answer 1


The pure quantum state that satisfies your conditions is the W state in three qubits, $$ \frac{1}{\sqrt{3}} \left(|001\rangle + |010\rangle + |100\rangle \right) $$

You can look at this answer for a high level circuit to construct this. The first gate in that circuit is a single qubit gate that effects the transformation, $$ |0 \rangle \rightarrow \frac{1}{\sqrt{3}} |1 \rangle + \sqrt{\frac{2}{3}} | 0\rangle .$$

This you can implement in the composer as a $U_3$ gate with an appropriate value of theta.

Next you will need a controlled H gate between the first and second qubits, and a Toffoli gate. To implement them in the composer you can use the circuits given here . The control gates in the answer have the control qubits flipped (the controls are triggered by $0$ and not $1$ ). So you will need to sandwich your control qubits in the composer between $X$ gates to get the desired circuit. As you can see, constructing this from scratch in the composer is rather tedious.

  • $\begingroup$ thanks for the clear response. One little remark: the first link to the W-state wikipedia page is broken. $\endgroup$
    – JanVdA
    Jun 15, 2018 at 17:30
  • $\begingroup$ @JanVdA Fixed the link, so it should work now $\endgroup$
    – Mithrandir24601
    Jun 15, 2018 at 18:36

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.