3. Binary Quantum Query System with Delayed Decisions
For simplicity, let us assume that the Quantum Query System provides only binary answers ("Yes/No", "Fast/Slow", "Happy/Sad", etc.), such that parameter
m from
Figure 2 is set to 1. The possible generalization to higher values will be discussed in
Section 5. The value of
n, on the other hand, is left unrestricted. Consequently, if the query state space spans
n qubits, the user can formulate a query that encompasses
different questions, encoded in the following superposition state:
When given the above state as input, the Quantum Query System will produce the following output:
where
represents the binary answer to the question with index
x. Now, without loss of generality, suppose that after a certain time following the receipt of the answer state from the QQS, the user realizes that the useful answer that needs to be extracted from state
is the one to the question with index
. A direct measurement of state
in the computational basis has a small chance (only
) of revealing the sought after
. Consequently, the amplitude of the target index 0 has to be increased relative to the amplitudes of the other terms in the superposition, through the use of Grover’s algorithm [
2]. The steps of the algorithm, particularized for our specific problem, are given below.
|
Algorithm 1 Modified Grover’s Algorithm to extract the desired answer |
while
do
end while
Measure state in the computational basis.
|
The two operators used in every iteration of Algorithm 1 are
and
. Operator
acts only on the target states (the terms in the superposition that need to have their amplitudes increased) and rotates their phase by
radians. Operator
, on the other hand, acts on all basis states of the
-qubit ensemble to which it is applied and rotates all of them by
radians around the average amplitude of all basis states.
A flow chart presenting all steps of our approach in a visual form appears in
Figure 3. In Phase I, the user queries the system with a superposition of all questions that are deemed relevant to any decision taken in the near future and stores the superposition of answers received from the QQS in a quantum register. In Phase II, which takes place when the Quantum Query System is offline or unaccessible to the user, the iterations in Grover’s algorithm can be used to boost the amplitude of the desired term (the one encoding the answer to the relevant question for the decision to be made), such that the final measurement reveals the sought-after answer with good probability.
One crucial element that separates Algorithm 1 above from a typical application of Grover’s algorithm is the initial state . Usually, there is a uniform distribution of amplitudes over all basis states in the initial superposition, such that the target state(s) have the same initial amplitude as any of the other (non-target) basis states. Boyer et al. [3] showed that, starting from a uniform initial distribution of amplitudes, the optimal number of iterations after which the probability of measuring a target state is maximal is , where r is the number of target states from the total N.
However, the distribution of amplitudes in
, which is the same state as
from Equation
4, is
not uniform. The reason is simply because each of the questions
,
has only one answer,
either or, but not both. In other words, although
is a state vector in a
-dimensional space and should, therefore, be described by a linear combination of
basis states, only half of them have non-zero amplitudes, the ones corresponding to actual answers. For example, if the answer to question
is 1 (i.e.
), then the term
will not appear in the superposition state
. Since, for each question index
, only one answer is possible, the entire superposition
will consist of
terms only, each with amplitude
.
When acting on target states, operator
has to be designed such that it rotates both terms corresponding to a particular question index. Assuming again, for concreteness, that we are interested in retrieving
from the superposition,
has to rotate phases of both the
term and the
term, since we do not know which one contains the actual answer. Therefore, matrix
is a diagonal matrix, where the first two elements on the main diagonal are
and the remaining elements on the main diagonal are 1:
The second operator
is the standard "inversion about the average" operator, defined on
qubits as follows:
The key questions now are how many iterations
T are needed in Algorithm 1 in order to amplify the amplitudes of the target states as much as possible and what is the probability of retrieving the desired information (i.e.
) from the final measurement? As mentioned above, the analysis due to Boyer et al. [3] is not applicable, since the initial distribution of amplitudes is not uniform over all basis vectors. On the other hand, the case of arbitrary initial amplitudes in Grover’s algorithm was studied by Biron et al. [
2]. They show that the optimal measurement time
T is the same, asymptotically, in both scenarios (
uniform distribution of amplitudes or
arbitrary distribution) and is on the order of
, where
r is the number of target states and
N is the total number of states. Furthermore, they find that
T depends only on the initial average amplitudes of the target and non-target states.
Consequently, the time complexity of Algorithm 1 is , where n represents the number of qubits used to encode the index of a question. In terms of the space complexity, since the algorithm employs n qubits for the question part and one qubit for the binary answer, there are qubits used in total. Note that these bounds are derived under the assumption of an ideal, error-free environment with perfect quantum operations. Any ancillary qubits required in a practical implementation for error-correcting purposes are not taken into consideration when stating the above complexities.
Given these requirements for the time and space taken by Algorithm 1, we will show in this section that the probability of obtaining the answer to the desired question is
compared with the
probability that a classical system has to “guess” the correct question ahead of time. Since there is no actual processing of the query answer, the running time of the classical algorithm would be constant.
Let us apply the results in [
2] to our particular initial distribution of amplitudes in state
. In our instance of Grover’s algorithm, the total number of states is
and the number of target states
(these are
and
). The initial (at
) average of the amplitudes for the target states is the average of
and 0, since the question we are interested in has only one actual answer (labeled
) and consequently, the state corresponding to the binary complement of
will have amplitude 0 in the initial superposition
. We denote this average of amplitudes of target states at moment
as:
Similarly, there are
non-target states, only half of which have a non-zero amplitude in the initial state
. Therefore, the initial average amplitudes of the non-target states is:
the same as for the target states. Based on the ratio
, Biron et al. [
2] have determined the optimal measurement time to be:
which, in our case, becomes:
To give a couple of concrete examples, if
, which means that the initial state
contains 8 non-zero terms corresponding to 8 questions and their answers, the value of
T is approximately
. It follows that two iterations of Algorithm 1 are enough to boost the amplitude of the target state to a maximum value before starting to decrease again, if the algorithm is continued. If 10 qubits are used to encode a question index, then state
will span 1024 questions with corresponding answers, which requires
iterations in order for the amplitudes of the target states to reach their first maximum.
In their analysis, Biron et al. [
2] also provide an upper bound on the probability of measuring a target state at the end of the algorithm, after the optimal number of iterations
T has been reached. This bound only depends on the variance of the initial amplitudes of the non-target states
and is given in Equation
12 below:
Recall that, for an arbitrary value of
n, there are a total of
non-target states, only half of which have a non-zero amplitude in the initial superposition
. Consequently, in our case, the variance of the initial amplitudes of non-target states can be calculated as:
Substituting this in Equation
12, the maximum probability of measuring a target state becomes:
The first observation we can formulate about the result above is that the probability of seeing one of the target states through the final measurement can always be raised to more than , regardless of the value of n, if we stop Algorithm 1 after an optimal number of iterations. However, this upper bound is not as good a result as it may look at the first glance. And the reason is that we have two target states whose amplitudes are increased by the algorithm, one corresponding to the actual answer and the second one corresponding to the bit complement of the actual answer . Consequently, it is crucial to see how much each of these two target states is amplified in the end, such that when the final measurement is performed, we obtain the actual answer and not its complement. We do expect that the term will have a higher probability of being measured compared with , since the latter starts with a zero amplitude, but the subsequent analysis will make things more precise.
Let us denote by
the amplitude of the term
(the term we are interested in), as it appears in the state
, at the end of Algorithm 1. Similarly,
is the amplitude of the term
(the term carrying the bit complement of the answer) in the same superposition state
. At any time
t during the execution of Algorithm 1, the amplitude of a target state
can be expressed based on the average amplitude of all target states at that moment
:
As the analysis in [
2] shows, the deviation from the average for a particular target state
i, labeled as
in the equation above, is a time-independent quantity, meaning that it remains constant throughout the execution of Algorithm 1. Consequently, we can determine
and
for our two target states, based on the information we have at the moment
:
Based on the calculated values for
and
, we can now express the amplitudes of the target states at time
as follows:
Subtracting the two equalities above gives us a first equation directly relating
and
:
A second relation can be obtain from Equation
14 that expresses the maximum probability of measuring a target state. Since
is attained at
and the amplitudes of the two target states at that moment are
and
, respectively, it follows that:
Equations
18 and
19 yield the following two possible sets of solutions for
and
:
respectively,
The dual set of solutions for
and
reflects the cyclical nature of Grover’s algorithm and, implicitly, that of our customized version. The amplitudes of the target states are amplified by each iteration in Algorithm 1 until they reach a point where the probability of measuring one of them is maximum. This optimal moment for measuring the superposition state is labeled as
T and its formula is given in Equation
11. The values of
and
at moment
are given in the first set of solutions (Equation
20). We note that, at this point, both
and
are positive and
, which means that we have a higher chance of obtaining the actual answer
than its complement
from the final measurement.
However, if the algorithm is not stopped at time
and we continue applying its iterations, then
and
will start decreasing, become negative and reach a point where they are big enough in absolute value in order for the probability
to be reached again. This moment corresponds to the second set of solutions (Equation
20). However, at this point,
and therefore, the probability of seeing
instead of
is higher. This periodic behavior, where the amplitudes
and
evolve continuously between the values in Equation
20 and those in Equation
21, is exhibited for as long as the iterations in Algorithm 1 are unfolding. For concreteness, we analyze next the results obtained for some particular values of
n.