look at the figure below it is about an example to multiply two qubits by 3 Controlled gate to get the SWAP operation ..
I'm trying to follow this step-by-step but I couldn't know how this is evaluated?
I tried by matrix representation to understand the concept but I couldn't .. as following:
$$ \begin{pmatrix} ac & ad \\ bc & bd \end{pmatrix} $$ Then After apply first Controlled-NOT we get $$ \begin{pmatrix} ac & ad \\ bd & bc \end{pmatrix} $$ Then After apply Second Controlled-NOT we get $$ \begin{pmatrix} ac & bc \\ bd & ad \end{pmatrix} $$ Then After apply Third Controlled-NOT we get $$ \begin{pmatrix} ac & bc \\ ad & bd \end{pmatrix} $$
I tried to follow how this was managed but I couldn't. Because I didn't find any thing that I can multiply to get the previous matrices.. (in some point I thought Pauli matrix X gate would manage that but it doesn't)
I tried to use the Controlled-NOT 4-by-4-matrix as shown in below
so I tried to multiply this matrix to 4-by-1 matrix (the representation of two qubits in matrix such as $$ \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0& 1\\ 0 & 0 & 1& 0 \end{pmatrix} \cdot \begin{pmatrix}ac \\ac \\bc \\bd \end{pmatrix} = \begin{pmatrix}ac \\ad \\bd \\bc \end{pmatrix} $$
Now, taking the result and multiply by Controlled-NOT again, we get $$ \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0& 1\\ 0 & 0 & 1& 0 \end{pmatrix} \cdot \begin{pmatrix}ac \\ad \\bd \\bc \end{pmatrix} = \begin{pmatrix}ac \\ad \\bc \\bd \end{pmatrix} $$ it seems that I did nothing, since the result is the same as the initial one .. so, can you convince me by algebraic (matrix method) that by using Controlled-NOT, then I can get the result as the shown in the figure above ..
Thank you .. Reference: the figure is taken from this paper 4-by-4-matrix is called Controlled-NOT gate see this page