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 Answers
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}
- 14,182
- 2
- 12
- 34