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.
1 Answer
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}
-
5$\begingroup$ For 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. $\endgroup$ Commented Dec 3, 2020 at 8:24
-
4$\begingroup$ A superposition of all states would be the Haar average -- which is zero. $\endgroup$ Commented Dec 3, 2020 at 8:35
-
1$\begingroup$ @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). $\endgroup$ Commented Dec 3, 2020 at 21:41
-
2$\begingroup$ @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 ;) $\endgroup$ Commented Dec 4, 2020 at 9:19
-
1$\begingroup$ @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. $\endgroup$ Commented Dec 4, 2020 at 21:11