# Quantum circuit that puts qubits in "equal" superposition

I would like to build a circuit that takes multiple qubit system states and puts them in a superposition with equal amplitudes.

For example: Let's consider a 4 qubit system. I would like the circuit to start with an input of $$\left| 0000 \right>$$ and end with the following superposition: $$\frac{1}{\sqrt{4}}\left(\left| 1000 \right> + \left| 1010 \right> + \left| 1001 \right> + \left| 1100 \right>\right).$$

I would like for the choice of states and number of states to be arbitrary. I.e. that I can easily perform the same circuit to generate

$$\frac{1}{\sqrt{3}}\left(\left| 1000 \right> + \left| 1011 \right> + \left| 1101 \right>\right),$$

or

$$\frac{1}{\sqrt{5}}\left(\left| 1000 \right> + \left| 1010 \right> + \left| 1001 \right> + \left| 1100 \right> + \left| 1111 \right>\right).$$

Can anyone help me with this? Any help is appreciated!

EDIT: I have tried creating a matrix representation of such an operator, and I have found one that does what I need it to do, it maps the $$\left|00\right>$$ to an arbitrary equally-distributed superposition of the basis vectors of my choosing. Here is the matrix I found that acts on 2 qubits to create such a state:

$$U = \begin{pmatrix} 1/\sqrt{3} & 0 & 0 & 0\\ 1/\sqrt{3} & 0 & 0 & 0\\ 1/\sqrt{3} & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ \end{pmatrix}.$$

This gives:

$$U\left|00\right>= \begin{pmatrix} 1/\sqrt{3} & 0 & 0 & 0\\ 1/\sqrt{3} & 0 & 0 & 0\\ 1/\sqrt{3} & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ \end{pmatrix} \begin{pmatrix} 1\\ 0\\ 0\\ 0 \end{pmatrix} = \frac{1}{\sqrt{3}} \begin{pmatrix} 1\\ 1\\ 1\\ 0 \end{pmatrix} = \frac{1}{\sqrt{3}}\left( \left|00\right> + \left|01\right> + \left|10\right> \right).$$

The idea is that the first column of the matrix would consist of $$N$$ non-zero elements, each element contrbuting one basis state to the final superposition, and each element being equal to $$\frac{1}{\sqrt{N}}$$.

The problem with this matrix, however, is that it is not unitary. Would it be possible to modify this matrix in such a wat that it still has the same result on the $$|00>$$ state vector, but that it is unitary? This would solve my problem completely.

Just a few hints:

• To produce equally distributed superposition containing all combinations of $$n$$ qubits, simply put Hadamard gate on all qubit.
• Bell states and GHZ states belong among states your are talking about. Here is a circuit how to produce GHZ states (see also article below)
• You might also be interested in W states, i.e. equally distributed superposition of bit strings where only one qubit is in state 1 and others are zero. In article Efficient quantum algorithms for GHZ and W states, and implementation on the IBM quantum computer an algorithm how to produce such states is described.

EDIT:

Concerning the matrix, it is possible to construct the matrix for example in this way:

$$\frac{1}{\sqrt{3}} \begin{pmatrix} 1 & 1 & 0 &-1 \\ 1 & -1 & 1 &0 \\ 1 & 0 & -1 &1 \\ 0 & 1 & 1 &1 \\ \end{pmatrix}$$

The matrix is unitary (you can check this by a direct multiplication) and the required state is returned for input $$|00\rangle$$. You do not have to bother about other inputs because you can always set all input qubits to state $$|0\rangle$$.

• Thank you for your answer! Those are some good suggestions. What do you think of the edit I made to my question? Commented Jan 12, 2021 at 14:18
• @CarloJacobs: Please find an idea. Commented Jan 12, 2021 at 14:37
• Thanks a lot! How did you come up with that matrix so fast? Is there some sort of technique? Commented Jan 12, 2021 at 15:13
• And if there is, can I generalise that technique for bigger matrices or matrices with a different first column? Commented Jan 12, 2021 at 15:21
• @CarloJacobs You don't care what the outputs of $U$ are for $\left|01\right>, \left|10\right>, \left|11\right>$ so you can just choose them to be any three states that are orthogonal to $U\left|00\right>$ and to each other. Commented Jan 12, 2021 at 17:35