Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2025/iii/paper-324/3/a/iv/solution

Prepare in the second register by part (ii), while preserving the first register . Applying the diagonal unitary from part (iii) gives
The preparation can be made coherent using amplitude amplification in place of postselection when this map is needed as a subroutine.

New to topics? Read the docs here!