The methodology of resonant equiangular composite quantum gates

The creation of composite quantum gates that implement quantum response functions $\hat{U}(\theta)$ dependent on some parameter of interest $\theta$ is often more of an art than a science. Through inspired design, a sequence of $L$ primitive gates also depending on $\theta$ can engineer a highly nontrivial $\hat{U}(\theta)$ that enables myriad precision metrology, spectroscopy, and control techniques. However, discovering new, useful examples of $\hat{U}(\theta)$ requires great intuition to perceive the possibilities, and often brute-force to find optimal implementations. We present a systematic and efficient methodology for composite gate design of arbitrary length, where phase-controlled primitive gates all rotating by $\theta$ act on a single spin. We fully characterize the realizable family of $\hat{U}(\theta)$, provide an efficient algorithm that decomposes a choice of $\hat{U}(\theta)$ into its shortest sequence of gates, and show how to efficiently choose an achievable $\hat{U}(\theta)$ that for fixed $L$, is an optimal approximation to objective functions on its quadratures. A strong connection is forged with \emph{classical} discrete-time signal processing, allowing us to swiftly construct, as examples, compensated gates with optimal bandwidth that implement arbitrary single spin rotations with sub-wavelength spatial selectivity.


I. INTRODUCTION
Composite quantum gates [1,2] are indispensable to many important quantum technologies, such as nuclear magnetic resonance, magnetic resonance imaging, quantum sensing, and quantum computation [3]. Their versatility arises from cunningly chosen sequences of L primitive quantum gates that produce an effective quantum gateÛ with a more desirable dependence on some parameters of interest θ, such as drive amplitude or background magnetic fields. As a function of θ, the quantum response functionÛ (θ) can be tailored to amplify weak signals beyond the statistics of repetition, and suppress noise without measurement. Finding such useful composite gates is thus the subject of intense research.
However, the road to new results does not end with a choice ofÛ (θ). Given some reasonable system-dependent quantum control [23], its realization as a composite gate must be found. Only with rare exceptions [8,9,16] and great effort are optimal, arbitrary length examples found in closed-form. Thus celebrated techniques including gradient ascent algorithms [5] and pseudospectral methods [24,25] formulate this as a systematic optimization problem that can be solved by brute force, but unfortunately with an exponential worst-case runtime O(e L ) for finding optimally short L approximations. Finding efficient solutions to various control problems would expand the potential of long composite gates, for which the most sophisticated quantum response functions can be constructed.
A tantalizing similarity is seen in discrete-time signal processing [26]. Optimal finite-impulse response filters [27] can be designed simply by choosing the lowestdegree L polynomial that is the optimal approximation to a desired frequency response, from which an optimal and exact implementation is computed -made possible by efficient algorithms for both steps. It is recognized that composite gates implement a filter on physical parameters [20,28], and the use of polynomials in quantum response functions is well-known [29,30]. Unfortunately, quantum constraints can render computing these polynomials and their optimal implementation a hard problem. It would be a tremendous advance if efficient solutions to these problems could be found, and even more so if the countless results from the exalted history of classical discrete-time signal processing were transferable to the quantum realm.
One noteworthy step in this direction is the Shinnar-LeRoux algorithm [31,32] and its refinements [33][34][35], which have so far been restricted to the field of magnetic resonance imaging. There, θ represents the amplitude of background magnetic fields and manifests as an offresonant rotation. Given otherwise perfect and arbitrary single-spin control, this approach enables the efficient de-sign ofÛ (θ) by a connection to finite-impulse response filters. Unfortunately, extending the concept to situations with different controls and additional restrictions, particularly the case of on-resonant compensating pulse sequences, appears to have been difficult.
We contribute to this aspiration with a methodology, similar to the Shinnar-LeRoux algorithm, for designing composite gates built from L resonant primitive gates acting on a single spin, all rotating by angle θ, but not necessarily with the same phase. We rigorously characterize the quantum response functionsÛ (θ) achievable in this manner, prove how we can efficiently choose its form with trigonometric polynomials of degree L, and prove how its optimal implementation with the shortest sequence of primitive gates can be efficiently computed. In the process, a connection is made with discrete-time signal processing that allows us to inherit some of its machinery. These powerful tools expedite composite gate design, which we demonstrate with three optimal important examples: (1) narrowband and broadband composite population inversion gates; (2) compensated NOT gates with optimal bandwidth; (3) spatially-selective arbitrary single spin rotations below the diffraction limit.
We elucidate in Sec. II the controls available to our single qubit system and demonstrate how equiangular composite gates motivate in Sec. III the intuitive concept of choosing polynomials to explicitly define the quantum response functionÛ (θ). This is made rigorous and tractable in Sec. III A by a simple characterization of the space of achievableÛ (θ), and showing in Sec. III B how an optimal implementation of any suchÛ (θ) can be efficiently computed. We then show in Sec. III C how an achievableÛ (θ) can be efficiently computed from a partial specification with polynomials that describe only the composite gate fidelity or transition probability response functions. This enables in Sec. III D the efficient design of achievableÛ (θ) by inheriting from discrete-time signal processing existing polynomials and efficient polynomial design algorithms. Together, these provide a methodology outlined in Sec. III E for the systematic and efficient design of composite quantum gates. Use of this methodology is demonstrated in Sec. IV with the creation of optimal bandwidth compensated gates in Sec. IV B that provide an optimal solution in Sec. IV C to the problem of implementing sub-wavelength spatially selective arbitrary quantum gates. Further directions are discussed in Sec.V.

