Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2023/ii/paper-3/15d/c/solution

Use three controlled-NOT gates with control-target directions
On computational-basis bits they act as
They therefore implement the Three-CNOT decomposition of the SWAP gate, and linearity proves the identity on every two-qubit state.

New to topics? Read the docs here!