Quantum Gates
Define how group of qubits are affected.
Controlled-Not Gate (CNOT)
The CNOT gate acts on two qubits. One is the control qubit and the other is the target qubit.
$$
CNOT = \begin{bmatrix}
1 \ 0 \ 0 \ 0 \\
0 \ 1 \ 0 \ 0 \\
0 \ 0 \ 0 \ 1 \\
0 \ 0\ 1\ 0 \\
\end{bmatrix}
$$
$$
⁍
$$
- $a$ is the control bit and $b$ is the target bit
- if the control bit is $0$, do nothing with the target bit
- if the control bit is $1$, flip the target bit.
Table:
- $|00\rang \rarr |00\rang$
- $|01\rang \rarr |01\rang$
- $|10\rang \rarr |11\rang$
- $|11\rang \rarr |10\rang$
Toffoli Gate (CCNOT)
$$
⁍
$$
- $a$ and $b$ are the control bits and $c$ is the target bit.
- if either control bit is 0, do nothing with the target bit
- if both control bits are 1, flip the target bit.