2 Prepare quantum states
This chapter covers
- Using quantum gates to change quantum states
- Using Q# and Qiskit to write quantum programs
- Running and testing quantum programs using simulators
- Watching the state of a quantum program during its execution
Quantum algorithms revolve around manipulating the states of quantum systems. Figure 2.1 shows the flow typical for many quantum algorithms. The algorithm starts with preparing the quantum system in a certain superposition state and then applies a sequence of transformations to it before performing a measurement to extract the results. The goal of the algorithm is to lead the system to a superposition state in which the basis states that are answers to the problem being solved have large amplitudes, and all the other basis states have much smaller amplitudes. This allows the final measurement to yield the answer to the problem with high probability.
Figure 2.1 Any quantum algorithm can be broken down into several steps: prepare the initial state, evolve it following the algorithm, and measure the end state to get the result. The goal of many algorithms is to end up in a state in which the result of the final measurement is a correct answer with high probability. (Each block of eight bars represents the eight amplitudes of the basis states in a three-qubit quantum state.)
