= Solution
Swap the first two computational <vectors> and fix the third:
$$
\boxed{U=|1\rangle\langle0|+|0\rangle\langle1|+|2\rangle\langle2|=\begin{pmatrix}0&1&0\\1&0&0\\0&0&1\end{pmatrix}.}
$$
This <permutation matrix> has <orthonormal> columns; equivalently, $U^\dagger=U$ and $U^2=I$, proving <unitarity>. Its first column gives $U|0\rangle=|1\rangle=|\phi_1\rangle$, as required. A unitary must also specify what happens to the rest of the <basis>, which is why a single outer product alone would not suffice.
Back to article page