Here are the different toffolis (or maybe one of them is toffoli and the others are very similar to toffoli gates)
My question is:
- we know the matrix of the number 1 Toffoli:
What are the matrices for other two toffoli gates?
Here are the different toffolis (or maybe one of them is toffoli and the others are very similar to toffoli gates)
My question is:
What are the matrices for other two toffoli gates?
The problem is much easier to think about in turns of permutations. You can see that the matrix you created simply swaps the last two elements of the statevector: $[a_{000}, a_{001}, a_{010}, a_{011}, a_{100}, a_{101}, a_{110}, a_{111}]$ becomes $[a_{000}, a_{001}, a_{010}, a_{011}, a_{100}, a_{101}, a_{111}, a_{110}]$
The middle gate above swaps $a_{010}$ and $a_{011}$. The right gate swaps $a_{100}$ and $a_{101}$. The matrix is the identity matrix, but the two $1$s corresponding to these two rows are moved to the opposite corners of the square they are corners of.
And yes, the two gates, together, make an odd parity check.
I always find enlightening the block-matrix display approach, so that these three Toffoli operators can be viewed as
$$\begin{bmatrix}I& & & \\ &I& & \\ & &I& \\ & & &X\end{bmatrix}$$ $$\begin{bmatrix}I& & & \\ &X& & \\ & &I& \\ & & &I\end{bmatrix}$$ $$\begin{bmatrix}I& & & \\ &I& & \\ & &X& \\ & & &I\end{bmatrix}$$
where $I$ is the $2$x$2$ identity operator, $X$ is the NOT operator, and the white spaces are all zeroes for tidyness.