\n", " | Imagine a plane on which $|good\\rangle$ and $|bad\\rangle$ vectors correspond to vertical and horizontal axes, respectively. We can represent the starting state $|all\\rangle$ as a superposition of these states: | \n", "\n", " | |
\n", " | Each Grover's iteration consists of two steps. The first step is applying the phase oracle, which multiplies the amplitudes of \"good\" states by $-1$. On the circle plot, this transformation leaves the horizontal component of the state vector unchanged and reverses its vertical component. In other words, this operation is a reflection along the horizontal axis: | \n", "\n", " | |
\n", " | The second step is applying the diffusion operator. Its effect is another reflection, this time along the vector $|all\\rangle$: | \n", "\n", " |
\n", " | When should we perform the measurement? \n", " The probability of getting a certain basis state as the measurement outcome equals the squared amplitude of that state in the superposition. The greater the amplitude, the higher the chance of getting the corresponding state when performing the measurement.\n", " \n", "Since our goal is to get one of the \"good\" states with probability as high as possible, we need to increase the amplitudes of \"good\" states as much as we can (and reduce the amplitudes of \"bad\" states correspondingly). Geometrically, this means that we want to rotate our state vector as close to the vertical axis as possible. | \n",
" \n", " | |
\n", " | Our initial state started with the angle $\\theta$ to the horizontal axis, and every iteration rotates it $2\\theta$ counterclockwise, so the angle after $R$ rotations is $(2R+1)\\theta$, and we want it to be as close to $\\frac{\\pi}{2}$ as possible to be close to the vertical axis: \n", " \n", "This also explains the decrease in success probability if we keep iterating. More iterations will over-rotate our state, which will start getting further and further away from the vertical axis, thus reducing our success probability. | \n",
" \n", " |