How can I build a circuit to generate an equal superposition of 3 outcomes for 2 qubits?



Given a $2$ qubit-system and thus $4$ possible measurements results in the basis $\{|00\rangle$, $|01\rangle$, $|10\rangle$, $|11\rangle\}$, how can I prepare the state, where:

  1. only $3$ of these $4$ measurement results are possible (say, $|00\rangle$, $|01\rangle$, $|10\rangle$)?

  2. these measurements are equally likely? (like Bell state but for $3$ outcomes)


Posted 2018-06-12T09:48:37.680

Reputation: 303

1You mean to write out the actual state or to create a circuit to prepare such state given an input? – Josu Etxezarreta Martinez – 2018-06-12T09:51:49.097

@JosuEtxezarretaMartinez, I mean the circuit. – weekens – 2018-06-12T10:01:16.503

@Blue, how dit you manage to convert these 00 and 11 to Dirac notation? I tried $\ket{00}$ and failed. – weekens – 2018-06-12T10:02:13.567


@weekens If you click on "edit", you can see the MathJax code. Also, see this.

– Sanchayan Dutta – 2018-06-12T10:03:34.480


The solution from Niel de Beaudrap in Quirk...

– stestet – 2019-05-02T14:08:01.297



Break the problem in parts.

Say we have already sent $\mid 00 \rangle$ to $\frac{1}{\sqrt{3}} \mid 00 \rangle + \frac{\sqrt{2}}{\sqrt{3}}\mid 01 \rangle$. We can send that to $\frac{1}{\sqrt{3}} \mid 00 \rangle + (\frac{1}{2} (1+i))\frac{\sqrt{2}}{\sqrt{3}}\mid 01 \rangle + (\frac{1}{2} (1-i))\frac{\sqrt{2}}{\sqrt{3}}\mid 10 \rangle$ by a $\sqrt{SWAP}$. That satisfies you're requirements with all probabilities $\frac{1}{3}$ but with different phases. If you want use phase shift gates on each to get the phases you want like if you want to make them all equal.

Now how do we get from $\mid 00 \rangle$ to $\frac{1}{\sqrt{3}} \mid 00 \rangle + \frac{\sqrt{2}}{\sqrt{3}}\mid 01 \rangle$? If it was $\frac{1}{\sqrt{2}} \mid 00 \rangle + \frac{1}{\sqrt{2}}\mid 01 \rangle$, we could do a Hadamard on the second qubit. It is not a easy with this but we can still use a unitary only on the second qubit. That is done by a rotation operator purely on the second qubit by factoring as

$$Id \otimes U : \; \mid 0 \rangle \otimes (\mid 0 \rangle) \to \mid 0 \rangle \otimes (\frac{1}{\sqrt{3}} \mid 0 \rangle + \frac{\sqrt{2}}{\sqrt{3}} \mid 1 \rangle) $$

$$ U = \begin{pmatrix} \frac{1}{\sqrt{3}} & \frac{\sqrt{2}}{\sqrt{3}} & \\ \frac{\sqrt{2}}{\sqrt{3}} & -\frac{1}{\sqrt{3}} & \\ \end{pmatrix} $$ works. Decompose this into more basic gates if you need to.

In total we have:

$$ \mid 00 \rangle \to \frac{1}{\sqrt{3}} \mid 00 \rangle + \frac{\sqrt{2}}{\sqrt{3}}\mid 01 \rangle\\ \to \frac{1}{\sqrt{3}} \mid 00 \rangle + (\frac{1}{2} (1+i))\frac{\sqrt{2}}{\sqrt{3}}\mid 01 \rangle + (\frac{1}{2} (1-i))\frac{\sqrt{2}}{\sqrt{3}}\mid 10 \rangle\\ \to \frac{1}{\sqrt{3}} \mid 00 \rangle + \frac{e^{i \theta_1}}{\sqrt{3}}\mid 01 \rangle + \frac{e^{i \theta_2}}{\sqrt{3}}\mid 10 \rangle $$


Posted 2018-06-12T09:48:37.680

Reputation: 3 383

How do I construct U from basic gates? Let's say, from those available on IBM Q Experience. – weekens – 2018-06-12T16:29:35.617

2@weekens There's an 'advanced' gate called U3 that allows you to implement any single qubit unitary - you input the values for $\theta, \lambda$ and $\phi$ to implement $$U3 \left( \theta, \lambda, \phi\right) = \begin{pmatrix}\cos\frac{\theta}{2} && -e^{i\lambda}\sin\frac{\theta}{2} \ e^{i\phi}\sin\frac{\theta}{2} && e^{i\left(\lambda+\phi\right)}\cos\frac{\theta}{2}\end{pmatrix},$$ which can be approximated using $\theta \approx 1.91, \lambda=\pi$ and $\phi = 0$ – Mithrandir24601 – 2018-06-14T20:23:24.663

To do this in basic gates, it looks like you would need to rotate into the right basis, then do a phase rotation, then rotate back which may require a fair few gates. However, in a sense, the above U3 is basic in that it's a physically implemented gate (i.e. is directly achieved by performing a couple of physical operations on the qubit instead of the many the would be required by stringing lots of 'not-advanced' gates together) – Mithrandir24601 – 2018-06-14T20:42:27.037

@Mithrandir24601, thanks for your explanation! I haven't used U3 yet, will experiment with it in nearest time. – weekens – 2018-06-17T07:23:56.480

@AHusain, implemented your approach in Quirks simulator: here

– weekens – 2018-07-22T07:37:34.497


Here is how you might go about designing such a circuit.$\def\ket#1{\lvert#1\rangle}$ Suppose that you would like to produce the state $\ket{\psi} = \tfrac{1}{\sqrt 3} \bigl( \ket{00} + \ket{01} + \ket{10} \bigr)$. Note the normalisation of ${\small 1}/\small \sqrt 3$, which is necessary for $\ket{\psi}$ to be a unit vector.