II. MODEL
The unitary quantum response functionÛ (θ) describes how a quantum system evolves under the influence of some parameter θ of interest. We consider the generic system of a resonantly driven single spin, and present a construction for composite quantum gates that motivates a powerful approach for designing their implemented response functions.
A two-level system driven by time-dependent Rabi frequency Ω(t) and phase φ(t) is controlled by the Hamilto-nianĤ c (t) = Ω(t) 2σ φ(t) , whereσ φ = cos(φ)σ x + sin(φ)σ y and σ x,y,z are Pauli matrices. Taking φ(t) = φ to be constant over time τ , we generate the primitive rotation Note that Ω(t) might only be partially under our control and thus contain an uncontrollable residual signal. Our parameter of interest is thus θ, which captures both effects.
An equiangular composite gate of length L is built from these primitive rotations, each with the same rotation amplitude θ, but with varying phases φ = (φ 1 , ..., φ L ). This produces a θ-dependent unitaryÛ (θ), or quantum response function, of the form , and the phase sums Φ L,j are defined through the recurrence [19] performed over j = 0, 1, ..., k, then k = 1, 2, ..., L. Now, we make the crucial observation thatÛ (θ) is polynomial of degree L in x ≡ cos (θ/2) and y ≡ sin (θ/2) with a particularly elegant representation. Using the trigonometric relation x 2 + y 2 = 1,Û (θ) has the form where A(x), B(x), C(y), D(y) are polynomials of degree at most L with coefficients a k , b k , c k , d k (k = 0, 1, . . . , L) respectively. In the following, A, B, C, D without arguments are understood to be functions of the x, y seen in Eq. 4. As the tuple (A, B, C, D) is an equivalent representation ofÛ (θ), we refer to both interchangeably. In particular, achievable tuples are those than can be realized by some composite gate of Eq. 2: We are often interested in only a few components of (A, B, C, D). For example, the partial tuple (A, ·, C, ·) fully defines the gate fidelity response function F χ (θ) = 1 4 |Tr[R † 0 (χ)Û ]| 2 with respect to some target gateR 0 (χ).
Similarly, (A, B, ·, ·) or (·, ·, C, D) fully defines the transition probability response function p(θ) = | 0|Û |1 | 2 , We refer to a tuple with n empty slots as an n-partial tuple. An n-partial tuple is achievable if it is consistent with some achievable tuple.
A brute-force approach to composite gate design is minimizing an objective function forÛ (θ) over a space L ∈ N, φ ∈ R L . Though useful examples have been discovered in this manner, such an approach is highly unappealing. In addition to being inefficient with a runtime O(e L ), there is no guarantee that a globally optimal solution will be found. Furthermore, the procedure provides little of the necessary insight into possibleÛ (θ) for envisioning further novel applications.

