{'fraction_non_alphanumeric': 0.03090368166604686, 'fraction_numerical': 0.008962439568612868, 'mean_word_length': 4.29871921182266, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Majorization in General Grover's Algorithms: Efficient vs Non-efficient cases

We study the characterisation of efficient and non-efficient families of Grover's algorithms according to the majorization principle. We develop a geometrical interpretation based on the parameters that appears on these algorithms. Using this interpretation we observe a step-by-step majorization in all efficient Grover's algorithms, whereas the non-efficient Grover's algorithms fail to abide by this majorization principle. These Majorization results are first obtained from numerical calculations. Motivated by these numerical results, we also obtained an analytical demonstration. Finally, the geometrical interpretation found for these parameters is used to obtain additional results of Grover's algorithms that improves our understanding of how they work.


I. INTRODUCTION
Majorization theory emerges as a framework to measure the grade of disorder of classical probability distributions [1,2]. That one probability distribution majorizes another means that a series of inequalities exist between these probability distributions, i.e, there exists some constraints between these probabilities. From the quantum mechanical point of view, Majorization appears as a solution for a large number of quantum information problems, like conversion of quantum states using local operations [3].
One of the main open problems in quantum computation theory is finding some mathematical structure underlying optimal quantum algorithms. One possibility for this mathematical structure would be a majorization principle that is satisfied in every optimal quantum computation algorithm. Numerous studies have already been carried out from the majorization point of view, some results are the step-by-step majorization followed in the Quantum Fourier Transformation [4] or in complete algorithms, as the one designed to solve the hidden affine function problem [5].
The central piece studied in this work is the well known Grover's algorithm [6] which performs the process of searching in a database of N elements. This is a wellknown problem in classical computation for which the best result possible is of O(N ) steps [7]. However, using Grover's algorithm, it is possible to perform this search in O( √ N ) steps. A simple generalization of Grover's algorithm can be obtained when the database has more than one correct answer for the search. A study of this case has been performed for the case of searching one of k correct elements in a database of N elements [8]. For this case Grover's algorithm requires O N k steps. However, we will consider only the case with one correct answer since the generalization for the multiple answer case is straightforward.
Depending on the values of some parameters, Grover's algorithm can be separated into two types: the efficient ones (which find the desired result with the application of O( √ N ) steps) and the non-efficient ones (which are not capable of finding the desired result) [9]. A study of a particular case of the efficient Grover's algorithm has been performed from the majorization point of view [10], and the conclusion is that this particular algorithm follows a step-by-step majorization.
In this paper we study the most general Grover's algorithm possible, for which a variation of some parameters can be made to obtain an efficient or non-efficient Grover's algorithm. With this in mind, we study these two possible cases to find if they follow a step-by-step majorization process or not. First we study the efficient Grover's algorithms and we obtain that they follow a step-by-step majorization process. Secondly we study the non-efficient Grover's algorithms and we find that they do not follow a step-by-step majorization. Additionally, as a consequence of this study we develop a geometrical interpretation that can be used to understand why efficient Grover's algorithms find the desired result while the non-efficient ones do not.
The main results of this work show that the study of Grover's algorithms supports the existence of a Majorization principle which can be used to distinguish efficient quantum algorithms from the non-efficient ones.
Finally, it is shown that the geometrical interpretation developed in this work can be very helpful in the understanding of how Grover's algorithms behave. To show it we use this interpretation to find already known results but obtained in a different way. This paper is organised as follows: in Section II we review some basic concepts about majorization theory and its relation to quantum algorithms. We explain the idea of generalized Grover's algorithms and summarize the already known results related to majorization for these algorithms in Section III. In Section IV we develop the mathematical tools we need to perform the majorization study in the most general case. We make a numerical study of generalized Grover's algorithms in Section V, analyzing the effect some parameters of the algorithm have on the majorization behaviour. In Section VI we perform an analytical study only for the efficient algorithm case using an approximation. In Section VII we use the formulas obtained to get some interesting addi-tional results not related with majorization. Finally, we summarize the results obtained and introduce possible ways to continue the study of majorization in quantum algorithms in Section VIII.

II. MAJORIZATION THEORY IN QUANTUM ALGORITHMS
Our approach to the mathematical study of Grover's algorithms will be from the majorization point of view. In this section we explain the relation between majorization and quantum algorithms.

A. Majorization theory
Let us consider two vectors x, y ∈ R d such that whose components represent two different probability distributions. Consider the components of these two vectors sorted in decreasing order, denoted as x ↓ and y ↓ . We say that distribution y majorizes distribution x, written as x ≺ y if and only if the following relations are satisfied: probability sums of this kind are called "cumulants". We must mention that there are other equivalent definitions of majorization [2], but this is the only one needed to understand the results shown in this work.

B. Link between majorization theory and quantum algorithms
Let ψ (m) be the pure state representing the register in a quantum computer at an operating stage labeled by m = 0, ..., M −1, where M is the total number of steps in the algorithm, and let N be the dimension of the Hilbert space. If we denote as {|i } N i=1 the basis in which the final measurement is performed in the algorithm we can associate a set of sorted probabilities p i , i = 1, ..., N , to this quantum state decomposing the register state in the measurement basis, that is: This way we can associate the following probability distribution to the register state: where i = 1, ..., N . This probability distribution represents the probabilities of all possible outcomes when m steps have been performed. A quantum algorithm will be said to majorize this probability distribution between steps m and m + 1 if and only if: and from this definition, we can say that a quantum algorithm follows a step-by-step majorization if and only if: where m = 0, 1, ..., M − 1.
A step-by-step majorization means that there exists a net flow of probability directed to the values of highest weight, giving way to a steeper distribution with each step of the algorithm. From the physical point of view, this is an evidence of a particular constructive interference which will step-by-step build the solution until reaching the maximum probability for the desired outcome.
It is important to note that the process of majorization is checked on a particular basis, so step-by-step majorization is a basis dependent concept. However, each quantum algorithm is built around a final basis in which the register state will be measured, and each of these possible outcomes have a defined meaning, while other possible basis would not have a meaning for that specific algorithm. This means that there exists a preferred basis in which each algorithm work in order to finally build up an answer, this preferred basis will be the one used to test the step-by-step majorization.

III. GROVER'S ALGORITHM
In order to study the majorization principle in Grover's algorithm in the most general way, we will need to use a general description of the algorithm. For this purpose, we present a summary of the most important results that appear in the study of Grover's algorithms, the details of the algorithms and their proofs can be found in [9]. After these results are presented, we particularize the results of majorization shown previously for these algorithms.

A. Results of General Grover's Algorithms (GGAs)
Let us have n qubits, this means that we can create a superposition of N = 2 n possible states, the starting point of the algorithm will be a superposition of the N states with equal weight, that is: the aim of the algorithm is to apply operators to this initial state until reaching a maximum probability of finding the result of the search, we will call the sought result |x 0 , which is one of the components of the previous summation.
One of the critical results in the study of both Grover's algorithms and their majorization properties insofar as the simplifications it enables, is the fact that the operator from which the Grover's algorithms are formed acts symmetrically on all the states different from |x 0 that compose the summation on (6). This enables us to work on a system of two dimensions spanned by the following vectors: this way, the initial state can be written as: In this basis, it is found that the operator used in Grover's algorithms, the so-called Grover kernel, has the following expresion: were β and δ are complex numbers of modulus 1. Studying the action of K over the initial state one can find [9] that for the Grover's algorithms to be efficient, i.e., to have the chance to achieve a probability near to 1 of finding |x 0 , a constraint appear that relates β and δ. This constraint is: The case that is usually studied is the Grover's algorithm with β = δ = 1. In this work we study the most general case possible, that is, the so-called General Grover's Algorithms (GGAs) which can have any value of β and δ of modulus 1, including the possibility of having β = δ (non-efficient GGAs).

B. Majorization in Generalized Grover's Algorithms
Now we are in the position of combining the mentioned results of majorization and GGAs. First, the symmetry of the algorithm allows us to work with a simple probability distribution because, as we said before, the symmetry of the problem means that we work in a two dimensional space which at the same time means that the probability distribution is just a vector of two components. This helps because p ↓ is then easy to compute: we have one component of the probability distribution, the one associated with |x 0 , with a probability p x0 and N − 1 components, the ones that are not |x 0 , with a probability finding the state |x ⊥ , this way it is easy to order the vector p to get p ↓ . The fact that there are only two different values of the probability p means that there are only two possibilities for each step, either the state |x 0 transfer part of his probability to the N − 1 orthogonal states, or all the orthogonal states transfer part of their probability to |x 0 . Considering this symmetry of the problem, the only way a majorization process could be satisfied step-by-step until reaching a maximum probability of measuring |x 0 would be if starting from the initial state the probability of measuring |x 0 increases step-by-step.

C. Situation of the majorization study in Grover's algorithms
Studies of the processes of majorization of Grover's algorithms have already been carried out for the case of β = δ = 1 [10], and it has been shown that there is, in fact, a step-by-step majorization process satisfied by this particular case of the GGAs.
The aim of this work is to finally settle the question of majorization for all possible GGAs, that is equal to demostrate the existence or not of a step-by-step majorization process for every possible value of β and δ including, of course, the particular case of efficient GGAs (that is, with β = δ = −1). With the goal of presenting the key variables of GGAs that depend on β and δ, we have made a special development of the algorithm that allows us to better understand what changes in the algorithm when we change β, δ, or both of them.

IV. KEY MATHEMATICAL OBJECTS FOR THE STUDY OF GENERAL GROVER'S ALGORITHMS
It is known that Grover's algorithm with β = δ = 1 has a Grover's kernel that works like a rotation in the two dimensional space spanned by |x 0 and |x ⊥ that rotates |x in to the state |x 0 with sucessive applications of the kernel (that is, through a series of small rotations [12]). The interpretation of Grover's kernel as a rotation means that with each step, the projection of the register state over the vector |x 0 increases which means a step-by-step majorization process. This is a perfect example of how giving a geometrical meaning to the algorithm simplifies both its understanding and the study of its majorization process. However, the algorithm can no longer be seen as a rotation like this when we have another values of β and δ. To get a geometrical meaning to simplify our understanding of GGAs we have made the following development. The register state after m applications of Grover's kernel will be K m |x in , this means that the probability amplitude corresponding to the state |x 0 after m applications of the kernel, a m (x 0 ), is given by: where we have introduced the eigenvalues ξ 1,2 = e iω1,2 and eigenvectors |κ 1,2 of the kernel K given by: where the proportionality symbol in (13) means that the states are not normalized. However, we are interested in the probabilities, with this in mind we make the following definitions: with j = 1, 2, we will call these as amplitude components, and: which is the phase difference of the amplitude components. With these definitions we have that (11) can be written as: and then we have the following expression for the probability of measuring |x 0 at step m: A representation of these definitions and their relations can be found in the figure 1. At this point we do not know much about the values of the modulus of a 1 and a 2 or their phase difference, but there is one thing clear: the probability p m (x 0 ) will have a maximum value when m has the value that best aligns a 1 e imω1 with a 2 e imω2 , or equivalently, the value of m which maximizes the real part of e im(ω2−ω1)+iδa . This way it is found that if the sum of the modulus of a 1 and a 2 takes the value 1 or near to 1 the number of steps M that the algorithm needs to reach the desired result is given by: where ∆ω = ω 2 − ω 1 and [q] means the natural number closest to q.
It is important to notice that both δ a and ∆ω are only functions of β, δ and N , i.e., for fixed values of these variables δ a and ∆ω are constants. If δ a is several times greater than ∆ω the application of K has the action of rotating a 1 and a 2 at a constant rate for every application of K. This rotation could favour an alignment of these two complex numbers or the opposite, depending on the relative sign of δ a and ∆ω. If these two variables have opposite signs, the kernel will align better a 1 and a 2 with each step, which at the same time means an increase of the probability of measuring |x 0 with each step.
This way we have a geometrical interpretation of GGAs which allow us to deduce if there is a step-by-step majorization focusing only on the sign of two variables. The study shown in this work is focused then in the study of the complex numbers a 1 , a 2 and ∆ω.

V. NUMERICAL STUDY OF THE MAJORIZATION PROCESS IN GROVER'S ALGORITHMS
As stated in the previous section, all we need to compute to get an idea of the existence or not of a stepby-step majorization process in a GGA is ∆ω and the complex numbers a 1 and a 2 .
Given the different results obtained for the case of efficient and non-efficient GGAs (that is, β = δ = −1 and β = δ respectively) we separate the study in this section into two cases.
A. Efficient algorithms case (β = δ = −1) To make this numerical study, we have parametrized β and δ as: The numerical results obtained for δ a = δ 2 − δ 1 and ∆ω for all possible β = δ and for N = 4 and N = 1000 can be seen in figures 2 and 3 respectively. It is clear from these figures that the values δ a and ∆ω have opposites signs for every value of the parameter t (or equivalently, for every value of β = δ), and the only effect that varying N has is to change the amplitude of the oscillation-like behaviour these two variables have. It can also be seen that for the case β = δ = −1 the value of ∆ω is 0, this means that applying the Grover kernel does not produce a rotation. This is related with the fact that for these values of β and δ, the Grover kernel is the identity operator.  We can also see in the figures 4 and 5 the variation the modulus of a 1 and a 2 experiments with the parameter t for N = 4 and N = 1000 respectively. One can also notice that in the case we are studying, the values |a 1 | and |a 2 | have a dependance with t that always satisfies: This is a very interesting result which shows that every efficient Grover algorithm can get the state |x 0 with a 100% chance if it manages to perfectly align a 1 and a 2 .
We can also derive the known result in which for N = 4 and β = δ = 1 only one application of the kernel is neccessary to get the desired state |x 0 , this is because for these values δ a is exactly −∆ω.
Considering these results and the reasoning made in the previous section we can conclude, from a numerical point of view, that all the efficient GGAs perform a stepby-step majorization process because the probability of measuring |x 0 increases step-by-step as a consequence of the opposite sign of δ a and ∆ω.
This process of majorization can be seen directly in figures 6 and 7 in the so-called Lorenz diagrams which show the probability cumulants as a function of the number of elements of p ↓ , labeled as x, considered. We have already demonstrated numerically that efficient GGAs follow a step-by-step majorization process for all possible values of β = δ = −1. Now we need to explore the case of non-efficient GGAs, which are given by: To perform the study we parametrize the values β and δ as: where t,g ∈ [0, 2π). Of course, extending the study to two independent parameters like this would force us to study the values functions takes over the square [0, 2π)×[0, 2π), i.e., we would have to study a surface. To simplify the study, we will impose a constraint of the kind: this way, we only have to study a function of one variable, while we still have β = δ.
We can see the numerical results obtained for ∆ω for g = t + π and g = t + π/2 and for N = 4 and N = 1000 in figures 8 to 11. Again, the only effect that increasing the value of N has is to reduce the amplitude of the oscillations. Additionally, it can be seen that the values of ∆ω tends to the value of the constant introduced in (23) for large values of N. Following the steps of the efficient algorithm case, we also show two Lorenz diagrams in figures 12 and 13.
The values of δ a are not shown because they are not necessary for the study of majorization given the results of ∆ω. This is explained as follows: One could wrongly think that if we restrict ourselves to a part where δ a and ∆ω have different signs we would get a step-by-step majorization process even with β = δ. This deduction is wrong, even if the two values have opposite sign, we would not have that δ a is several times greater than ∆ω (as we can see in the figures, ∆ω takes big values, unlike in the efficient algorithm case), and this is vital for FIG. 9. Representation of ∆ω with N = 1000 and g = t + π as a function of t. As we can see, the value of ∆ω tends to the constant value π.
FIG. 10. Representation of ∆ω with N = 4 and g = t + π/2 as a function of t. The value of ∆ω oscillates around the value π/2. the step-by-step majorization process. Having δ a and ∆ω of opposite signs means that in the first step the probability of measuring |x 0 increases, but if δ a is not several times greater than ∆ω, that means the rotations induced by the kernel would be chaotic, even if the first step increased the probability of measuring |x 0 , a second application could apply such a big rotation that it decreased the probability, only to be increased again by a third application and so on.
In fact, the Lorenz diagrams shown in figures 12 and 13 can be misleading because having a small N and a small number of steps m can mask the chaotic process the non-efficient GGAs perform, for which an example is shown in figure 14.
As it can be seen, there is no majorization order in this process, the cause of this beign the big rotation angles that the kernel performs. Thus, we reach the second result of this work: Result 2. Non-efficient GGAs (i.e., with β = δ) do not follow a step-by-step majorization process.

VI. ANALYTICAL DEMONSTRATION OF MAJORIZATION FOR EFFICIENT GROVER'S ALGORITHMS
Motivated by the numerical results shown in the previous section we derive a demonstration of the step-bystep majorization process based on expressions obtained by retaining the terms of order O 1 √ N and ignoring smaller terms. This means that the expressions obtained in this section will be more precise for higher values of N . The approximated expressions for ∆ω and δ a obtained are the following: FIG. 13. Lorenz diagram for N=4, t = 3.37 and g = t + π 3 . A global maximum of probability is reached at m(2). This diagram might be misleading because it might look like there is a majorization process. This is not true because only a small number of steps is shown, the true chaotic process that takes place when β = δ can be seen better in figure 14.
FIG. 14. Lorenz diagram for N=100, t = 1 y g = t + 5 6 π. An inset is shown for the cumulants from x = 0 to x = 4. As we can see the algorithm for this case is completely chaotic, so there is no majorization process.
Having in mind that these arctangent have an argument of small value we get: which means that when ∆ω is positive δ a is negative and vice versa. Additionally, δ a is several times greater than ∆ω. This means that the probability of measuring |x 0 increases with each iteration. This way we have analytical arguments which show that there is a stepby-step majorization process in efficient GGAs. A representation of the errors caused by taking the approximation is shown in figure 15 for N = 1000.
FIG. 15. Representation of the approximated formula for ∆ω (24) (in orange) and the difference between this approximated formula and the numerical results for ∆ω (in blue) as a function of t for N = 1000. As it can be seen, the error that appears in the approximation is several orders of magnitude smaller than the value of ∆ω, so an inset is shown. In figure 16 the relative error of the approximation is shown for several values of N . It can be seen that the relative error is reduced for increasing values of N , as it should be expected.

VII. ADDITIONAL RESULTS
The study of the functions a 1 , a 2 and ∆ω is not only useful for the study of majorization, it can give insight into the behaviour of GGAs in ways some other mathematical developments of the algorithm can not. As an additional advantage, the study of these functions provides a geometrical meaning of the way the algorithm works, which helps in obtaining an intuitive understanding of the algorithm.
It is shown in [9] that the total number of steps neccessary to complete the algorithm, M , for large values of N is given by: but we have already seen in (27) that for large values of N , δ a is approximately −π, while also having (26). Combining these two results and formula (19) we get the same result given by the previous formula, but we give it a clear geometrical meaning: The numbers of steps needed for the algorithm to be complete, M , is the number of rotations given by the kernel needed to align a 2 and a 1 . Giving a geometrical meaning to formula (28), although it was already a known result, put us on the road to obtain more results. The number of steps M takes the value that best align a 2 and a 1 but it is possible that even in this case these two values do not end perfectly aligned for a given value of t. This situation is shown in figure 17. However, we already know that δ a and ∆ω are functions of t, this means that there exists values of t for which we get: Thus, varying t we could achieve a situation where the kernel is capable of perfectly align a 2 and a 1 , i.e., the Grover algorithm could achieve a 100% chance of measuring the desired state |x 0 because, as we have seen, in efficient algorithms |a 1 | + |a 2 | = 1. This was an already known result, [13], but is obtained using a different approach which gives again a geometrical interpretation to this process.

VIII. CONCLUSIONS AND OUTLOOK
Now we can collect all the results found in the analysis of majorization in GGAs: • Efficient GGAs follow a step-by-step majorization process due to the ordered behaviour of the rotations applied by Grover's kernel in these cases.
• Non-efficient GGAs do not follow a step-by-step majorization process due to the chaotic rotations applied by their Grover's kernel.
These results support the idea of a Majorization principle as an underlying mathematical structure working behind the efficient algorithms. It is important to note that the step-by-step majorization only occurs in the efficient case until the maximum probability is achieved. After this point, the rotations applied by Grover's kernel disalligns a 1 and a 2 , which leads to a decrease in the probability of measuring the desired state step-by-step. This means that the majorization process only occurs until the algorithm has find the desired result. Additionally, we have shown that the mathematical development obtained in this work can be of great help in the understanding of GGAs. In fact, this geometrical interpretation of the GGAs can be used to obtain an algorithm that works with a 100% chance of success. In the same way, this geometrical interpretation is really interesting to develop an intuition of how the algorithm works.
Finally, it is worth mentioning that this work can be continued with a study of the algorithm performed by real devices. This way, if a Majorization principle exists, majorization could be used to detect which experimental implementation of the algorithm performs a truly efficient process. Some studies of a majorization principle in quantum computation in experimental devices has been carried out with very promising results [14].