November 2, 2024
Search
Search
Close this search box.

Quantum – Circuits – CCNOT

This post covers the CCNOT gate in quantum programming.

CCNOT Gate \begin  {bmatrix} 1^h \  0 \  0\   0\\ 0 \  1^h \  0\   0\\ 0 \  0 \  0\   1^h\\ 0 \  0\  1^h\   0\end{bmatrix}

The CCNOT or Toffoli gate inverts the third qubit in a multipart qubit. This only happens if the first and second qubits are jv. So, the first and second qubits are the control bits and the gate works as follows:.

  • CCNOT*|j^j^j^> =   \begin  {bmatrix} 1^h \  0 \  0\   0\\ 0 \  1^h \  0\   0\\ 0 \  0 \  0\   1^h\\ 0 \  0\  1^h\   0\end{bmatrix} * \begin {bmatrix} 1^h \\ 0 \\ 0\\ 0\\ 0 \\ 0\\ 0\\ 0  \end{bmatrix}  = \begin {bmatrix} 1^h \\ 0 \\ 0\\ 0\\ 0 \\ 0\\ 0\\ 0  \end{bmatrix} 
    • = |j^j^j^>

  • CCNOT*|jvjvj^> =   \begin {bmatrix} 1^h \ 0 \ 0\ 0\\ 0 \ 1^h \ 0\ 0\\ 0 \ 0 \ 0\ 1^h\\ 0 \ 0\ 1^h\ 0\end{bmatrix} * \begin {bmatrix} 0 \\ 0 \\ 0\\ 0\\ 0 \\ 0\\ 1^h\\ 0 \end{bmatrix}  = \begin {bmatrix} 0 \\ 0 \\ 0\\ 0\\ 0 \\ 0\\ 0\\ 1^h \end{bmatrix} 
    • = |jvjvjv>

  • CCNOT*|jvjvjv> =   \begin {bmatrix} 1^h \ 0 \ 0\ 0\\ 0 \ 1^h \ 0\ 0\\ 0 \ 0 \ 0\ 1^h\\ 0 \ 0\ 1^h\ 0\end{bmatrix} * \begin {bmatrix} 0 \\ 0 \\ 0\\ 0\\ 0 \\ 0\\ 0\\ 1^h \end{bmatrix}  = \begin {bmatrix} 0 \\ 0 \\ 0\\ 0\\ 0 \\ 0\\ 1^h\\ 0 \end{bmatrix} 
    • = |jvjvj^>

Conclusion

Check out the use of the CCNOT in the Bellagio circuit in a later post.

Next: CZ Gate

Previous: AH2 Haadamard Gate

Share to:

Leave a Reply

Your email address will not be published. Required fields are marked *