Quantum measurement detection algorithms

In this paper, we introduce and study the quantum measurement detection algorithms (QMDA), whose objective is to detect whether unwanted measurements are being taken in a quantum circuit or not by applying the Zeno effect. A QMDA is a quantum circuit that includes three unitary matrices, one of them being applied numerous times consecutively, and whose initial state is ﬁxed when no foreign measurements occur. One example is the Elitzur–Vaidman bomb tester, which is generalized by the QMDA deﬁnition, allowing the detection of measurements that are taken in an unknown basis and in circuits with an arbitrary number of qubits. We prove some key properties and limitations of these algorithms, as well as studying the performance of the Elitzur– Vaidman bomb tester and its possible improvements. Some extensions of the deﬁnition would lead to algorithms such as the counterfactual communication one.

However, other algorithms that show the potential of quantum computers have been proposed, such as the Elitzur-Vaidman bomb tester [3]. This algorithm is based on the Zeno effect [4], that is, the initial state of the circuit is slowly rotated to a different state unless measurements occur. On the other hand, in the presence of measurements, the final and initial states are the same with high probability. Zeno effect-based circuits, and mainly the Elitzur-Vaidman one, have proved to be useful in applications to multiple fields, such as cryptography or object mapping [5][6][7][8][9].
In this article, we introduce a framework for studying measurement detection in an unknown basis in circuits of the same kind. One of the aims of this work is to extend the scope of the Elitzur-Vaidman algorithm, and study its behaviour for unknown measurement bases and multiple qubits. So, we introduce quantum measurement detection algorithms (QMDA), which provide a generalization of the Zeno effect of the Elitzur-Vaidman algorithm.
A QMDA is a quantum circuit that includes three operators (U 0 , U , U 1 ), one of them (U ) being applied numerous times consecutively, and whose initial state is fixed when no foreign measurements (i.e. undesired measurements that are not expected during the execution of a circuit) occur.
Some properties of a QMDA are proved, including the detection of measurement probability of error of a QMDA for a given measurement basis and the corresponding optimal value. In addition, we find some bases that are likely to yield less accurate detections, although the probability bounds that we provide, decrease exponentially as the number of qubits increases. Such bases are given by a linear combination of eigenvectors of the operator U . This framework allows to compare the generalization of the Elitzur-Vaidman algorithm with the best possible QMDA. For more than one qubit, it can be proved to be outperformed by some rather difficult-to-describe QMDA.
Finally, we hint at some extensions of the definition of a QMDA that might overcome some problems derived from our study. Such extensions of the definition would also include algorithms such as the counterfactual communication [5] one. In addition, a QMDA might also be helpful to spot interferences that cause undesired measurements in a circuit.
The structure of this paper is as follows. In Sect. 2, we briefly describe the Elitzur-Vaidman bomb tester. In Sect. 3, we introduce the definition of QMDA, its associated detection scheme and we show the main properties of these circuits. In Sect. 4, we study the particular case of the Elitzur-Vaidman bomb tester, and finally, Sect. 6 contains the conclusions and future work.

Elitzur-Vaidman bomb tester
The objective is to detect measurements in a 1-qubit quantum circuit. Such measurements represent a bomb in a quantum circuit, which explodes when |1 is measured. The algorithm is designed to minimize the probability of measuring |1 , while detecting the presence of the measurements in the end, without triggering the bomb. As mentioned before, O will represent the place where a measurement may or may not occur.
The Elitzur-Vaidman circuit is shown in Fig. 1, where θ = π 2k for a given k ∈ N, and the rotation R θ , whose coordinate matrix with respect to the computational basis is cos θ − sin θ sin θ cos θ , is applied k times. As we mentioned above, the rotation is applied multiple times in order to rotate the state slowly while the measurements may occur, so that an interruption of such rotation (a measurement) would cause different outcomes in the final measurement with high probability.
If there are no measurements on O (no bomb), the state |0 will be allowed to rotate to |1 , which will be the result of the last measurement with certainty. (Since this measurement is not related to O, it does not affect the bomb.) On the other hand, if there is actually a bomb, each O will take a measurement. This is the case when the rotation is constantly being interrupted, and consequently, the state will not be able to get to |1 and it is likely to stay in |0 for every O measurement. More precisely, the probability of outcome |1 (and so exploding the bomb) is sin 2 θ each time. Therefore, the probability of measuring |0 in every O, is cos 2k θ − −−→ k→∞ 1.
So, the probability of measuring |0 at the end can be as close to 1 as desired, meaning the detection of bomb in the circuit despite not having sparked any explosion.
As we see, the algorithm detects the existence of measurements in a circuit. A relevant question is its performance when the measurements basis is unknown and arbitrary. This is the problem that will be addressed in this article.