III. SYSTEMATIC AND EFFICIENT DESIGN OF OPTIMAL COMPOSITE GATES
The functional form ofÛ (θ) hints at a powerful methodology for composite gate design via choices of the polynomials (A, B, C, D) of degree L. This ambition must solve long-standing problems: , as might be encountered with common objective functions for Eq. 5, 6. (P4): An efficient algorithm for computing achievable partial tuples optimal for some objective function.
Our main technical advances are precisely the resolution of problems (1)(2)(3)(4). We describe in a simple and intuitive manner the set of achievable (A, B, C, D), and provide efficient algorithms for solving what has traditionally been the hardest aspects of composite gate design. In particular, a beautiful connection is made with the historic field of discrete-time signal processing that allows allows us to inherit much of its prior work in polynomial design. In this manner, the inspired art of composite gates is transformed into a systematic science. Optimal composite gates are simply polynomials optimal for the objective function, and these polynomials can be found efficiently.

A. Characterization of quantum response functions
We characterize here achievable choices of quantum response functions (A, B, C, D) in a manner independent of φ, hence resolving problem (P1). By providing insight into the forms of possibleÛ (θ), we also obtain a quantitative explanation for the remarkable versatility of composite gates. Achievability constraints on the polynomials (A, B, C, D) are as follows: Proof. In forward direction, (1) and (3) are true by applying the trigonometric substitution x 2 + y 2 = 1 in Eq. 2 and collecting coefficients of1,σ x,y,z . (2) is true aŝ In the reverse direction, we need to show that any (A, B, C, D) satisfying (1-4) is achievable in the sense of Def. 1. We leave these steps to Lem. 1.
Conditions (1-4) for achievable (A, B, C, D) appear fairly general, which allows for great flexibility in choosing arbitrary response functions. They are also understandable and intuitive. A characterization of achievable partial tuples is also useful. Not all quadratures ofÛ (θ) might be relevant to an objective function, and optimizing over a subset (A, B, C, D) could be easier. In the following, we examine how the unitarity constraint of condition (4) is weakened for all possible 2-partial tuples.
Proof. In the forward direction, all the (a) conditions are true from Eq. 7 using the fact that A, B, C, D are all real, hence their squares are positive. (3b) is true by considering Eq. 7 with the substitution Note that the x, y here are complex. Using the odd/even symmetry of C, D, the RHS factorizes into a positive term is similarly proven by considering λ ≤ 0. The RHS factorizes into λ(1 − λ) and a positive term. (4b) is proven with the substitution x = √ 1 − λ, y = √ λ and by considering λ ≥ 1. In the reverse direction, we need to show that assuming these conditions enable the computation of an achievable (A, B, C, D). We leave these steps to Lems. 2. 3.
Note that C, D are interchangeable in Thm. 2 as their constraints in Thm. 1 are identical. We also characterize all possible 3-partial tuples.
Proof. The forward direction follows by definition and from Eq. 7 where A, B, C, D are all real ∀θ ∈ R, hence their squares are positive. The reverse direction is true from setting the unspecified polynomial to 0 in one of the 2-partial tuples (1), (2) in Thm. 2.
These simple characterizations show how one can in principle encode almost any arbitrary desired function into quadratures ofÛ (θ). Consider (A, ·, ·, ·), which aside from symmetry and A(1) = 1, only needs to satisfy ∀|x| ≤ 1, A 2 (x) ≤ 1. The famous Stone-Weierstrass theorem [36] assures us that A(x) of sufficiently large degree L can approximate arbitrarily well any arbitrary continuous real function that satisfies these constrains on the interval |x| ≤ 1. This ability to create almost arbitrary quantum response functions helps explain the applicability of composite gates to many diverse problems.

B. Implementation of quantum response functions
Unleashing the potential of arbitrarily sophisticated choices of achievable (A, B, C, D) requires an efficient computation of their implementation φ. It is clear that the a random search is wholly inadequate as the degree of L could be very large. Nevertheless, achievability leads to a certain structure that resolves this problem (P2). This is encapsulated in the following lemma, which is proven constructively and furnishes the reverse direction proof of Thm. 1.

