In the last chapter, we implemented our first quantum algorithm, Deutsch–Jozsa, in Q#. By helping Nimue and Merlin play Kingmaker, we saw how quantum programming techniques like phase kickback can give us advantages in solving problems. In this chapter, we will take a look at phase-estimation algorithms we can use in our quantum programs to solve different types of problems. Again, we will return to Camelot; this time, we will use a game between Lancelot and Dagonet to illustrate the task at hand.
Throughout the book, we’ve seen that games can be a helpful way to learn quantum computing concepts. For instance, in the previous chapter, Nimue’s game with Merlin let us explore our first quantum algorithm: the Deutsch–Jozsa algorithm. In this chapter, we’ll use another game to discover how to learn the phases of quantum states using phase kickback, the quantum development technique used by Deutsch–Jozsa and many other quantum algorithms.