Is there a way to create a superposition of all the possible states?



If there're four qubits in my circuit, how can I arrange my gates so that the final output state is a superposition of all the possible states of 4 qubits? (there're 16 of them in total). I've tried some 2-qubits circuits to generate the superposition states like $|\Psi^+\rangle$ and $|\Phi^-\rangle$, but I'm not exactly sure if there's a way to create the superposition of all the possible states.


Posted 2020-12-03T01:11:27.283

Reputation: 988

5Initialize them all to $\vert 0\rangle$, and Hadamard them all individually. – Mark S – 2020-12-03T01:17:09.970

@Mark S Thanks!!! – Zhengrong – 2020-12-03T01:21:50.253



Do you mean mapping the state $|0\rangle^{\otimes n} \to \dfrac{1}{\sqrt{2^n}}\sum_{i=0}^{2^n-1} |i\rangle $ ?

If that is the case then you can just apply $H^{\otimes n}$ to the state $|0\rangle^{\otimes n}$. That is, you apply a Hadamard gate to each of the qubit.

The reason for this is $H |0\rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$ and so

\begin{align} \overbrace{H|0\rangle \otimes H|0\rangle \otimes \cdots \otimes H|0\rangle}^{n \ \textrm{times}} &= \overbrace{ \bigg( \dfrac{|0\rangle +|1\rangle}{\sqrt{2} } \bigg)\otimes \bigg( \dfrac{|0\rangle +|1\rangle}{\sqrt{2} } \bigg) \otimes \cdots \otimes \bigg( \dfrac{|0\rangle +|1\rangle}{\sqrt{2} } \bigg) }^{n \ \textrm{times}} \\ &= \dfrac{1}{\sqrt{2^{n}}}\big( \overbrace{ |00\cdots0\rangle + |00\cdots1\rangle + \cdots + |11\cdots 1\rangle }^{2^n \ \textrm{terms} } \big)\\ &= \dfrac{1}{\sqrt{2^n}}\sum_{i=0}^{2^n-1} |i\rangle \end{align}


Posted 2020-12-03T01:11:27.283

Reputation: 6 322

Yes!! Thank you:) – Zhengrong – 2020-12-03T01:23:30.313

5For the sake of pedantry - this is not a superposition of all possible states because there are states that are orthogonal to this. It is a superposition of all possible computational basis states. – DaftWullie – 2020-12-03T08:24:00.257

4A superposition of all states would be the Haar average -- which is zero. – Markus Heinrich – 2020-12-03T08:35:17.013

@Markus Heinrich Thanks for the comment! Is there any link for understanding the superposition of all states? – Zhengrong – 2020-12-03T16:58:37.430

1@DaftWullie If we're being pedantic, every state is a superposition of all possible states. OP's question is nontrivial only if we interpret "superposition of A and B" as being a state in which both A and B have a nonzero contribution, but it's not possible for all states to have a nonzero contribution, so we must interpret this to mean that all basis states have nonzero contribution (which of course means that this is defined only with respect to a particular basis). – Acccumulation – 2020-12-03T21:41:44.833

@Acccumulation Generally, it only makes sense the consider finite linear combinations in a basis, since the Hilbert space is finite-dimensional. This is BTW not basis-dependent. Thus, when people normally say superposition, they mean a linear combination in an orthonormal basis. However, it is also sometimes useful to express a state in a frame (overcomplete basis), just think about measurements (MUB, designs etc.). – Markus Heinrich – 2020-12-04T09:18:11.557

2@Zhengrong What I meant is an expression of the form $\int_{\mathbb{S}^{d-1}} \mathrm{d}\psi f(\psi) |\psi\rangle$ where $\mathrm{d}\psi$ is the (normalised) Haar measure on the unit sphere and $f$ is a measurable function. For $f=1$, the result is unitarily invariant, and thus has to be zero. It is BTW possible to write something more meaningful such as $|\varphi\rangle = d \int_{\mathbb{S}^{d-1}} \mathrm{d}\psi \langle \psi | \varphi \rangle|\psi\rangle$. But this is just fancy rewriting ;) – Markus Heinrich – 2020-12-04T09:19:40.087

@Markus Heinrich Thank you!! – Zhengrong – 2020-12-04T15:28:47.770

1@MarkusHeinrich What do you mean by "finite linear combinations"? What are saying is not basis dependent? Whether a state has a nonzero contribution from every basis vector is basis dependent. "Superposition" is often to mean "state with nonzero contribution from at least two basis vectors", and that is also basis dependent. – Acccumulation – 2020-12-04T21:11:07.243

@Acccumulation You are right, the number of non-zero components is basis-dependent by definition. I don't disagree. Anyway, it does not really matter how we interpret the word superposition, in the end it's about math. I can interpret the term "superposition of all states" by using an integral, like in CV quantum mechanics. Then, the expressions I gave in my comments involve all states (except a measure zero subset for the 2nd case). That's as close as it gets to OP's question. Whether it makes sense in some way is a different question. – Markus Heinrich – 2020-12-05T09:45:38.377