Lemma 1 (Optimal quantum response compilation).
Exactly L phases φ ∈ R L are required to implement an achievable (A, B, C, D) of degree at most L, and these L phases can be computed in time O(poly(L)).
Proof. A minimum of L phases φ are required to implement a given (A, B, C, D) of degree at most L as each application ofR φ k (θ) only increases the degree of (A, B, C, D) by one. We now show that (A, B, C, D) can be implemented with at most L phases φ. Due to the even/odd symmetry of real A, B, C, D from Thm. 1 conditions (1) and (3), we can compute its unique phase sum representation in Eq. 2 via the invertible transformation Let us take the ansatzÛ (θ) =R φL (θ)V (θ) whereV (θ) is unitary andV (0) = 1 as (A, B, C, D) represents a unitary from Thm. 1 condition (4). ThusV (θ) also has a phase sum representation Φ L−1,j . These two phase sums are related by the linear map of Eq. 3, with inverse By choosing we satisfy the necessary condition Φ L−1,L = 0 from Eq. 3. In particular, φ L is real, as Eq. 7 has the trailing term Hence the RHS of Eq. 10 has absolute value 1. By recursively reducing the degree ofV (θ), we obtain all L phases φ. The terminal case at L = 1 must be consistent with Eq. 3 where Φ 0,0 = 1. When evaluated with Eq. 8, 9, this is satisfied only if A(1) = 1 (Thm. 1 condition (2)), which is true for achievable (A, B, C, D). All steps in this procedure can be computed in time O(poly(L)), and there are only L recursions, leading to a runtime of O(poly(L)).

C. Computation of quantum response functions
A consequence of Lem. 1 is that designing a composite gate is no more difficult than finding the (A, B, C, D) to describe the quantum response functionÛ (θ). Optimizing (A, B, C, D) for some objective function is far more intuitive than the prior art of a random search over φ. However, this still is a difficult problem. The unitary constraint Eq. 7 represents a system of quadratic multinomial equations that would have to be solved at each step of the optimization to obtain an achievable (A, B, C, D). Solving such systems is in general an NP-complete task. This is the essence of problem (P3): it would be much easier to optimize a subset of (A, B, C, D), and doing so is often the problem of practical interest anyway.
This subset optimization is illustrated by the response functions F χ (θ), p(θ) of Eq. 5,6 which depend on only two polynomials. Optimizing just these for some objective function offers more freedom as the unitary constraint Eq. 7 is weakened to that of Thm. 2. Ultimately, we must compute some achievable (A, B, C, D) from a partial specification in order to find the phases φ.
Fortunately, the structure of achievable partial tuples can be exploited to derive algorithms analogous to prior art [31] based on polynomial sum-of-squares problems [37], but specialized to the symmetries of Thm. 2. We present results for (A, B·, ·), (A, ·, C, ·) of odd degree and show how they apply to all achievable 2-partial tuple. As these primarily serve to show that the necessary conditions in Thms. 1, 2, 3 are also sufficient, the details of the proofs for Lems. 2, 3, which also furnish constructive algorithms for computing (A, B, C, D) from partial tuples, may be skipped by the casual reader. Proof. Consider the polynomial of degree at most L (11) with roots S = {s | f (s) = 0} ∈ C L (S contains duplicates if a root is degenerate). Since A, B are odd polynomials, f (λ) is real for all real λ. Because f (λ) is real, complex roots s, s * occur in pairs. Thus we can group subsets of S without loss of generality as: Observe that S 0,r are real, and S c is complex. Thus with scale constant K ∈ R. Using (3b), f (λ) ≤ 0, ∀λ ≤ 0. Hence, all negative roots in S r occur with even multiplicity. Using (3a), f (λ) ∈ [0, 1], ∀λ ∈ [0, 1]. As f (λ) changes sign at λ = 0, |S 0 | is odd. Using the oddness of A, B, f (λ) ≥ 1, ∀λ ≥ 1. Since f (λ) ≥ 0, ∀λ ≥ 0, all positive roots in S r occur with even multiplicity. Thus, all real roots excluding s = 0 occur with even multiplicity. By repeated application of the two-squares identity the complex factors can be simplified like where g, h are real polynomials in λ.
and C, D are odd real polynomials of degree at most L.
Note that different choices of signs Eq. 14 generates a finite number of different valid solutions. Computing the roots of f (λ) is the most difficult step of this algorithm, but can be done in time O(poly(L)) [38].
The proof for even L, and tuples (·, ·, C, D) carries through with minor modification. The stated conditions in Thm. 2 guarantee that the various factors of λ, (1 − λ) necessary for the correct symmetry of the unspecified polynomials occur with the right multiplicity, and that all other real roots occur with even multiplicity. Some additional processing for the (·, ·, C, D) case is required as the output (A, B, C, D) is not guaranteed to satisfy A(1) = 1. However, A(1) 2 + B(1) 2 = 1 is still true so by computing γ = Arg[A(1) + iB(1)], we can form an achievable (A cos γ + B sin γ, B cos γ − A sin γ, C, D).
We now present the analogous algorithm for (A, ·, C, ·). Consider the positive, palindromic polynomial with scale constant K ∈ R, and roots S = {s |f (s) = 0} ∈ C 4L−|S0| , where |S 0 | is the multiplicity of the zero roots. Note the degree off (t) is 4L−|S 0 |, not 4L, because the first |S 0 | coefficients being zero implies the last |S 0 | are as well. Due to the EP symmetry off (t), ∀ roots s = 0, ∃ roots s * ,−s, and s −1 . Thus we group subsets of these roots without any loss of information as follows: Observe that S 0,1,r are real, S i,ι are imaginary and S u,c are complex. From the real roots, we construct the factor The positiveness off (t) means that all real factors have even multiplicity. Thus f r is a polynomial. From the complex roots, we form The symmetry of terms under the squares is one of EP , EN , OP , ON , and occur in a combination that forms a group under repeated application of the twosquares identity of Eq. 14. Thus we can construct For some combinations of multiplicities, this decomposition will not produce polynomials with the symmetry EN , OP required byB,D. However, summing the multiplicities of these roots shows that |S i | is even and that such combinations do not exist. From this decomposition, we compute B(x), D(y) using As with Lem. 2, different choices of signs in the twosquares identity lead to multiple valid solutions. Computing the roots off (t) is the still most difficult step, but can be done in time O(poly(L)).

