2

I need to write the tensorial representation of the Controlled Swap Gate, what I have written is $\operatorname{CSWAP}=|0\rangle\langle0|\otimes I\otimes I+|1\rangle\langle1|\otimes U$, where U is the matrix of $\operatorname{CSWAP}$ gate transformation, i.ethat is $$|00\rangle\to |00\rangle=1|00\rangle+0|01\rangle+0|10\rangle +0|11\rangle $$ $$ |01\rangle=0|00\rangle+0|01\rangle+1|10\rangle +0|11\rangle $$ $$|10\rangle=0|00\rangle+1|01\rangle+0|10\rangle +0|11\rangle $$ $$|11\rangle=0|00\rangle+0|01\rangle+0|10\rangle +1|11\rangle,$$ so the matrix becomes $$U=\begin{bmatrix} 1 &0&0&0\\ 0&0&1&0\\ 0&1&0&0\\ 0&0&0&1 \end{bmatrix},$$ Is this the correct implementation? Just to add a bit, how do I make this $2$-qubit gate as a tensor product of $1$-qubit gate so that there is uniformity in the equation above?

Sanchayan Dutta
  • 17,497
  • 7
  • 48
  • 110
Upstart
  • 1,420
  • 7
  • 15

2 Answers2

3

SWAP is a two-qubit gate and needs to be written as $$ \text{SWAP}=|00\rangle\langle 00|+|11\rangle\langle 11|+|01\rangle\langle 10|+|10\rangle\langle 01|. $$ If you want to write this in terms of Pauli-operators, for example, you might write $$ \text{SWAP}=\frac12\left(\mathbb{I}\otimes\mathbb{I}+Z\otimes Z+X\otimes X+Y\otimes Y\right). $$

DaftWullie
  • 57,689
  • 3
  • 46
  • 124
1

Yes, that is the correct matrix representation of the CSWAP (also often referred to as Fredkin gate).

Regarding writing it as a "tensor product of $1$-qubit gates", the only missing step is writing the swap in braket notation, which you can do as follows: $$\operatorname{SWAP}=\lvert00\rangle\!\langle00\rvert+\lvert11\rangle\!\langle11\rvert+\lvert01\rangle\!\langle10\rvert+\lvert10\rangle\!\langle01\rvert,$$ so that the overall gate reads \begin{align} \operatorname{CSWAP}&=|0\rangle\!\langle0|\otimes I\otimes I+|1\rangle\!\langle1|\otimes \operatorname{SWAP}\\ &=|0\rangle\!\langle0|\otimes I\otimes I+|1\rangle\!\langle1|\otimes(\lvert00\rangle\!\langle00\rvert+\lvert11\rangle\!\langle11\rvert+\lvert01\rangle\!\langle10\rvert+\lvert10\rangle\!\langle01\rvert). \end{align}

glS
  • 24,708
  • 5
  • 34
  • 108