Use the quantum Fourier transform convention , where . Reindexing the shifted sum gives
Thus the cyclic shift operator has these eigenvectors, with eigenvalues . This is cyclic shift diagonalization by the quantum Fourier transform, and it implies with .
For , the binary encoding is , with the more significant qubit. The required diagonal phase is
so . The allowed-gate circuit is therefore
In execution order, apply the inverse QFT, then the two phase gates, then the forward QFT. There is no extra global phase. Reversing the Fourier sign convention would conjugate both phase gate parameters.
Use the convention
Changing the summation variable from to gives
Thus the Fourier-basis states are eigenvectors of the cyclic shift, with respective eigenvalues , and the cyclic shift diagonalization by the quantum Fourier transform is
For , write with . Then
so
Hence the required quantum circuit applies, from input to output,
The first phase gate acts on the most significant qubit and the second on the least significant qubit .