1. Introduction
Let’s say
is a function. In the case of an unstructured database, the domain of the function represents the indices of the database.
can be 0 or 1.
indicates that
points to one index of the database that contains the element that satisfies the search criteria. In all other cases,
. Our purpose is to find the index
for which
.
2. The Proposed Quantum Algorithm
Let’s say N is the size of the search space. Let’s also assume that
. Therefore, the binary representation of an index needs a maximum
qubits.
For our proposed algorithm, we can use the quantum circuit as shown in Figure 1. The first
qubits contain all zeros. And the ancillary qubit contains a 1. A Hadamard gate is applied to the first
qubits. A Hadamard gate is also applied to the ancillary qubit. We get the following state as a result:
(1)
Figure 1. Quantum circuit for the proposed quantum algorithm.
In our proposed algorithm, we use an oracle
. If
is given as input and
is the ancillary qubit, then we get the following state on querying the oracle:
(2)
is the addition modulo 2 operator. In our case, the ancillary qubit is 1, and one Hadamard gate is applied to it. Therefore, on querying the oracle
, we get the following state [3]:
(3)
For example, if
,
. In that case, the state
is going to be the following:
(4)
After querying the oracle, we will get the following state:
(5)
Let’s consider
when
. And in all other cases,
. Therefore, the state
is going to be the following in this case:
(6)
Therefore, the first
qubits after querying the oracle are the following:
(7)
We can now apply a quantum gate G on this state, so that the output of this gate G is
. Please note that in our example,
when
. For any other value of
,
.
(8)
If we measure
, we will get the index in the unsorted database that points to the entry that satisfies the search criteria.
3. Implementation of the Quantum Gate G
Let’s say M is a unitary matrix that implements the quantum gate G. In this section, we will attempt to determine the unitary matrix M.
Let’s say N is the size of the search space. The indices in the unstructured database are
. It will take
qubits to represent these N indices.
Let the indices in the unstructured database be
. And let the corresponding values of
be
.
For example, in our example, the binary indices in the unstructured database are
. The corresponding values of
are the following:
This indicates the value pointed to by the binary index
satisfies the search criteria, and all other values do not. As a result, the first
qubits after querying the oracle are the following:
(9)
We want the output of the quantum gate G to be
.
Let’s say the column vector X represents the first
qubits after querying the oracle.
(10)
In our example, X represents the following state:
(11)
Therefore, in our example,
(12)
Let the column vector Y represent the expected output.
(13)
For example, in our example, the expected output is
. Therefore, Y is the following column vector.
(14)
In other words, the unitary matrix M is applied to X, and we get the output Y.
(15)
Therefore, if we assume
to be a function that takes each element of X as input and gives the corresponding element of Y as output, then the following holds true:
Therefore,
(16)
Therefore,
is a function for which
. Therefore,
is an involution function. And the corresponding matrix
is an involutory matrix.
4. Properties of Matrix M
Property 1:
is a unitary matrix.
As
implements a quantum gate,
must be a unitary matrix [4]. For a unitary matrix U, the following holds true:
(17)
In our case,
is a real matrix. Therefore,
(18)
Property 2:
is an involutory matrix.
As
is an involutory matrix, we can write the following:
(19)
Therefore,
(20)
Property 3:
is an orthogonal matrix.
As
is a unitary matrix and an involutory matrix, we can write the following:
(21)
Therefore,
(22)
Therefore,
is an orthogonal matrix.
Property 4:
is a symmetric matrix.
As
is an orthogonal matrix, we can write the following:
(23)
(24)
As
is an involutory matrix, we can write the following:
(25)
Therefore,
(26)
Therefore,
is a symmetric matrix.
Based on the above properties, we will look for the value of the matrix M that is as close to
as possible. As the value of M is not equal to
for all values of N, the value of M is going to introduce an error term. We will discuss the error term in Section 6.
5. Finding the Value of M
Ideally, we are looking for a matrix M for which the following condition holds true:
(27)
(28)
(29)
Therefore, M should be equal to
. However,
may not be a unitary matrix for all values of N. Therefore, we will try to find a unitary matrix M such that
is as close to
as possible.
Let’s say,
(30)
(31)
This
is the error term.
Therefore, we will look for an
matrix M for which the following conditions hold true:
1)
.
2)
.
3)
.
4)
as M is involutory.
5)
.
6) The error term EX is minimum.
We observe the following:
(32)
(33)
Using the Sherman-Morrison formula [5], we get the following:
(34)
Let’s say M is the following matrix:
(35)
Using the Sherman-Morrison formula, we get the following:
(36)
As M is a symmetric, unitary, and involutory matrix, we get the following:
(37)
By comparing both sides, we get the following:
(38)
Here,
is the identity matrix, and
is a matrix with all entries equal to 1. Therefore, the diagonal entries of the matrix M are
and the non-diagonal entries of M are
. Given the value of N, these values can be computed in O(1) time. The value of M does not depend on a specific input.
6. The Error Term
As we discussed, the error term is
. We observe the following:
(39)
7. Results
Let’s say
is the search space.
is the required number of qubits.
If we calculate the values of
, and
for different values of
, and take the determinant of the error matrix
, we get the following Table 1:
Table 1. Determinant of the error term.
n |
|
|
3 |
8 |
−0.00020734564555665073 |
4 |
16 |
−7.629394531249957e−05 |
5 |
32 |
−5.758564428031929e−06 |
6 |
64 |
−9.081620849843095e−08 |
7 |
128 |
−1.89081434676154e−10 |
8 |
256 |
−2.4238765388563638e−14 |
9 |
512 |
−6.252713627319217e−20 |
10 |
1024 |
−6.562978374539346e−28 |
11 |
2048 |
−2.8990010884419623e−39 |
Please note that the output matrix Y is the following:
(40)
In other words, the diagonal entries of the output matrix Y will be the following:
(41)
And, the non-diagonal entries will be the following:
(42)
Therefore, once we find the required matrix M, the first
qubits of the following state are applied to the corresponding quantum gate:
(43)
As output, we will obtain the index from which we can retrieve the positions of the elements in the subset that satisfy the search criteria, along with the error as stated above.
8. Conclusions
Until now, the time complexity of a quantum search algorithm is
where N is the size of the search space. This paper proposes a quantum algorithm that reduces this time complexity. The proposed quantum algorithm requires
qubits as input, where
, and one ancillary qubit. After measuring the n-qubit output of the quantum gate G implemented using the unitary matrix M, we get the index in the unsorted database that satisfies the search criteria with a significantly high probability.
Though the unitary matrix M corresponding to the quantum gate G is an
matrix, there are only two different values for elements of M. All the diagonal elements of M have the same value. All non-diagonal elements of M have the same value. Therefore, the matrix M can be constructed in
time.