2
$\begingroup$

I am trying to create the following states in Qiskit, but having trouble with the nested loops. Can someone help me create it?

$\left|\psi_o\right\rangle=\frac{1}{\sqrt{8}}\left(\sum_i \hat{\sigma}_{x, i}+\sum_{i, j, k} \hat{\sigma}_{x, i} \hat{\sigma}_{x, j} \hat{\sigma}_{x, k}\right)|0,0,0,0\rangle$, and

$\left|\psi_e\right\rangle=\frac{1}{\sqrt{8}}\left(\sum_{i, j} \hat{\sigma}_{x, i} \hat{\sigma}_{x, j}+\hat{I}+\hat{\sigma}_{x, 1} \hat{\sigma}_{x, 2} \hat{\sigma}_{x, 3} \hat{\sigma}_{x, 4}\right)|0,0,0,0\rangle$

$\endgroup$
1
  • 1
    $\begingroup$ So, just to be clear, you want to make two states, which are the uniform superposition over all basis states, just with even/odd numbers of 1s in them? $\endgroup$
    – DaftWullie
    Mar 9, 2023 at 15:23

1 Answer 1

1
$\begingroup$

If I'm correctly understanding that states that you want, it's two 4-qubit states which are uniform superpositions over all basis states, but restricted to where the number of 1s is even/odd respectively?

Here's a trick: if I apply Hadamard to all 4 qubits initially in the $|0\rangle$ state, I prepare a uniform superposition over all basis states. If I apply Hadamard to all 4 qubits initially in the $|1\rangle$ state, I prepare a superposition over all basis states, but those with an odd number of 1s have a -1 phase.

Hence, to produce the even weighted superposition, it is enough to produce $$ \frac{1}{\sqrt{2}}(|0000\rangle+|1111\rangle) $$ and apply Hadamard to all 4 qubits. I'm hoping you know how to prepare that 4 qubit state.

By the same reasoning, you should be able to create the odd-weight state as well.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.