D. Selection of quantum response functions
It should be clear that optimal composite gate design is a systematic process no more difficult than choosing one or two polynomials optimal for some objective function. Nevertheless, problem (P4) is that computing these optimal polynomials could still be a difficult task. However, the constraints on achievable partial tuples in Thms. 2, 3 seem fairly lax, which lends hope that this could be done efficiently. In fact these constraints are consistent with textbook problems in approximation theory [39].
It is at this point where a close connection with discrete-time signal processing [26] is made. Efficient algorithms [40][41][42][43][44] for designing polynomials optimal for arbitrary objective functions under a variety of optimality criteria have been extensively studied for finiteimpulse response filters [27]. We thus inherit much of this machinery, and in many cases, existing polynomials consistent with achievability have already been found and are directly transferable.
A most common optimality criterion is the Chebyshev norm: Let P o (x) be the objective function, with continuous weight function W (x) > 0, to be approximated by a polynomial P (x) of degree L on a bounded subset B of the closed interval B ⊂ [−1, 1) with the smallest Chebyshev error norm The unique best approximation can be computed efficiently by Remez-type exchange algorithms [45]. Many variants exist such as where P (x) is a trigonometric polynomial [40], bounded [42], subject other unary or linear constraint [43], and even complex [41]. Linear programming methods [43] provide an alternate solution. Efficient algorithms for other optimality criteria such as least squares are also available [46,47]. These algorithms efficiently solve the problem of optimization over achievable quantum response functionŝ U (θ) where the objective functions are 2-partial or 3partial tuples. Optimization for a 3-partial objective function involves a single quadrature from (A, B, C, D) together with a single real objective function P o (θ). Thus we optimize over P (θ) for P o (θ) in Eq. 24 subject to the constraints of Thm. 3 for the corresponding quadrature. The slightly more complicated 2-partial case instead specifies two quadratures and real objective functions P o,1 (θ), P o,2 (θ). Thus we define P o (θ) = P o,1 (θ) + iP o,2 (θ), and optimize over P (θ) = P 1 (θ) + iP 2 (θ) for P o (θ) subject to the constraints of Thm. 2 for the corresponding quadratures. Note that the unitarity inequality constraint poses no difficulty as |P (θ)| 2 = P 2 1 (θ) + P 2 2 (θ).

