# Which Gate set can be used to perform the function $U|0\rangle =\frac{1}{\sqrt{n}}\sum_{i=0}^{n}(|i\rangle)$?

I want to perform the following operation: $$U|0\rangle =1/\sqrt{n}\sum_{i=0}^{n}(|i\rangle).$$ I know that Hadmard gate can give me the superposition of states $$|0\rangle$$ and $$|1\rangle$$. But it can only be applied to a single-qubit system.

Does anyone have any idea for a multi-qubit system?

If your question implementation of the operation $$U$$ such that it create a equally superposition state, that is,

$$U|0\rangle^{\otimes n} =\dfrac{1}{\sqrt{2^n}} \sum_{i=0}^{2^n-1}|i\rangle$$

then $$U$$ can be implemented as

$$U = H \otimes H \otimes \cdots \otimes H = H^{\otimes n}$$ where $$H$$ is the Hadamard gate defined as $$H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1\\ 1 & -1 \end{pmatrix}$$ and $$\otimes$$ represents the tensor product operation as usual. For example,

$$H \otimes H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1\\ 1 & -1 \end{pmatrix} \otimes \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1\\ 1 & -1 \end{pmatrix} = \dfrac{1}{2}\begin{pmatrix} 1 & 1 & 1 & 1\\ 1 & -1 & 1 & -1\\ 1 & 1 & -1 & -1\\ 1 & -1 & -1 & 1 \end{pmatrix}$$ and note that by the property of tensor product of linear map

$$(H \otimes H) |0\rangle^{\otimes 2} = H|0\rangle \otimes H|0\rangle = \dfrac{|0\rangle + |1 \rangle}{\sqrt{2}} \otimes \dfrac{|0\rangle + |1 \rangle}{\sqrt{2}} = \dfrac{|00\rangle + |01\rangle + |10\rangle + |11\rangle}{2}$$

Hence, we see that $$U$$ defined as $$H\otimes H$$ takes $$|00\rangle$$ to $$\dfrac{1}{\sqrt{2^2}}\sum_{i =0}^{2^2 -1} |i\rangle = \dfrac{1}{2}\big( |0\rangle + |1\rangle + |2\rangle + |3\rangle\big) = \dfrac{1}{2}\big( |00\rangle + |01\rangle + |10\rangle + |11\rangle\big)$$

Now if you trying to implement a $$U$$ such that it takes the state

$$|0\rangle^{\otimes n} \to \dfrac{1}{\sqrt{n}} \sum_{i =0}^{n-1} |i\rangle$$

for instance:

$$|000 \rangle \to \dfrac{1}{\sqrt{3}} \bigg(|000\rangle + |001\rangle + |010\rangle\bigg) = \dfrac{1}{\sqrt{3}} |0\rangle \otimes \big( |00 \rangle + |01\rangle + |10 \rangle ) = |W\rangle$$

I call the transformative state $$|W\rangle$$ because it is similar to the W-state. This transformation is more difficult than what we have done above to create uniform superposition state. But first note that we were able to factor out the first qubit from the system, so all we really need to do is to implement the state

$$|P \rangle = \dfrac{1}{\sqrt{3}} \big( |00 \rangle + |01\rangle + |10 \rangle )$$ I call this state $$P$$ because of it is a partial entanglement state, The circuit to implement the state transformation from $$|00\rangle \to |P \rangle$$ is as follow: You can see the statevector amplitude here: Now, because of the fact that we were able to factor out the first qubit completely from the other two, this means by adding another qubit to our circuit, we can generate the transformation we wanted in the beginning. That is: And we can look at the statevector and see that Although it should be noted that if we extend this to 4 qubit then things get a little easier as we are looking for the transformation:

\begin{align} |0000\rangle \to &\dfrac{1}{\sqrt{4}} \big(|0000\rangle + |0001\rangle + |0010\rangle + |0011\rangle \big) \\ &= \dfrac{1}{\sqrt{4}} |00\rangle \otimes \big( |00\rangle + |01\rangle + |10\rangle + |11\rangle \big) \\ &= \dfrac{1}{\sqrt{4}} |00\rangle \otimes \big(H \otimes H \big) |00\rangle \end{align}

Thus the circuit would just be and the state vector here is From here you can see that for any qubit system $$n$$ such that $$n = 2^N$$ where $$N \in \mathbb{N}$$ then it will be something like the above case. That is, if you have $$8$$ qubit, then your transformation would be something like:

$$|00000000\rangle \to |00000\rangle \otimes \bigg[ (H \otimes H \otimes H)|000\rangle \bigg]$$

Which has the circuit representation of And if you extend this to $$n$$-qubit state where $$n \neq 2^N$$ then can built the circuit to from the $$n=3$$-qubit case. For instance, if $$n=5$$-qubit then we are looking for the transformation

\begin{align} |00000 \rangle \to &\dfrac{1}{\sqrt{4}} \big(|00000\rangle + |00001\rangle + |00010\rangle + |00011\rangle + |00100\rangle \big) \\ &= \dfrac{1}{\sqrt{5}} |00\rangle \otimes \big( |000\rangle + |001\rangle + |010\rangle + |011\rangle + |100\rangle \big) \\ \end{align}

To create the state $$| P_5 \rangle = \dfrac{1}{\sqrt{5}} \big( |000\rangle + |001\rangle + |010\rangle + |011\rangle + |100\rangle \big)$$ we can use the circuit: then adding another two additional qubit to the above circuit give you what you want.

• Yeah, that's what I wanted to do. Just a general question, does above method works for every sinngle qubit gate i.e to apply it on higher dimension system take tensor product of that gate that many times. – Binshumesh sachan Nov 14 '20 at 17:14

In fact, you just need to implement a lot of Hadamard gates(if lg(n) gives an integer).

E.G. • I'm not sure if I have got you point. – Yitian Wang Nov 14 '20 at 11:49
• What is the value of U then? Tensor product of Hadmard Gates? – Binshumesh sachan Nov 14 '20 at 12:07
• Yes. The qubits can be treated independently here so the unitary has a block diagonal structure. – Paul Nation Nov 14 '20 at 13:29
• When we apply Hadmard Gate to different initial states, the result is different. $H|0\rangle=1/\sqrt{2}(|0\rangle + |1\rangle)$ $H|1\rangle=1/\sqrt{2}(|0\rangle - |1\rangle)$ So Does the same thing will happen here for different initial state like $|000\rangle , |001\rangle , |010\rangle$ etc. ? – Binshumesh sachan Nov 14 '20 at 15:49