Multi-qubit gates act on arbitrary numbers of qubits ($n \geq 3$) and are fundamental to quantum algorithms. Unlike three-qubit gates like Toffoli and Fredkin, general multi-qubit gates have no fixed size and scale with problem parameters. Most are constructed from two-qubit gates and are expensive to implement natively.
Permutation gates apply a classical permutation to the computational basis states. Examples include:
Permutation gates are unitary, reversible, and preserve the Hamming weight (number of 1s). They have no phase information and are efficiently decomposable into two-qubit gates.
Quantum Fourier Transform is an $n$-qubit unitary gate that maps $|j\rangle \to \frac{1}{\sqrt{2^n}} \sum_{k=0}^{2^n-1} e^{2\pi i jk/2^n} |k\rangle$. It is the quantum analogue of the classical discrete Fourier transform and is a subroutine in Shor's factoring algorithm and phase estimation algorithms.
The diffusion operator (inversion about average) is part of Grover's search algorithm. Applied to an $n$-qubit state, it reflects all amplitudes about the average amplitude, amplifying the marked states.
$$D = 2|\psi_0\rangle\langle\psi_0| - I$$
where $|\psi_0\rangle = \frac{1}{\sqrt{2^n}} \sum_j |j\rangle$ is the equal superposition. The diffusion operator is unitary and composable with oracle gates.
Phase oracles mark solutions by applying a phase (typically $-1$) to basis states meeting some condition. For $n$ qubits, a phase oracle can be written:
$$O_f = \sum_{x=0}^{2^n-1} (-1)^{f(x)} |x\rangle\langle x|$$
where $f: \{0,1\}^n \to \{0,1\}$ is the Boolean function defining which states are marked.
Controlled-unitary gates apply an arbitrary unitary $U$ to target qubits if all $k$ control qubits are $|1\rangle$. Generalizations include:
Reducing the number of controls is critical for scalability and error mitigation.
Multi-qubit gates are expensive to implement natively:
Three-qubit gates (Toffoli, Fredkin) are building blocks for larger gates. Multiple three-qubit gates in sequence can implement more complex operations, though direct decomposition into two-qubit gates is often more efficient.