E. The methodology of composite quantum gates
Our efforts lead us to a methodology for the design of single spin quantum response functionsÛ (θ) through composite quantum gates built from a sequence of L primitive gates all rotating by θ, but each with its own phase φ = (φ 1 , ..., φ L ). The procedure is systematic, flexible, and most importantly, provably efficient: Problem statement: Given L ≥ 1 and objective func-tionÛ o (θ) for either 3-partial or 2-partial tuples, find the composite quantum gate that implements through φ the optimal ǫ-approximation toÛ 0 (θ). Solution procedure: (S1): Check thatÛ (θ) is consistent with achievability.

IV. EXAMPLES
Using the methodology in Sec. III E, composite quantum gates with response functionÛ (θ) that minimize the error with respect to arbitrary objective functionŝ U o (θ) can be efficiently designed. We illustrate this process with three examples of independent scientific interest: compensated population inversion gates, compensated broadband NOT gates, and compensated narrowband quantum gates.
Population inversion gates rotate states |0 to |1 and vice-versa, and come in two flavors. The broadband variant implements this rotation with high probability across the widest bandwidth of θ ∈ B, meaning that the transition probability response function p(θ) from Eq. 6 is close to 1. The narrowband variant instead implements this rotation with low probability so p(θ) ≈ 0, except at a single point p(π) = 1. We discuss optimal design of these gates in Section IV A. As closed-form solutions for these gates are already known, and used extensively in NMR spectroscopy, they help build familiarity with the methodology in Sec. III E when it is used to solve open questions in the next two examples.
Broadband compensated NOT gates implement the ro-tationR 0 (π) with high fidelity over the widest bandwidth of θ parameters. Whereas population inversion gates only succeed on initial states |0 to |1 , NOT gates apply a π rotation with a known phase for all input states. Such gates have been extensively studied for applying uniform rotations in the presence of drive field inhomogeneities, particularly in quantum computing applications, and our methodology, presented in Sec. IV B, solves open questions regarding the scaling of bandwidth with sequence length as well as their efficient synthesis.
A complementary design problem addressed in Sec. IV C is that of narrowband compensated quantum gates. These instead apply a desired arbitrary rotation R 0 (χ) at a single θ value, and the identity rotation elsewhere over widest bandwidth of θ parameters. Such gates are highly relevant to minimizing crosstalk in the selective addressing of spins in arrays, particularly when spinspin distances are below the diffraction limit, as might be found in architectures for scalable architectures of iontrap quantum computation.

A. Composite population inversion gates
Population inversion gates maximize the bandwidth B over which the transition probability response function p(θ) from Eq. 6 is close to 1 for the broadband variant, or close to 0 for the narrowband variant. Note that in both cases, perfect population inversion occurs at θ = π for L odd, owing to the fact that A(0) = 0. Moreover, the optimal polynomials and phases for both variants turn out to be related by a simple transformation, so it suffices for us to consider only the broadband case.
Composite gates with these properties have been studied extensively for nuclear magnetic resonance and quantum computing applications. One approach to obtaining broadband behavior is with the maximally flat ansatz p(θ) = 1−O((θ−π) 2n ) [9]. This exponentially suppresses errors in the transition probability to order n, thus p(θ) ≈ 1 over a wide range of θ. Remarkably, the φ that implement this profile can be found in closed form [48] with optimal sequence lengths L = n. More recently, a second approach has emerged [8], motivated by the following observation: as the flat ansatz p(θ) = 1 − O((θ − π) n ) only increases bandwidth indirectly through the suppression order n, better results can be obtained by directly optimizing for bandwidth, while ensuring that the worst-case error I remained bounded.
The solution to (S3) is the Dolph-Chebyshev window function [49,50] famous in discrete-time signal processing.
where T n (x) = cos (n arccos (x)) are Chebyshev polynomials. Note the ripples of DC 2 L,I (x) bounded by I in Fig. 1. This is in contrast to monotonic increase of the limiting function, indicated by the subscript f, which is maximally flat at x = 0, but has significantly narrower bandwidth. Using x = cos (θ/2), the bandwidth in θ coordinates is to order O(I

2L
) Given the same target bandwidth, the worst-case error of DC L,I is exponentially smaller than DC L,f . Note also the quadratic difference in the scaling with L of the bandwidth over which DC L,I does not approximate F (x) = 0.
). (29) The ripples in the amplitude are a generic feature of best polynomial approximations to functions in the Chebyshev norm. By sacrificing flatness, much smaller absolute variations in error ǫ can be achieved over some specified bandwidth B. This is a common theme that will be revisited in the subsequent example. Finding the phases that implement (DC L,I (x), 0, ·, ·) is then a straightforward computation through (S4), (S5), and the results can be compared to the closed-form solutions from [8,22]: The phases ψ for the narrowband variant (·, ·, DC L,I (x), 0) are obtained by a simple 'toggling' transformation [13]

