# Circuit construction and Dirac notation of the following operation

I have a state $$|\tilde{\Phi_2}\rangle =\dfrac{1}{2^{3l/2}}\sum_{x=0}^{2^l-1}\sum_{y=0}^{2^l-1}\sum_{z=0}^{2^l-1}|0\rangle^{\otimes q}\otimes |x\rangle^{\otimes l}\otimes |y\rangle^{\otimes l}\otimes |z\rangle^{\otimes l}$$ Now I want to change the state $$|z\rangle$$ using the states $$|x\rangle$$ and $$|y\rangle$$. The controls originally $$|x\rangle$$ and $$|y\rangle$$ are originally in states $$|x_0x_1...x_{l-1}\rangle$$ and $$|y_0x_1...y_{l-1}\rangle$$, then if $$|x_0\rangle=|y_0\rangle=|1\rangle$$ then the state $$|z\rangle$$ has to be changed. And the state $$|z\rangle$$ is changed to $$|00....z_{l-3}\rangle$$.

Since the $$|0\rangle^{\otimes q}$$ is unaltered we just operate an identity operator $$I^{\otimes q}$$.

The next thing I understand is that we have to break the summation into two parts where in the first part the summation indexes of $$i,j$$ go from $$0$$ to $$\lfloor \dfrac{2^l-1}{2}\rfloor$$.

But after that I am unable to write deduce further. Can somebody help me in writing the Dirac notation for this operator?

Edit: The transformation on the $$z$$ register is the right shift by $$2$$ operator $$|z,0\rangle \to |z, \frac{z}{4}\rangle$$

As you say, any register on which you do nothing, use the identity, $$I$$. This is also going to be the case on $$x_1,x_2,\ldots$$ and $$y_1,y_2,\ldots$$.

When you want to control something, use the projectors $$P_0=|0\rangle\langle 0|$$ and $$P_1=|1\rangle\langle 1|$$. So, controlled-$$U$$ looks like $$P_0\otimes I+P_1\otimes U$$. For controlled-controlled-$$U$$, you can make this notation a bit more concise: $$I\otimes I\otimes I+P_1\otimes P_1\otimes(U-I).$$ This is essentially what you're going to be doing for your operation, where the two controls are $$x_0$$ and $$y_0$$.

So, the next question is what the $$U$$ looks like for transforming the register $$z$$. If I understand correctly, you basically want to introduce an additional register $$|0\rangle^{\otimes(l-2)}$$ and to perform the joint transformation $$|z_0z_1z_2\ldots z_{l-1}\rangle|0\rangle^{\otimes(l-2)}\rightarrow|z_0z_1z_2\ldots z_{l-1}\rangle|z_0z_1z_2\ldots z_{l-3}\rangle$$ This is achieved in a straightforward manner. Let $$C_i$$ denote the controlled-not gate controlled off qubit $$i$$ of the first register, and targetting qubit $$i$$ on the second register (and identity on everything else). Then, $$U=\prod_{i=0}^{l-3}C_i.$$ I remain unclear if that target register is supposed to be the one that starts $$|0\rangle^{\otimes q}$$, or not. I'm assuming not.

Overall, you would thus be left with $$\prod_{i=0}^{l-3}I^{\otimes q}\otimes(I^{\otimes (4l-2)}+P_1\otimes I^{\otimes(l-1)}\otimes P_1\otimes I^{\otimes(l+i-1)}\otimes P_1\otimes I^{\otimes (l-1)}\otimes(X-I)\otimes I^{\otimes(l-3-i)}).$$ Note, the first two $$P_1$$s are the controls off $$x_0$$ and $$y_0$$. The third is the control off $$z_i$$, and the $$(X-I)$$ term should be acting on the target, $$i$$ of the extra register. Now you can express each of these operators in Dirac notation if you really want to.

• Comments are not for extended discussion; this conversation has been moved to chat. – heather May 23 at 0:14
• Yes sir now i think it is what i was looking for. Let me explain to you what i understood – Upstart May 23 at 16:43
• The operator can be $$\prod_{i=0}^{l-3}I^{\otimes q}\otimes(I^{\otimes (4l-2)}+P_1\otimes I^{\otimes(l-1)}\otimes P_1\otimes I^{\otimes(l+i-1)}\otimes P_1\otimes I^{\otimes (l-1)} \otimes I^{\otimes 2}\otimes(X-I)\otimes I^{\otimes(l-3-i)})$$If i add the register $|0\rangle^{\otimes l}$ instead of $|0\rangle^{\otimes l-2}$ The change would just be that the control will still be $i$-th bit of $z$ but the target would be $i+3$-th qubit of the register $|0\rangle^{\otimes l}$ – Upstart May 23 at 22:31
• Yes, that would do. – DaftWullie May 24 at 6:53
• Sir i really appreciate the way you explained the answer inspite of my regular petty doubts. – Upstart May 24 at 10:04