What is multiple-qubit gate?
Multiple-qubit gate is an extension of two-qubit gate, designed to operate on more than two qubit simultaneously. It takes multiple qubit inputs and performs a quantum operation across these inputs, often establishing entanglement between qubits.
The common multiple-qubit gates include Toffoli gate, CSWAP gate
Toffoli gate: also known as the CCNOT gate, assigns two qubits as control qubit and another qubit as target qubit. The target qubit flips when both control qubits are in the state |1>, and otherwise the target qubit remains unchanged.
The matrix representation of Toffoli gate or CCNOT gate(the first and second qubit as control qubits and the third qubit as target qubit):
\[CCNOT = \begin{pmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0\\ 0 & 1 & 0 & 0 & 0 & 0 & 0\\ 0 & 0 & 1 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 1 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 0 & 0 & 0 & 1\\ 0 & 0 & 0 & 0 & 0 & 1 & 0\\ \end{pmatrix}\]
CCNOT gate operates on the computation basis states.
CCNOT|000> = |000>
CCNOT|001> = |001>
CCNOT|010> = |010>
CCNOT|011> = |011>
CCNOT|100> = |100>
CCNOT|101> = |101>
CCNOT|110> = |111>
CCNOT|111> = |110>
The CCNOT gate operates the general three-qubit input qubit \(|\psi>\)
\[ \begin{align} |\psi> &=\alpha_{000}|000> + \alpha_{001}|001> + \alpha_{010}|10> + \alpha_{011}|011> \\ &=\alpha_{100}|100> + \alpha_{101}|101> + \alpha_{110}|110> + \alpha_{111}|111> \end{align} \]
After applying the CNOT gate to the input qubit \(|\psi>\),
\[ \begin{align} |\psi'> &= CCNOT|\psi> \\ &= \alpha_{000}|000> + \alpha_{001}|001> + \alpha_{010}|10> + \alpha_{011}|011>\\ &= \alpha_{100}|100> + \alpha_{101}|101> + \alpha_{110}|111> + \alpha_{111}|110> \end{align} \]
Thus, the output state \(|\psi'>\),
\[ \begin{align} |\psi'> &= \alpha_{000}|000> + \alpha_{001}|001> + \alpha_{010}|10> + \alpha_{011}|011>\\ &= \alpha_{100}|100> + \alpha_{101}|101> + \alpha_{110}|111> + \alpha_{111}|110> \end{align} \]