# Formula for a single unit gate acting on a lexicographically represented state

I've been trying to find in textbooks a discussion on the action of arbitrary single qubit gates on a lexicographic state. That is, given an operator $$G_{l}= 1\otimes 1...\otimes G \otimes ... \otimes 1$$ which acts on the $$l$$-th qubit and a state

$$|\psi\rangle = \sum \alpha_{J} |J\rangle$$

where $$0 \leq J < 2^N$$, $$N$$ is the number of qubits, $$J \in \mathbb{Z}$$, $$|J\rangle$$ is standard product state representing $$J$$ in binary, and the sum runs through the range of J, what can be said about:

$$G_{l} |\psi \rangle$$

in terms of the single qubit operator $$G$$ and how do the original $$\alpha_{J}$$ map.

It shouldn't be too difficult to derive some formulas (there will likely be some transitions between $$J$$ and it's bit flipped int) but I figured since this seems like a basic thing it would have been discussed somewhere.

Edit: Using the notation of the answer below it's can be shown that if:

$$G = g_{00} |0\rangle \langle 0| + g_{01} |0\rangle \langle 1| + g_{10} |1\rangle \langle 0| + g_{11} |1\rangle \langle 1|$$

then the coefficent mappings are:

$$\alpha'_{J} = \alpha_J g_{00} + \alpha_{f_l(J)} g_{01}$$ if $$J_{l} = 0$$

$$\alpha'_{J} = \alpha_J g_{11} + \alpha_{f_l(J)} g_{10}$$ if $$J_{l} = 1$$

where $$f_l(J)$$ flips the $$l$$-th bit of $$J$$.

## 1 Answer

That $$G_{l}$$ action is linear, so you can write $$G_{l} |\psi \rangle = G_{l} \sum \alpha_{J} |J\rangle = \sum \alpha_{J} G_{l} |J\rangle.$$

To calculate $$G_{l} |J\rangle$$ you can use tensor mixed-product property:

$$G_{l} |J\rangle = \big(1\otimes ...\otimes G \otimes ... \otimes 1\big) ~\cdot~ \big(|J_1\rangle \otimes ... \otimes |J_l\rangle \otimes ... \otimes |J_N\rangle\big) =$$ $$= |J_1\rangle \otimes ... \otimes G|J_l\rangle \otimes ... \otimes |J_N\rangle,$$ here $$J_i$$ is the $$i$$-th bit of $$J$$.

You can simplify the total sum by grouping terms in two groups based on the value of $$J_l$$: $$G_{l} |\psi \rangle = \sum_{J_l=0} \alpha_{J} |J_1... J_{l-1}\rangle \otimes G|0\rangle \otimes |J_{l+1} ...J_n\rangle +$$ $$+ \sum_{J_l=1} \alpha_{J} |J_1... J_{l-1}\rangle \otimes G|1\rangle \otimes |J_{l+1} ...J_n\rangle$$