# Quantum operation involving permutation

Suppose I have the state $$\frac{1}{2^l/2}\sum_{i=0}^{2^l-1}|0\rangle^{\otimes q}\otimes |i\rangle^{\otimes}|0\rangle_i^{\otimes l}$$.

I perform some unitary transformation between the registers $$|i\rangle^{\otimes}$$ and $$|0\rangle_i^{\otimes l}$$.

That unitary operation is just the permutation, i.e. for each $$|i\rangle^{\otimes l}|$$ $$0\rangle_i^{\otimes l}$$ stores the permutation of $$|i\rangle^{\otimes l}$$. Originally each $$|0\rangle^{\otimes q}$$ corresponded to each $$|i\rangle^{\otimes}$$.

But now I want that $$|0\rangle^{\otimes q}$$ be associated to the permuted value stored in $$|0\rangle_i^{\otimes l}$$ correspinding to $$|i\rangle^{\otimes l}$$.

For example initially I have the pairs $$(5,0), (10,1), (45,2), (59,3)$$ Now I perform the permutation on the second coordinate to obtain $$0\to 1$$, $$1\to 3$$, $$2\to 0$$, $$3 \to 2$$. So now I want pairs to be $$(5,1), (10,3), (45,0), (59,2)$$.

How can this be obtained? Can someone help me out?

Edit: I give what i think of the solution. Consider an example of $$4$$ states as ignore the normalizing factor. $$|A\rangle= |5\rangle |0\rangle|0\rangle+|10\rangle |1\rangle|0\rangle+|45\rangle |2\rangle|0\rangle+|59\rangle |3\rangle|0\rangle$$ Now i apply the permutation on the second register to store the result in the third register to get $$|B\rangle= |5\rangle |0\rangle|1\rangle+|10\rangle |1\rangle|3\rangle+|45\rangle |2\rangle|0\rangle+|59\rangle |3\rangle|2\rangle$$ Now i swap the second and third qubits to get $$|C\rangle= |5\rangle |1\rangle|0\rangle+|10\rangle |3\rangle|1\rangle+|45\rangle |0\rangle|2\rangle+|59\rangle |2\rangle|3\rangle$$ Now since the third register is just the Hadamard on $$2$$ qubits, so i apply Hadamard on the third register of state $$|C\rangle$$ to get $$|D\rangle= |5\rangle |1\rangle|0\rangle+|10\rangle |3\rangle|0\rangle+|45\rangle |0\rangle|0\rangle+|59\rangle |2\rangle|0\rangle$$ Is this reasoning correct?

• Won't applying the permutation on the second register alone suffice? – Mahathi Vempati Jun 3 '19 at 4:14