B. Broadband compensated NOT gates
Broadband compensated NOT gates maximize the bandwidth B over which the fidelity response function with respect to the target gateR 0 (π) is close to 1. One option consistent with this goal is the choice of fidelity response functions F π (θ) = 1 − O((θ − π) 2n+2 ) that are maximally flat with respect to (θ − π). When the correction order n increases, deviations from θ = π are exponentially suppressed, resulting in improved approximations of the target gate over wider ranges of θ ∈ B. The central difficulty of this pursuit is finding the phases φ that maximize n for any given L. Unlike the population inversion gates of Sec. IV A, this appears to be significantly more difficult; optimal length solutions for the φ have only been found in closed-form for small n ≤ 4 [19].
This problem has been attacked over the course of two decades, starting with Wimperis [13] who found the φ in closed form for BB 1 , a L = 5 sequence with n = 2. This was extended by Brown et. al. [15] with SKn for arbitrary L = O(n 3.09 ) through a recursive construction, and then by Jones [18,51] with F n to L = O(n 1.59 ) in closed-form through sequence concatenation. The most recent effort [19] proved a lower bound of L = Ω(n) and conjectured that the sequence BBn (W n in [51]) with L = 2n+1 is optimal through brute-force up to L = 25. Using our methodology, we can easily prove this conjecture and efficiently compute its implementation φ.
Moreover, our methodology enables a second option. Instead of optimizing for correction order, it is possible to directly minimize the worst-case infidelity I, which is the experimental quantity of interest, over a target bandwidth B. We find that doing so leads to an improvement in I that scales exponentially with L over the maximally flat case. To prove these statements, we proceed with the design outline of Sec. III E for odd L: (S1) Choose the objective function ∀θ ∈ B = π + [−|B|/2, |B|/2],Û o (θ) =R 0 (π) = −iσ x for the (·, ·, C, ·) 3-partial tuple. Provided that B does not contain the point θ = 0, this is consistent with the constraints of Thm. 3. This corresponds to finding a fidelity response function F π (θ) = C 2 (sin ( θ 2 )) that is close to 1 across B. (S2) The best fidelity response function for the maximally flat approach in prior art is obtained from the function C that maximizes the correction order where I is the worst-case infidelity over the bandwidth B. It is easy to verify that any such C satisfies F π (θ) = 1 − O((θ − π) 2n+2 ). The more direct approach uses the Chebyshev optimality criterion, where the best C solves the minimax optimization problem We now present the solutions to (S3) of this procedure. This is the most difficult step, as once C is provided, the implementation φ is a straightforward calculation. Eq. 31 is solved by the the odd polynomial that satisfies the following n + 1 independent linear constraints: As a degree L odd polynomial has L+1 2 free parameters, a degree L = 2n + 1 polynomial is necessary and sufficient. This is solved by the polynomial with an example M 9,f plotted in Fig. 1. The index L indicates the degree, and the subscript f indicates that this is a maximally flat polynomial. As M L,f (y) is monotonically decreasing from y < 1, the relation between infidelity I and bandwidth B is obtained by solving I = 1 − M 2 L,f (cos (|B|/4)) to leading order: Thus given some target bandwidth B of high-fidelity operation, the composite quantum gate represented by BBn = (·, 0, M 2n+1,f (y), ·) implements NOT with a worst-case fidelity that decreases exponentially with sequence length. This proves the L = 2n + 1 conjecture of [19].

