# Quantum algorithm to add zeroes between two halves of a vector

Is there a quantum gate or circuit that is capable of inputting any quantum state with $$N$$ qubits called $$\left | \psi \right >$$ and a state in $$\left | 0 \right >$$, and outputting a value that, in English, is “inserting $$2^N$$ zeroes in between the halves of $$\psi$$?”

More formally, I’ll state it like this.

Given a state $$\psi = \left | 0, \psi_1 \right > + \left | 1, \psi_2 \right >$$, is there a circuit, $$C$$, such that $$C \left | \psi, 0 \right > = \left | 00, \psi_1 \right > + \left | 11, \psi_2 \right >$$ ?

Yes, should be possible.

Using your notation, the state your starting with (on n+1 qubits) is: $$|0,\psi_1,0 \rangle + |1, \psi_2, 0 \rangle$$

You can apply n-1 swap gates in the following order:

• between qubit n+1 and n
• between qubit n and n-1
• between qubit n-1 and n-2 and so on, till
• between qubit 3 and 2

This leaves you in: $$|0,0,\psi_1\rangle + |1,0, \psi_2 \rangle$$

Then you can apply CNOT on qubit 1 and 2, which gives you

$$|0,0,\psi_1\rangle + |1,1, \psi_2 \rangle$$

as desired