If we want to consider a straightforward way to realise this state, we might want to think in terms of the first qubit being a control, which determines whether the second qubit should be in the state $\ket{+} = \tfrac{1}{\sqrt 2}\bigl(\ket{0}+\ket{1}\bigr)$, or in the state $\ket{0}$, by using some conditional operations. This motivates considering the decomposition $$ \ket{\psi} \;=\; \tfrac{\sqrt 2}{\sqrt 3}\ket{0}\ket{+} \;+\; \tfrac{1}{\sqrt 3}\ket{1}\ket{0}.$$ Taking this view it makes sense to consider preparing $\ket{\psi}$ as follows:

  1. Prepare two qubits in the state $\ket{00}$.
  2. Rotate the first qubit so that it is in the state $\tfrac{\sqrt 2}{\sqrt 3}\ket{0} + \tfrac{1}{\sqrt 3}\ket{1}$.
  3. Apply a coherently controlled operation on the two qubits which, when the first qubit is in the state $\ket{0}$, performs a Hadamard on the second qubit.

Which specific operations you would apply to realise these transformations — i.e. which single-qubit transformation would be most suitable for step 2, and how you might decompose the two-qubit unitary in step 3 into CNOTs and Pauli rotations — is a simple exercise. (Hint: use the fact that both $X$ and the Hadamard are self-inverse to find as simple a decomposition as possible in step 3.)

Niel de Beaudrap

Posted 2018-06-12T09:48:37.680

Reputation: 9 858


I'll tell you how to create any two qubit pure state you might ever be interested in. Hopefully you can use it to generate the state you want.

Using a single qubit rotation followed by a cnot, it is possible to create states of the form

$$ \alpha \, |0\rangle \otimes |0\rangle + \beta \, |1\rangle \otimes |1\rangle .$$

Then you can apply an arbitrary unitary, $U$, to the first qubit. This rotates the $|0\rangle$ and $|1\rangle$ states to new states that we'll call $|a_0\rangle$ and $|a_1\rangle$,

$$U |0\rangle = |a_0\rangle, \,\,\, U |1\rangle = |a_1\rangle$$

Our entangled state is then

$$\alpha \, |a_0\rangle \otimes |0\rangle + \beta \, |a_1\rangle \otimes |1\rangle .$$

We can similarly apply a unitary to the second qubit.

$$V |0\rangle = |b_0\rangle, \,\,\, V |1\rangle = |b_1\rangle$$

which gives us the state

$$\alpha \, |a_0\rangle \otimes |b_0\rangle + \beta \, |a_1\rangle \otimes |b_1\rangle .$$

Due to the Schmidt decomposition, it is possible to express any pure state of two qubits in the form above. This means that any pure state of two qubits, including the one you want, can be created by this procedure. You just need to find the right rotation around the x axis, and the right unitaries $U$ and $V$.

To find these, you first need to get the reduced density matrix for each of your two qubits. The eigenstates for the density matrix of your first qubit will be your $|a_0\rangle$ and $|a_1\rangle$. The eigenstates for the second qubit will be $|b_0\rangle$ and $|b_1\rangle$. You'll also find that $|a_0\rangle$ and $|b_0\rangle$ will have the same eigenvalue, which is $\alpha^2$. The coefficient $\beta$ can be similarly derived from the eigenvalues of $|a_1\rangle$ and $|b_1\rangle$.

James Wootton

Posted 2018-06-12T09:48:37.680

Reputation: 9 708


Here is an implementation of a circuit producing state $|\psi\rangle = \frac{1}{\sqrt{3}}(|00\rangle + |01\rangle + |10\rangle)$ on IBM Q:


Note that $\theta = 1.2310$ for $\mathrm{Ry}$ on $q_0$. $\theta = \frac{\pi}{4}$ and $\theta = -\frac{\pi}{4}$ for first and second $\mathrm{Ry}$ on $q_1$.

The $\mathrm{Ry}$ on $q_0$ prepares qubit in superposition $|q_0\rangle = \sqrt{\frac{2}{3}}|0\rangle + \frac{1}{\sqrt{3}}|1\rangle$. $\mathrm{Ry}$ gates on $q_1$ and $\mathrm{CNOT}$ implements controlled Hadamard gate. When $q_0$ is in state $|0\rangle$ the Hadamard acts on $q_1$ thanks to negation $\mathrm{X}$. This happens with probability $\frac{2}{3}$. Since Hadamard turns $|0\rangle$ to $|+\rangle$, i.e. equally distributed superposition, final states $|00\rangle$ and $|01\rangle$ can be measured with probability $\frac{1}{3}$. When $q_0$ is in state $|1\rangle$, controled Hadamard does not act and state $|10\rangle$ is measured. Since $q_0$ is in state $|1\rangle$ with probability $\frac{1}{3}$, $|10\rangle$ is measured also with probability $\frac{1}{3}$.

Martin Vesely

Posted 2018-06-12T09:48:37.680

Reputation: 7 763

1Note that $\theta = 2\arccos(\sqrt{2/3})$... – draks ... – 2020-04-03T08:17:23.150


There's one more way:

Create two identical qubits on the Bloch sphere (this is start with 0 and apply the same random rotational gate). Then, apply a CNOT gate followed by a Hadamard gate to the first qubit to perform a measurement in the Bell basis. You will measure 00, 01, 10 (which are equivalent to the 3 symmetric Bell states) with equal probability each time.

This is my implementation of the problem:

Hope that helps ;)


Posted 2018-06-12T09:48:37.680

Reputation: 21