C. Composite quantum gates with sub-wavelength spatial selectivity
Narrowband compensated gates maximize the bandwidth B over which the fidelity response function with respect to identity1 is close to 1, except at a single point θ where an arbitrary target rotationR 0 (χ) is applied. Although the direct approach is computing new polynomials (A, ·, C, ·) that satisfy these properties, we can reuse the polynomials M L,I from Sec. IV B by making certain assumptions on the physical system. In the following, we also assume that |χ| ≤ π.
Consider a Gaussian beam of fixed width λ. As a function of position r, this beam has a spatially-varying Rabi frequency Ω(r) = Ω 0 e −r 2 /2λ 2 . Thus when applied for time t 0 , a primitive gateR φ (θ(r)) that also varies as a function of position is generated, where θ(r) = θ 0 e −r 2 /2λ 2 and θ 0 = Ω 0 t 0 . At r = 0, one can choose t 0 , φ such that the target rotation χ = θ 0 is implemented, and due to exponential decay of the Gaussian beam, moving away from the beam center approximates the identity gate with infidelity I(r) = sin 2 ( θ(r) 2 ). Thus at distance r/λ ≥ d/λ =B 1 = log 1/2 π 2 4I from the beam center, the worst-case infidelity is I. As the minimum possible beam width λ is the wavelength of light, selective addressing below the diffraction limit appears impossible. However, even this can be overcome with a carefully designed composite quantum gate.
A better narrowband composite gate results from using the broadband identity gate ID = (M L,I (x), 0, ·, ·) designed from the M L,I polynomial in presented in Sec. IV B. Then, the fidelity response function with respect to identity is F 0 (θ) = M 2 L,I (x), which, as we now show, corresponds to a quadratic improvement of Let us compose ID with the Gaussian beam to produce the spatially-varying quantum response function for some choice |θ 0 | ≤ π. Note thatÛ space (r) is stable with respect to beam-pointing errors in r due to the vanishing first derivative. The degree of spatial selectivity is computed from the bandwidth in Eq. 37 by substituting |B| = 2θ 0 e −B 2 space /2λ 2 and solving for r/λ. Thus, identity is implemented with infidelity at most I at all r ≥ d ≥ λB space as seen in Fig. 3, where to leading order Meanwhile at r = 0, we obtain the gatê U space (0) = R γ 2 cos −1 (M L,I (cos (θ 0 /2))) .
The optimality of these results follows from the construction of M L,I as optimal bandwidth polynomials. In particular, using the flat polynomial M L,f (x) leads to the scalingB space = O(L −1/4 ) found in prior art and Fig. 3(inset).

V. CONCLUSION
We have presented and applied a methodology, analogous to the Shinnar-LeRoux algorithm but with different controls, for the systematic design of resonant equiangular composite quantum gates of length L on a single spin. In particular, we show that all steps are efficient with time complexity O(poly(L)), and provide an extremely rigorous characterization of achievable quantum response functions. Moreover, the elegant and practical connection made with discrete-time signal processing allows us to inherit and adapt many existing algorithms and polynomials used in the design of classical response functions for this quantum problem. Much potential remains un- tapped there, and interdisciplinary exchange could spur the discovery of further connections, leading to the development of previously intractable applications. Indeed, this relationship has already proven fruitful in surprising directions, such as recent work furnishing optimal algorithms for important problems such as Hamiltonian simulation [53,54] on a quantum computer.
In fact, our work bridges discrete-time signal processing and quantum query algorithms for evaluating symmetric boolean functions. The idea here is that the SU (2) space of a single-qubit, as we study here, is isomorphic to the SU(2) subspace spanned by a uniform superposition of marked states and a uniform superposition of unmarked state in such a query problem. Query algorithms can be built to calculate a boolean function f : {0, 1} n → {0, 1} that depends only on the number of marked states (i.e. f (x) =f (|x|) for somef : {0, 1, . . . , n} → {0, 1}) and do so with a Grover-type algorithm of partial reflections (e.g. [21,[55][56][57]). Thus, the same methods introduced here also give a way to determine how many reflections (analogous to our L) and what reflections (analogous to our φ j ) are required to compute any particular symmetric boolean function, achieving the known lower bounds for this problem, which (not) coincidentally are also derived using polynomials [58]. As examples of this correspondence, DC L,I is an optimal solution for OR [22], M L,I is optimal for Majority.
Various thought provoking extensions are also motivated. The set of achievable quantum response functions is changed by introducing elements such as additional (possibly continuous) control parameters, disturbances, coupled spins [10,59,60], or open systems [20,61]. These all enable their own unique applications, but also appear difficult to solve somehow systematically and intuitively. Our success in the case of composite gates contributes supporting evidence that a useful characterization as well as efficient methods for these more complex design problems could exist.