QMDA and their properties
As shown in the previous section, we know algorithms that are able to detect, with high probability, if measurements were taken during the circuit or not, and our aim is to generalize them taking the Elitzur-Vaidman algorithms as the main reference. We will provide the theoretical framework before focusing on the Elitzur-Vaidman bomb tester.

QMDA definition
The following definition is inspired by our previous work on Quantum Abstract Detecting Systems (QADS) [10]. These systems are able to detect whether there is a marked Definition 1 A quantum measurement detection algorithm of size n, henceforth QMDA n , is a 5-tuple (U 0 , U , U 1 , k, |ψ 0 ), where |ψ 0 ∈ H represents the initial state, being H a Hilbert space of dimension N = 2 n ; U 0 , U , U 1 are unitary operators on H and k > 0 is a natural number such that U 1 U k U 0 |ψ 0 = |ψ 0 .
As shown in Fig. 2, U 0 represents the sub-circuit before the first O (measurement or not), U the sub-circuit that will be repeated between each two O and U 1 the final sub-circuit before the last measurement. It is clear, then, that the circuit is prepared for k + 1 applications of O. If O ≡ I (no measurement), then the gates are applied consecutively getting to the final state |ψ 0 . If O ≡ measure, we assume all of them measure in the same basis.
From this, the detection scheme for measurements is the following. We would like to minimize the probability of error of the algorithm when the measurement basis is unknown. We should notice that the detection scheme does not provide a wrong answer when O ≡ I , but it might fail when O ≡ measure when we obtain |ψ 0 at the end, so the probability of error is only related to this case.
Our definition allows us to introduce a family of Elitzur-Vaidman algorithms.

Definition 2
We define EV n,k as the 5-tuple (R ⊗n . EV n,k is a QMDA n for all n and k natural numbers. The circuit is shown in Fig. 3. The final NOT gate has the objective of fixing the initial state whenever O ≡ I N .

Properties of a QMDA n
We begin by studying the behaviour of the circuit when the measurements occur. Let us introduce some useful notation.
, we define the auxiliary matriceŝ M 0 gathers the probability of the QMDA n circuit collapsing into each |m i in the first O measurement, after starting in the state |ψ 0 ;M gathers its probability of collapsing into each |m i in the following O measurements, after starting each subcircuit in the corresponding |m j measured in the previous O; andM 1 gathers its probability of collapsing into |ψ 0 at the end (which would mean a wrong detection), depending on the state |m j it started in after the final O measurement.
The auxiliary matrices are central in our study, due to the fact that they will allow us to calculate the probability of error of the detection scheme. The proof of every result of this section can be found in "Appendix A." This theorem theoretically allows us to calculate the probability of error of the algorithm for a given basis M. However, a practical computation ofM k might be difficult when n >> 1. In this sense, a useful property that we can use to calculate the three auxiliary matrices is the fact that every row and column adds up to 1, and so some tricks to calculateM k are used in subsequent proofs (gathered in the appendices).
Moreover, since there may be a high number of undesired measurements in the circuits that are out of our control and that might be conditioned by an interfering environment, it is reasonable to question the effect that noisy measurements would have on QMDA. We can obtain a first insight into this subject by considering that, for every measurement in O, the probability of measuring the state |m i when, in absence of noise, we would have measured |m j , is given by m i |E|m j , where E is a stochastic matrix. This type of noise has been used before to study measurement errors, for instance in [12].
Under these conditions, the formula for the probability of error changes, as the stochastic matrix gets represented once for each O measurement. Theorem 2 Given a QMDA n (U 0 , U , U 1 , k, |ψ 0 ), and assuming that every O represents a noisy measurement in an orthonormal basis M = {|m i } N i=1 , being E the associated readout error stochastic matrix, the probability of measuring the state |ψ 0 at the end of the algorithm is given byM 1 The effect of more complex types of noise is an interesting subject that would deserve a more thorough and independent study. For now, our aim is to find an algorithm capable of detecting whether measurements have taken place or not, but without knowing the basis in which they occur. To guide us, we will use the following natural definition for the worst behaviour of the detection scheme. Obviously, we aim to find a QMDA whose δ(Q) is as low as possible. It is time to prove some bounds to the probability of error and to δ(Q), some of them being related to the eigenvectors of U , due to their ability to skip the influence of every U gate. This immediately shows that it is impossible for a QMDA n to achieve a perfect accuracy for any basis we are measuring in, so our best option is to be able to decrease the probability of error as much as desired, which will always require an increment of k. Although this can be easily overcome, in the next theorems we identify measurement bases having particularly undesired properties.
be an orthonormal basis of eigenvectors of U . ThenÂ = I N ,Â t 1 =Â 0 and As we can see, when measurements occur in a basis of eigenvectors of U, the detection is immediately restricted to 1 N . This property suggests that eigenvectorsrelated bases are worth studying and will be our main concern. Several conclusions can be deduced from it, mainly bounds for δ(Q) that warn us about the difficulty of dealing with these bases. is reached for any basis of eigenvectors of U and its value is 1 N .
Although the first corollary is a lower bound for the probability of error, this bound decreases exponentially with n, so it is not as restrictive as expected. Additionally, it suggests the following definition.

Definition 5
We say that a QMDA n Q is optimal if δ(Q) = 1 N .

Corollary 4 If a QMDA n is optimal and A is a basis of eigenvectors of U , then
It is worth pointing out that this bound does not mean that the maximum of M 1M kM 0 is always reached for a basis of eigenvectors of U . In fact, as we will see in the next section, the maximum probability of error in the case of any EV 1,k is not reached for the basis of eigenvectors {| + i , | − i }, but for {|+ , |− }. This means that no EV n,k is optimal. However, at least every EV 1,k will satisfy the following definition, which is inspired by the properties proved in Proposition 1 and Theorem 3.

Definition 6
We say that an infinite family {Q p } ∞ p=1 of QMDA n , dependent on the parameter p, is asymptotically optimal if δ(Q p ) −−−→ If a family {Q p } ∞ p=1 is asymptotically optimal, then we know from Proposition 1 that p → ∞ ⇒ k( p) → ∞. After these two definitions, we aim at finding some QMDA n that verifies the conditions presented. As we already advanced, EV 1,k does the job for n = 1, but as n increases, we need to consider QMDAs with clever combinations of eigenvectors of U . This is because, as we will prove, they tend to cause high probabilities of error if they are not treated correctly. We gather the bases of linear combinations of eigenvectors of U in the following definition.

Definition 7 For any basis
and any P divisor of N , we say the basis M is a P-combination of A if where i = 1, . . . , P; d = 0, . . . , N /P − 1 and each σ i ( j) is either 1 or -1 (in other words, it just indicates the sign accompanying each |a j for the ith element of M). Moreover, M must verify the following properties: This bases are just linear combinations of the vectors of A, but with every coefficient being ±1/ √ P. We will see how to construct one soon. Property 1 means that the first element of M is the sum of the first P elements of A. Property 2a ensures the orthonormality of the basis, and 3a means that the product of the signs of two different elements of M are the signs of another element of M. We will need all of them for proving the upcoming theorems. In addition, some extra properties can be deduced from these: Proposition 2 If M is a P-combination of the basis A, the following properties are a consequence of the properties 1 and 2a.
We will also benefit from the property 3a and 3b to introduce some notation. Since 3a is a property of the signs 'by rows', and 3b is analogous 'by columns', we will use the notation In order to find an example of P-combination basis, we only have to choose a proper combination of signs. A way of doing it is by using the Sylvester matrices [13]. The Sylvester matrix S(k) of order 2 k is These matrices offer an example of signs election that can be used for constructing P-combination bases, as we prove in the following proposition.

Proposition 3 If S(k) is a Sylvester matrix and σ i ( j) := S(k) i j , then, for all k and any given a basis A,
The first Sylvester matrices are: So, given any basis A, an example of 2-combination basis of A for n = 2 is: For n = 3, an example of 4-combination basis is In this last example, we have combined elements 1-2-3-4 and 5-6-7-8 of A, but any other combination could be possible, for example, 1-5-7-8 and 2-3-4-6. For any A basis, and for any given n and P, there are Our theorems provide results for one of the P combination bases, but the optimality requires an acceptable behaviour for every possible basis.
We will focus on bases of eigenvectors of U . Their P-combination bases challenge the optimality of the algorithm and their properties simplify the calculations considerably.

Theorem 4 Given a QMDA n , A an orthonormal basis of eigenvectors of U and M a P-combination basis of A, then, if the eigenvalue associated with |a
where ϕ i j = ϕ i − ϕ j , and β i j is the angle between β i := a i |U 0 |ψ 0 and β j := a j |U 0 |ψ 0 .
The optimality of the QMDA n requires this probability not to exceed 1 N . We can simplify the formula assuming that |β i | 2 = | a i |U 0 |ψ 0 | 2 = 1 N , which is a necessary condition for the optimality.

Theorem 5 In the conditions of the previous theorem, if |β
This formula does not imply thatM 1M kM 0 ≥ 1 N , due to the fact that the cosines may be negative. Unfortunately, making the cosines negative requires large angles, and since the number of angles increases exponentially with n, getting large ones becomes a problem of unclear solution. Moreover, we have to remember that the P combination can be done with any group of P eigenvectors of A, so the angles of the cosines can be combined however we desire to, and the summation must be negative (or 0) for all of them in order to achieve the optimality.
Minimizing the formula analytically is difficult in general, but in the case of P = 2 it can be cleverly done. The trick is based on the fact that 2-combination bases are the only ones in which there is no mixture of angles in the cosines, so that they can be treated independently.

The equality is satisfied if and only if
The condition for the equality is rather cumbersome. Consequently, since we aim at a minimization for every 2-combination basis, we focus on the case of independence of the constants, i.e. |β i | 2 = |β j | 2 = 1 N , ∀i, j. This condition is convenient for a QMDA n since it unifies the probability formulas for every P-combination basis for any given P and is a necessary condition for the optimality. Applied to a 2-combination basis, the probability under this condition iŝ However, being able to minimize the probability of error under one 2-combination basis does not provide a way of minimizing the probability of error under every 2combination basis at the same time, especially for great values of n.
Finally, before getting into the study of EV n,k , we will prove a very useful result for calculating probabilities of a QMDA n+m constructed from other QMDA n and QMDA m of smaller size.
a QMDA m and X , Y two orthonormal bases of dimension 2 n and 2 m , respectively. Then, given the This intuitive property allows us to calculate probabilities associated to any basis that verifies the given conditions whenever we are working with a QMDA n constructed from a tensor product, as it is the case of any EV n,k = EV 1,k ⊗ . . . ⊗ EV 1,k . Theorem 8 Given k, we consider the QMDA 1 EV 1,k and we define c := cos θ k , s := sin θ k . If every O is equivalent to a measurement in the basis M where |m 1 = cos θ 2 |0 + e iϕ sin θ 2 |1 and |m 2 = sin θ 2 |0 − e iϕ cos θ 2 |1 , then The proofs of the two main results of this section can be found in "Appendix B." As a consequence, when we measure in the basis of eigenvalues of Unfortunately, this does not imply its optimality, as we are about to prove. Obviously, the basis {|0 , |1 } corresponds to the minimum, and we need to confirm where the maximum is.

Corollary 5 Given k and EV 1,k , if measurements occur in the basis
Proof We substitute directly in the formula of Theorem 8 taking into account that, for |0 , θ = 0, obtaininĝ As expected, 0, so one of the conditions for the asymptotical optimality is verified. For the second one, we have the following result.

Corollary 6 Given k and EV 1,k , if measurements occur in the basis
Proof We can substitute directly in the formula of Theorem 8 knowing that, for | + i , θ = ϕ = π 2 . The same applies for M, taking into account that for |+ , θ = π 2 and ϕ = 0. This confirms that there exists a family of QMDA 1 with the desirable properties. For n > 1, the EV n,k circuit looks like: . . ⊗ EV 1,k , Theorem 7 guarantees a good behaviour for any basis built from a tensor product of 1-qubit bases. The next step is to study entangled bases, as P-combination bases can be.
The eigenvectors of R θ k are | + i , | − i , with eigenvalues e iθ , e −iθ , respectively, so we can consider the basis A of eigenvectors of R ⊗2 θ k as Their eigenvalues would be, respectively, e i2θ , e −i2θ , 1, 1. Keeping this in mind, the following result is verified.
The important observation is that 1 4 which means that the probability of error increases as k −→ ∞! This leads us inevitably to the conclusion:

Theorem 12
The family EV n,k of QMDA n is asymptotically optimal if and only if n = 1.
The reason why the previous theorem prevents the optimality also for n > 2 is due to Theorem 7, which can be used to generate bases from the tensor product of this 2-combination basis and yield a probability of error higher than 1 N . A way of overcoming this issue with 2-combination bases is by adjusting the angles where β i is the argument of β i = a i |U 0 |00 . This means that U := 4 j=1 e iϕ j |a j a j |. And, for example, we can define U 0 := 4 j=1 β j |a j 00| + 4 j=1 β j |a j 11|. The angles are chosen so that, no matters how the eigenvectors are paired in the 2-combination basis, the product of cosines is always equal to 0. Unfortunately, this alternative does not generalize for greater values of n.
However, the Elitzur-Vaidman circuit of any number of qubits can be adapted to any basis in which we desire to achieve maximum accuracy by adjusting the initial state and the rotation axis of U . This is already suggesting a possibility for the future: mixing or nesting two different QMDA n so that one can fix the weaknesses of the other by providing high detecting probabilities over those bases where the other struggles.

Possible extensions of QMDA n and counterfactual communication
As mentioned throughout the article, there are some possible extensions of the QMDA n definition that can be considered in order to generalize their behaviour further, which we want to address in the future. Some extensions include the study when each O only measures on certain qubits (and not on all of them), or the study of properties of the QMDA n circuits having intentional, intermediate measurements. These extensions of our framework, along with some others, would lead to other well-known algorithms, such as the counterfactual communication [5] one.
The counterfactual communication algorithm works with three-qubit modelling photons, and the objective is to establish a communication between two parties, Alice and Bob, in such a way that Bob can communicate a decision (blocking Alice's photon or not) to Alice without any photon crossing the transmission channel. This means that Bob and Alice have communicated without actually sharing any information. The circuit is shown in Fig. 4.
A |1 in one of the arms means that Alice's photon is currently in that arm. The two upper arms belong to Alice's side and the lower one to Bob's side. This means that, whenever we have the state |001 , the photon would have crossed the transmission channel. Here, B S P stands for beam splitter with reflectivity cos 2 θ P , being θ P = π 2P . In other words, with respect to the computational basis,

Fig. 4 Counterfactual communication algorithm
The B S M gate will be applied M times to the two upper arms, and after each one (except the last one) a whole cycle of N applications of B S N gates to the two lower arms. The natural numbers M and N can be chosen unrestrictedly. The algorithm ensures that Alice, based on the measured state at the end, will be able to infer Bob's choice with a probability as close to 1 as desired and without |1 being ever measured in the third qubit. (No photon has crossed the transmission channel.) The similarities with QMDA n are clear, since the algorithm, from Alice's perspective, intends to detect whether measurements have been taken in every O (Bob has decided to block her photon) or not (Bob has decided to let her photon pass). However, the intermediate measurements, the nested loops of B S M and B S N and the measurements on a specific qubit instead of on all of them, prevents this algorithm from being a QMDA n yet, but makes its study interesting enough to deserve another work.

Conclusions and future work
In this paper, we have introduced a general framework to detect foreign measurements in circuits with respect to an unknown basis. The definition of quantum measurement detection algorithms generalizes the Elitzur-Vaidman bomb tester circuit.
Our results show the key properties and scope of QMDA. We have obtained the measurement detection probability error in terms of three matrices. In particular, for high number of qubits, we have derived explicit expressions of such a probability. Optimality of QMDA has been addressed, showing that bases that do not contain eigenvectors of the above-mentioned matrices yield better results. Finally, we study the performance of the Elitzur-Vaidman bomb tester and conclude its asymptotic optimality for the single-qubit circuit.
Future work includes the study when each O only measures on certain qubits (and not on all of them). Also, the study of properties of the QMDA circuits having internal measurements. Other extensions of our framework may include the counterfactual communication algorithm. Finally, we intend to provide a deeper insight into the effect of different types of noisy measurements on the detection power of QMDA.

Appendix A: Proofs of the results in Sect. 3
Before getting into the results, let us fix our notation. We will work with mixed states of the form Here, the nonnegative real number p i represents the probability of the circuit being in the pure state |ψ i . If the current pure state is |ψ ψ|, and we apply a measurement in the orthonormal basis Since | ψ|m i | 2 is the probability of measuring |m i from the state |ψ , observe that the coefficients add up to 1 and no normalization is needed. For the sake of brevity, we will write sums as an inner product of vectors. . . . , p N ). Proof We begin proving that the mixed state after the pth measurement, being p ≤ k + 1, is where m = (|m 1 m 1 |, . . . , |m N m N |). We will prove this by induction over p. Let us denote some useful states: |ϕ 0 := U 0 |ψ 0 and |ϕ i := U |m i . For p = 1, we have to follow the circuit until the first O measurement. It starts in the state |ψ 0 ψ 0 | and evolves to |ϕ 0 ϕ 0 | after applying U 0 . Here, the first measurement is taken, which leaves us with the mixed state The next step is to prove that, if the result is correct for p, then it will be for p + 1. So, our induction hypothesis is that, after the pth measurement, the state of the circuit is Then we apply a U gate that evolves the state to represents the ith element of the column vectorM p−1M 0 . Moreover,M i· will stand for the ith row ofM. The next measurement occurs, so the new state is With this result, we know that the final state of the circuit will be for |φ i := U 1 |m i . This is due to the fact that, according to what has been proved, the state after the (k + 1)th measurement (the last application of an O), will be m ·M kM 0 . The next step is to apply U 1 , obtaining the final state φ ·M kM 0 . We are now ready to calculate the probability of error of the algorithm when every O represents a measurement, which is given by the probability of measuring |ψ 0 after the final measurement. The final state of the circuit is φ ·M kM 0 ; therefore, the probability of measuring |ψ 0 in this situation is When we add noise to our measurements, if the current pure state is |ψ ψ| and we apply a measurement in the orthonormal basis {|m i } N i=1 , the state evolves to Basically, this means that the probability of measuring |m i is the sum of the probabilities of every situation in which we should have measured |m j (| ψ|m j | 2 ) but noise made us measure |m i ( m i |E|m j ). Again, since no normalization is needed.
Theorem 14 Given a QMDA n (U 0 , U , U 1 , k, |ψ 0 ), and assuming that every O represents a noisy measurement in an orthonormal basis M = {|m i } N i=1 , being E the associated readout error stochastic matrix, the probability of measuring the state |ψ 0 at the end of the algorithm is given byM 1 Proof The proof is analogous to the previous one. We begin proving that the mixed state after the pth measurement, being p ≤ k + 1, is We will prove this by induction over p. For p = 1, we follow the circuit until the first O measurement. After evolving from |ψ 0 ψ 0 | to |ϕ 0 ϕ 0 |, the first measurement is taken: Now we assume that the result is correct for p, and we will prove it for p + 1. So, our induction hypothesis is that, after the pth measurement, the state of the circuit is Then we apply a U gate that evolves the state to The next measurement occurs, so the new state is With this result, we know that the final state of the circuit, after the k applications of O and the gate U 1 , will be φ · (ÊM) kÊM 0 . The probability of error of the algorithm, then, is given by the probability of measuring |ψ 0 at the end:

a QMDA n and M an orthonormal basis of a Hilbert space of dimension N . Then
Since we have a summation of positive terms, we only need to prove that one of them is ≥ 1 N 2(k+1) . Firstly, the components ofM 1 add up to 1, so there exists a 1 Here we can apply the basic Since the summation is ≥ 1 √ N and every term is nonnegative, then some of them Applying the same argument again we get From this inequality we deduce that there exists a 1 ≤ j k−1 ≤ N such that Reiterating the procedure we will find j 1 , Since this last expression represents one of the terms of (A.1), we conclude that Theorem 15 Let (U 0 , U , U 1 , k, |ψ 0 ) be a QMDA n and let A = {|a i } N i=1 be an orthonormal basis of eigenvectors of U . ThenÂ = I N ,Â t 1 =Â 0 and Proof It is immediate to see that, because |a i is an eigenvector of U , then Therefore,Â 1Â kÂ 0 =Â 1Â0 . In addition, let us show that under these conditionŝ A t 1 =Â 0 . We can notice that the ith component ofÂ 1 is which corresponds to the ith component ofÂ 0 . Here, we used the fact that To prove the inequality, we expand the productÂ t 0Â 0 : This is a summation of squared real numbers, (each | ψ 0 |U 1 |a i | 2 ). In other words, we have a real function N i=1 x 2 i where N i=1 x i = 1, and this function reaches its minimum 1 N when

Proposition 5 If M is a P-combination of the basis A, the following properties are a consequence of the properties 1 and 2a.
2b.
Proof Property 2c is a direct consequence of 1 and 2a, and property 2d is a direct consequence of 1 and 2b, so we only need to prove that 2b is a consequence of 2a. As M is an orthonormal basis (due to 2a), then, for any k (and assuming without loss of generality that k ≤ P), This immediately implies that P i=1 σ i (k)σ i ( j) = 0 whenever j = k. This proves 2b for a fixed k, but as k could have been chosen as desired, the proof is general.

Proposition 6 If S(k) is a Sylvester matrix and σ i ( j) := S(k) i j , then, for all k and any given a basis A,
is a P-combination of the basis A for P = 2 k .
Proof We will prove every property for the rows and columns of every S(k) by induction. For k = 1, S(1) = + + + − and the properties can be easily verified. Now let us assume that S(k) verifies the properties. We shall prove that S(k + 1) does.
Properties 1a and 1b are satisfied trivially. In properties 2a and 3a rows are multiplied, and we have three ways of doing it: multiplying two rows from the upper half of S(k + 1), two from the lower half or one from each half. A row from the upper half is of the form S(k) i· ||S(k) i· , where '||' stands for the concatenation symbol; a row from the lower half would be S(k) i· ||(−S(k) i· ). For the first case, the product of rows i, j, using the symbol '*' to denote the term-by-term product, will result in which proves property 3a. Moreover, proves property 2a. The other two cases are solved similarly, as well as the procedure for property 3b.

Theorem 16 Given a QMDA n , A an orthonormal basis of eigenvectors of U and M a P-combination basis of A, then, if the eigenvalue associated with |a i is
where ϕ i j = ϕ i − ϕ j , and β i j is the angle between β i := a i |U 0 |ψ 0 and β j := a j |U 0 |ψ 0 .
Proof We will begin calculatingM 0 . We should remember that β j = a j |U 0 |ψ 0 ∈ C, β i is the argument of β i and β i j = β i , β j =β i −β j . A generic element of this matrix would be ForM 1 , we have We conclude then, ForM, if we consider, for example, d 1 = d 2 = 0, we have On the other hand, it is easy to see that, when d 1 = d 2 , the term will be 0. Combining these two properties together, we obtain thatM = The next step is calculatingM k , for which we will need the properties of Pcombination bases. We should notice thatM includes several sub-matrices of size P × P that we can treat separately, so we will focus on the first one: A generic element i 1 i 2 of this matrix would be Property 3a ensures us that each P j=1 σ i ( j)λ j 2 will appear only once in every row and column of S 1 . This motivates the definition: Rewriting the matrix: Now we define the numbers We will prove that S k However, due to 3a and 2a, P j 1 =1 σ (i 1 ,i 2 ) r ( j 1 )σ j 2 ( j 1 ) = 0 for all j 2 except when j 2 = (i 1 , i 2 ) r , which means We suppose now that S k 1 = (B k i 1 i 2 ) 1≤i 1 ,i 2 ≤P and we have to prove that (S k+1 Focusing on the last sum of this expression: Substituting in A.2, we obtain Once this result is proved, it can be applied to every S d+1 : Now we can calculate S k d+1 /P 2k , that is, B k i 1 i 2 /P 2k for each component. We will use the property of complex numbers: for x, y ∈ C, |x ± y| 2 = |x| 2 + |y| 2 ± 2 < x, y >= |x| 2 + |y| 2 ± 2|x||y| cos x, y. Its generalization is We focus again on S 1 : Coming back to A.3, we have We are ready to multiplyM kM 0 . The first P components will correspond with d = 0, the next P with d = 1, etc. For d = 0, the ith component of the column vector would be Before continuing, we should notice that arg(e ikϕ i β i ) = kϕ i + arg(β i ), which means that (e ikϕ i β i , e ikϕ j β j ) = kϕ i + arg(β i ) − (kϕ j + arg(β j )) = kϕ i j + β i j . With this, it is time to addM 1 . Finally, Applying the same procedure as before, we deduce Substituting in the previous expression, we obtain Moreover, when i = 1, then (1, j) c = j, so that cos ϕ j(i, j) c = cos ϕ j j = cos 0 = 1. Separating this case, we havê This completes the case d = 0. The overall formula of the algorithm iŝ

The equality is satisfied if and only if
, and, if C j = 0

ProofM 1M
kM 0 for P = 2 is obtained directly from formula of Theorem 4: It is important to notice that the cosines are independent from each |β i | 2 , because they only depend on the argument of β i , and not on the module. Both values can be chosen as desired and independently when building the algorithm. This allows us to rewrite the expression as where each C i = cos k ϕ 2i−1,2i cos β 2i−1,2i cos(β 2i−1,2i +kϕ 2i−1,2i ) can be considered a constant. The reason why this is not possible for P > 2 is that, in those cases, the angles of the cosines are combined (for example, pairing 1-2, 3-4 some times and 1-3, 2-4 other times), which prevents writing them as constants independent from each other.
Writing x j = |β j | 2 , we must minimize the function with the restriction N j=1 x j = 1. If M := N /2, we obtain When deriving with respect to x 2 j−1 , so we can subtract the equations and get When we derive with respect to x N −1 , we arrive to an analogous result: It might be the case that C j = 0, so that the equation cannot be cancelled. In that case, then for j, k such that C j = C k = 0, we deduce from the previous equations that x 2 j−1 + x 2 j = x 2k−1 + x 2k := p. We will suppose, without loss of generality, that those C j = 0 are exactly the last r , so that C i = 0, ∀i = 1, . . . , M − r , for which x 2i−1 = x 2i . Let us rewrite f accordingly and take into account that p is also a variable to be computed.
We derive with respect to any variable x 2 j .
Now we derive with respect to p.