title: Quasi-Classical Rules for Qubit Spin-Rotation Error Suppression
authors: Qile David Su
text: 
  
  
  ^1Department of Physics and Astronomy, University of California, Los Angeles, CA 90095, USA
  
  
  
  
  
  A frequently encountered source of systematic error in quantum computations is imperfections in the control pulses which are the classical fields that control qubit gate operations. From an analysis of the quantum-mechanical time-evolution operator of the spin wavefunction, it has been demonstrated that composite pulses can mitigate certain systematic errors and an appealing geometric interpretation was developed for the design of error-suppressing composite pulses. Here we show that these same pulse sequences can be obtained within a quasi-classical framework. This raises the question of whether error-correction procedures exist that exploit entanglement in a manner that can not be reproduced in the quasi-classical formulation. 
  
  Quasi-Classical Rules for Qubit Spin-Rotation Error Suppression.
      Qile David Su
      December 30, 2023
  ================================================================
  
  
  
  
  
  § INTRODUCTION
  
  An elementary single-qubit quantum gate is the X gate, which is one possible quantum analog of a classical NOT gate. This is implemented by applying radiation resonant with the qubit transition with a pulse area of π, commonly known as a π-pulse. During such a pulse, the Bloch vector, a geometrical representation of the state of the qubit, rotates by an angle of π. In practice, imperfect control of pulse amplitude, duration, frequency, and phase leads to gate infidelity <cit.>. Coupling between a qubit and its environment generates inelastic interactions that can introduce random errors through phase decoherence <cit.>. This paper will be restricted to two frequently encountered systematic errors namely imperfect control of the amplitude of the pulse, or amplitude error, and imperfect control of the frequency of the pulse, or detuning error [Depending on the context, amplitude errors may also be known as flip-angle errors or pulse-length errors, while detuning errors are also known as off-resonance errors or frequency offsets.]. 
  
  Work by the NMR community showed that amplitude and detuning errors can be reduced by replacing a single π-pulse by composite pulses if the errors are assumed to be constant throughout the pulse <cit.>. It was shown <cit.> that an amplitude error of order ϵ incurred during the rotation of a Bloch vector by π can – at least in principle – be reduced to an error of the order of ϵ^n, with n an integer, by breaking the π-pulse up into a sequence of 2n rotations of the Bloch vector over π or 2π. Subsequently, general constraints were derived on the control pulses that, if obeyed, should reduce the amplitude and detuning error, while a geometrical interpretation of these constraints was developed as well <cit.>. Mathematically, the method relies on the Magnus expansion <cit.>, which provides an exponential representation of the time-evolution operator (or propagator) of the spin wavefunction. Similar methods have been developed to study the effects of disorder and spin-spin interaction <cit.>. An experimental search for sequences that simultaneously suppress the amplitude and detuning error <cit.> produced the so-called Knill sequence, a seemingly complex sequence of five π-pulses discussed below. Using the method of refs.<cit.>, it can be shown that the Knill sequence is a member of a broader, one-parameter family of sequences that eliminate the leading order amplitude and detuning errors simultaneously. 
  
  The spin dynamics underlying NMR (as well as MRI and ESR) is traditionally described by the Bloch equations. While the derivation of these equations is based on quantum mechanics, they have the form of the equation of motion of a (quasi-) classical magnetic moment precessing in a magnetic field (coupling to the environment produces damping terms). This suggests that it should be possible to frame the error correction method of ref.<cit.> in the quasi-classical language of the precession of a magnetic moment instead of the propagator method. Such a construction could provide a better intuitive insight into the – rather complex – multi-step error-suppressing sequences. In this paper we develop such a quasi-classical framework for the case of composite sequences composed of π-pulses that correct for amplitude and detuning errors. Through a straightforward perturbative analysis, we obtain constraints on a pulse sequence that, if obeyed, suppress amplitude and detuning errors to second order for the expectation value of the spin. Next we show that the resulting pulse sequences are equivalent to those derived from the framework of ref.<cit.>. The construction of error-suppressing pulse sequences using the quasi-classical framework is sufficiently simple and graphical that it can be part of an upper-division undergraduate class.  
  
  Section II develops a second-order perturbation expansion for the equation of motion of the expectation value of the spin angular momentum due to perturbations generated by amplitude and detuning errors. Expressions are derived for the two global constraints that must be obeyed if first- and second-order amplitude and detuning errors are to be eliminated, respectively. In Section III the first-order constraint is illustrated for a variety of sequences and the equivalence between the propagator and quasi-classical frameworks is demonstrated. In Section IV, the second-order constraint is discussed similarly. In Section V, we apply the quasi-classical framework to more general rotations. In Section VI we provide the formal connection between the quasi-classical perturbation expansion.
  
  
  
  § DYNAMICS OF THE BLOCH VECTOR AND PERTURBATION THEORY.
  
  
  To compute how errors in the control pulse accumulate during a pulse sequence, we will follow the evolution of a single qubit. The specific realization of a qubit considered in this paper is a spin-1/2 two-level system subject to a DC magnetic field along the z direction. The level splitting is ħω_0 with ω_0 the Larmor frequency. Let the spinor |ψ⟩=(α,β) denote the general spin state α|↑⟩+β|↓⟩. A π-pulse is performed by the application of an AC magnetic field rotating in the xy-plane with frequency ω and phase ϕ <cit.>. In terms of the Pauli matrices, the spin Hamiltonian can be expressed as
  
      H=ħ/2[ω_0σ̂_z+Ω_0cos(ω t+ϕ)σ̂_x+Ω_0sin(ω t+ϕ)σ̂_y],
  
  where Ω_0 is the magnitude of the AC magnetic field in frequency units. A perfect π-pulse has frequency ω=ω_0 and duration π/Ω_0. If the drive frequency ω differs from ω_0, then a detuning error results. If the pulse duration differs from π/Ω_0, or if the actual AC field strength differs from Ω_0, an amplitude error results. After transforming into the rotating frame (see appendix <ref> for details), the effective Hamiltonian reduces to that of a spin-1/2 particle in a time-independent magnetic field:
  
      H'=ħ/2[Δ σ̂_z+Ω_0cosϕ σ̂_x+Ω_0sinϕ σ̂_y].
  
  This field =(Δ,Ω_0cosϕ,Ω_0sinϕ) (in frequency units) has a z component Δ=ω_0-ω that is the detuning error while the projection of the field in the xy-plane makes an angle ϕ with the x-axis. For convenience, this reference frame will still be referred to as the “lab frame" even though it rotates with respect to the real laboratory frame. In the following, we will use units with dimensionless time (i.e.,Ω_0 t) and dimensionless transverse field strength. 
  
  In appendix <ref> it is shown that if the Ehrenfest Theorem is applied to the expectation value ≡⟨σ|⟩ of the spin operator – i.e., the Bloch vector – in a magnetic field then this produces an equation of motion that is the same as that for the precession of a classical magnetic moment in a magnetic field: 
  
      (t)t=(t)×(t).
  
  Note that Planck's constant no longer appears. This equation is exact in the absence of coupling to the environment. Moreover, it is similar to the classical mechanics of rigid-body rotation and easy to visualize. We will use it as a starting point for the construction of pulse sequences that compensate for detuning and/or amplitude errors. To that purpose we first separate the error-free (or “nominal") part of the pulse (t) from the amplitude and detuning errors _1(t), so
  
      (t)t=((t)+_1(t))×(t).
  
  Amplitude errors are represented by the time-dependent error vector _1(t)=ϵ(t). They change the rotation rate induced by the control pulse by a factor of (1+ϵ). Detuning errors are represented as _1(t)=Δ z, so they are constant and always point along the z direction. The quantities ϵ and Δ will be assumed to be constant throughout the sequence and to be small compared to one. 
  
  How does the presence of Ω_1(t) in the equation of motion modify the evolution of the Bloch vector? Figure <ref> shows the motion of the Bloch vector for the case of a π/2 pulse with a transverse field along the y direction. The initial orientation of the spin is again along the z direction. The black trajectory is the “nominal" (i.e., error-free) case while the red trajectory shows the deviation induced by a non-zero detuning error. The time-evolution of the nominal motion complicates the visualization of the induced error, and it is a problem that becomes only more serious as the complexity of the sequence increases. This can be circumvented by introducing what is known as the toggling frame. This is an “intermediate" representation that subtracts out the nominal motion caused by (t). Denote the time-dependent transformation matrix between the lab frame and the toggling frame as 𝐑̂(t) so a vector 𝐯 in the lab frame (unprimed) has components 𝐯'(t) in the toggling frame (primed). Then we must have that 𝐯(t)=𝐑̂(t)𝐯'(t). In particular, for the magnetic moment '(t) = 𝐑̂^-1(t), '(t) = 𝐑̂^-1(t), and for the error vector '_1(t) = 𝐑̂^-1_1(t). At t=0, we choose 𝐑̂(0)=𝐈, so that '(0)=(0). 
  
  In appendix <ref> it is shown that the equation of motion of the Bloch vector in the toggling frame is
  
      '(t)t=_1'(t)×'(t).
  
  The amplitude error _1(t), which is time-dependent in the lab frame, becomes piecewise-constant after transformation into _1'(t) in the toggling frame. Conversely, while the detuning error is time-independent in the lab frame, it becomes time-dependent in the toggling frame. Figure <ref> compares the motion of the Bloch vector in the lab frame for the case of detuning error with the motion in the toggling frame.
  
  
  The next step is to solve for the motion of the Bloch vector '(t) in the toggling frame. According to Eq.(<ref>), if _1'(t) is small then '(t) is nearly constant. This motivates us to construct a perturbation expansion for '(t) in the form, 
  
      '(t)=_0'(t)+_1'(t)+_2'(t)+...
  
  where terms with subscript n are proportional to the nth power of the dimensionless parameter ||_1'||_maxt (see appendix <ref> for a discussion of the convergence of the series). Inserting the expansion into Eq.(<ref>) gives
  
      '_0(t)t+'_1(t)t+'_2(t)t+⋯= 
      _1'(t)×('_0(t)+'_1(t)+'_2(t)+⋯).
  
  Equating terms of the same order on the two sides of the equation produces a set of recursive equations for successive terms of the perturbation expansion,
  
      _0'(t)t   =0
      _1'(t)t   =_1'(t)×_0'(t)
      _2'(t)t   =_1'(t)×_1'(t)
         ...
  
  Integrating the zeroth-, first- and second-order equations gives
  
      _0'(t)   =_0(0)
      _1'(t)   =∫_0^t_1'(s)×_0(0) ds
      _2'(t)   =∫_0^t_1'(s)×_1'(s) ds
         ...
  
  with _0(0) equal to the initial orientation of the Bloch vector (0). Note that each term in the series involves the accumulated action of _1'(t) on the previous term in the series over the time interval [0,t]. Crucially, _1'(t)=𝐑̂^-1_1(t) depends on the composite pulse through 𝐑̂. Thus given the same errors in the control pulses (which fixes _1(t)), the evolution of the Bloch vector in the toggling frame can be drastically different from one composite sequence to the other.
  
  Suppose that one has solved for the time-evolution of successive terms of the expansion of Bloch vector in the toggling frame. Then, at the end of a pulse sequence with total duration t_f, the Bloch vector is
  
      '|_t=t_f=_0(0)+_1'|_t=t_f+_2'|_t=t_f+...
  
  We will say that a sequence suppresses error to the nth order if _k'(t_f)=0 for k=1,2,...n. Specifically, a sequence suppresses first-order errors if
  
      _1'|_t = t_f = ∫_0^t_f_1'(s)×_0(0) ds=0  ∀_0(0)   
      (First-order constraint)
  
  and to second order if additionally
  
      _2'|_t = t_f = ∫_0^t_f_1'(s)×_1'(s) ds=0  ∀_0(0)   
      (Second-order constraint)
  
  If these conditions are satisfied for all initial states (0) then the pulse sequence is said to provide universal error correction <cit.> or be fully-compensating <cit.>. 
  
  
  
  
  
  
  § FIRST-ORDER CONSTRAINT.
  
  In this section we focus on the first-order constraint, illustrate how it works for several different sequences and then derive general geometrical rules for first-order error suppression. These rules are then compared with the ones obtained in refs.<cit.>.
  
  First define the “error integral" (t) to be 
  
      (t)=∫_0^t_1'(s) s,
  
  where the upper bound of the integration is allowed to vary. The function (t) can be viewed as describing the trajectory of a phantom particle moving in the toggling frame with velocity _1'(t), starting from the origin at t=0. The first-order constraint Eq.(<ref>) can be expressed as,
  
      _1'|_t=t_f=|_t=t_f×_0(0)=0.
  
  Define separate-step “error integral vectors" _i for the individual steps of a pulse sequence:
  
      _i=∫_t_i^t_i+1_1'(s) s,
  
  with t_i and t_i+1 the initial and final times of pulse i. The first-order constraint can then be written as
  
      _1'|_t=t_f=(∑_i^N_i)×_0(0)=0.
  
  If the trajectory (t) is closed, then the first-order constraint is obeyed for all initial conditions. Suppose a sequence is composed of N steps. The vectors _i of the individual steps define an N-step walk when placed head-to-tail. A sequence is fully-compensating to first order if this N-step walk is closed.
  
  
  
  
   §.§ Spin-echo Sequence
  
  Our first example is the three-step spin-echo sequence, which is a standard NMR method <cit.>. The short-hand notation R_ϕ^θ will be used to denote a single pulse, with ϕ the direction of the pulse in the xy-plane and θ the duration of the pulse. An error-free π-pulse around x is denoted as R_0^π. The spin echo sequence is denoted as R_0^π/2→ R_π/2^π→ R_0^π/2 (these angles are in the lab frame). It has the following time-dependent pulse direction (t):
  
      (t)=x    t∈(0,π/2)
      y    t∈(π/2,3π/2)
      x    t∈(3π/2,2π).
  
  In the presence of amplitude or detuning error, the first step is calculating the error _1'(t) in the toggling frame. This is easy for the amplitude error case because the error is always parallel to the pulse direction '(t), which in turn is piecewise constant in the toggling frame. The three vectors corresponding to the values taken by the pulse direction '(t) are shown in figure <ref>(a).
  
  The error integral vectors _i are directed along the three vectorial values taken by the error '_1(t). The resulting three-step walk is shown in figure <ref>(b). Note that the vector for step II has twice the length of that of steps I and II because it is a full π-pulse rather than a π/2-pulse. The three-step walk is not closed so the first-order constraint is not obeyed.
  
  For the case of the detuning error, _1 is constant in the lab frame, pointing in z with magnitude Δ, but in the toggling frame the direction of _1'(t)=𝐑̂^-1_1 rotates at a constant rate. This apparent motion is the result of the rotation of the toggling frame and is shown in figure <ref>.
  
  Note that the figure <ref>(a) resembles the rotation of the Bloch vector on the Bloch sphere, but should not be mistaken as such. Treating (t) as the motion of a phantom particle as mentioned previously, we can deduce that since its velocity _1'(t) rotates at a constant rate, the phantom particle's trajectory is composed of circular arcs, as shown in figure <ref>. Step II is a semi-circle while steps I and III are quarter-circles. The three-step walk in the presence of detuning is also not closed, so the spin-echo sequence is not fully-compensating with respect to either amplitude errors or detuning errors.
  
  For the case of amplitude error, the first-order error is suppressed provided the initial orientation of the Bloch vector is along the z-axis because the cross-product of Eq.(<ref>) is zero. This result can be understood as follows. Suppose that initially the Bloch vector points along the z-axis. The strength of the AC control pulse is too large, so the Bloch vector slightly overshoots the -y direction during the first π/2 pulse around the x-axis. To first-order, a small error is generated in the -z direction. The π-pulse along the y-axis flips this error around, causing the Bloch vector to slightly undershoot the -y direction. The π-pulse acts here as a form of “time-reversal", allowing the third pulse to undo the error caused by the first. This time-reversal is evident in figure <ref>, as _I is anti-parallel with _III. A similar argument appealing to spatial reasoning may be made for the case of the detuning error. For detuning error, the first-order constraint is again obeyed if the initial spin orientation is along the x-axis.
  
  
  
   §.§ Three-step Sequences.
  
  As our second example we will construct three-step sequences that, unlike the spin-echo sequence, are fully-compensating. We restrict ourselves here to sequences of π-pulses because in that case the geometrical constructions (N-step walk) can be performed in the horizontal plane. We will “reverse engineer" the sequence, i.e., we first construct closed error trajectories in the toggling frame and then work backwards to find the corresponding sequence in the toggling and lab frames. 
  
  With each of the three steps of the sequence, there is an associated error integral vector _i with i=I,II,III. The error integral vectors are now restricted to the xy-plane because the pulses are rotations by π, and they have the same magnitude because the three pulses have the same duration. To produce the closed N-step walk of a fully-compensating sequence there is only one option: the three vectors must form an equilateral triangle (see figure <ref>).
  
  The next steps are finding the corresponding error vectors _1'(t) – still in the toggling frame – and then reconstructing the corresponding sequence in the lab frame. 
  
  The simplest case is again that of the amplitude error. Figure <ref> shows the three vectorial values that the error _1'(t) must take during the three steps, pointing from the center symmetrically to the vertices of an equilateral triangle. Since the error _1'(t) is parallel to '(t), we can immediately read off the pulse directions '(t) in the toggling frame. It must form the following angles with the x'-axis during the three steps respectively: 0→-2π/3→2π/3. For the case of detuning error, special care needs to be taken in deducing the relationship between the pulse directions '(t) and _i. This is discussed in detail in appendix <ref>, the key conclusion of which is: for detuning error, the direction of _i for an odd-numbered step is a 90^∘ counter-clockwise rotation from its pulse direction; for an even-numbered step, clockwise.
  
  
  
  We are now ready for the final step: the reconstruction of the sequence in the lab frame. Denote this unknown sequence by 
  
      R_ϕ_1^π→ R_ϕ_2^π→ R_ϕ_3^π.
  
  For each π-pulse, the lab frame z-axis “toggles" between pointing along the z' and -z' directions in the toggling frame. Therefore, the pulse directions, which lie in the xy-plane in the lab frame, lie in the x'y'-plane in the toggling frame. A formula shown by <cit.> relates rotation angles in the lab and toggling frames,
  
      ϕ_j'=-(-1)^jϕ_j-∑_k=1^j-1(-1)^k2ϕ_k,
  
  where ϕ_k=ϕ_1,ϕ_2,ϕ_3,... specify the pulse directions in the lab frame, and ϕ_j' are the corresponding directions in the toggling frame. This transformation is also its own inverse. One can work in the toggling frame and convert the angles back to the lab frame if needed. We first apply this transformation to the case of amplitude error. In the toggling frame, following our previous discussion, the angles between the pulse directions and the x'-axis are 0→ -2π/3→ 2π/3 (Figure <ref>). Converting back to the lab frame angles, using Eq.(<ref>), produces the sequence: 
  
      R_0^π→ R_2π/3^π→ R_0^π.
  
  A constant can of course be added to all three angles without affecting first-order error suppression. 
  
  Next, for the case of detuning error, we have shown previously that the pulse direction '(t) needs to form the following three angles with the x'-axis: 0→ -π/3→ -2π/3 (Figure <ref>). Using the transformation formula Eq.(<ref>) produces the composite pulse: 
  
      R_0^π→ R_π/3^π→ R_0^π.
  
  
  
  
  
   §.§ Comparison between the Quasi-Classical and Time-Evolution Operator Frameworks (I).
  
  In ref.<cit.> the time-evolution operator method is used to derive constraints for a sequence of π-pulses to provide universal error correction to first-order. The constraints on the orientation angles of the pulse fields are
  
      ∑_jσ_ϕ_j'   =0  (amplitude), 
      ∑_jσ_ϕ_j”   =0  (detuning),
  
  where
  
      ϕ_j'   =(-1)^j+1ϕ_j+∑_k<j(-1)^k+12ϕ_k,
      
      ϕ_j”   =ϕ_j'+(-1)^j+1π/2,
  
  and where the σ_ϕ=cosϕ σ_x+sinϕ σ_y are linear combinations of Pauli matrices. Note that this last relation already suggests a link with vectors in the xy-plane. 
  
  To establish a connection between the two frameworks, we first rewrite the approach described in the previous section in a more mathematical language where we no longer restrict ourselves to three-step sequences (the sequence can be composed of any odd number of π-pulses). The key relationships that we illustrated with the three-step sequences can be shown to remain the same. The following algorithm makes precise the relationship between the pulse direction (t) in the lab frame, the pulse direction '(t) in the toggling frame, the N-step walk for amplitude error, the N-step walk for detuning error, and the conditions for error-suppression in case of either type of error.
  
      
    * Use Eq.(<ref>) to transform from the lab frame pulse directions (ϕ_k) to the toggling frame pulse directions (ϕ'_k).
      
    * Draw the toggling frame pulse directions as unit length vectors laying in the x'y'-plane. The complex number notation can make this statement more precise: draw the following set of complex numbers as vectors on the complex plane, {e^iϕ'_1,e^iϕ'_2,e^iϕ'_3...}. Label the step number for each vector.
      
    * 
          
    * To obtain the N-step walk made up of amplitude error integral vectors _i: starting from the origin, parallel transport the vectors so that they connect tip-to-tail in order. The final result is the N-step walk made from amplitude error integral vectors _i. In terms of complex numbers this can be expressed as:
          
      e^iϕ'_1+e^iϕ'_2+e^iϕ'_3+...
  
          
    * To obtain the N-step walk made up of detuning error integral vectors _i: return to step 2. Rotate those vectors for odd steps counterclockwise by π/2 and rotate those for the even steps clockwise by π/2. Starting from the origin, parallel transport the resulting vectors so that they connect tip-to-tail in order. The final result is the N-step walk made from detuning error integral vectors _i. In terms of complex numbers this can be expressed as:
          
      ie^iϕ'_1-ie^iϕ'_2+ie^iϕ'_3-...
  
          Mark the odd steps with “+" signs and even steps with “-" signs on paper.
      
      
    * The sequence is fully-compensating to first-order with respect to amplitude error if the figure formed in Eq.(<ref>) is a closed polygon, and it is fully-compensating to first-order with respect to detuning error if the figure formed in Eq.(<ref>) is a closed polygon. In terms of the complex numbers
      
      ∑_je^iϕ_j'=0       (amplitude),
         ∑_j(-1)^j-1ie^iϕ_j'=0     (detuning).
  
  
  It is easy to verify this algorithm for the three-step sequences of the previous section. Because the procedure is invertible one can reverse-engineer a desirable N-step walk to get the specification of the composite pulse, as explicitly shown for three-step sequences. 
  
  Next, expand the constraints expressed in complex exponential form in Eq.(<ref>) and (<ref>) into real and imaginary parts, perform the substitution 1→σ_x, i→σ_y, and then use the definition of ϕ_j” from Eq.(<ref>) where appropriate. One obtains
      
      0   =∑_je^iϕ_j'=∑_jcosϕ_j'+isinϕ_j'
         ⇒(substitution)
      
          	0   =∑_jcosϕ_j' σ_x+sinϕ_j' σ_y
         =∑_jσ_ϕ_j' (amplitude error),
  
      and,
      
      0   =∑_j(-1)^j-1ie^iϕ_j'=∑_je^i(ϕ_j'+(-1)^j-1π/2)
         =∑_je^iϕ_j”=∑_jcosϕ_j”+isinϕ_j”
         ⇒(substitution)
      
          	0   =∑_jcosϕ_j” σ_x+sinϕ_j” σ_y
      
          	0   =∑_jσ_ϕ_j” (detuning error).
  
     This reproduces Eqs.(<ref>) and (<ref>). It follows that, at least for the first-order constraint, the two frameworks produce precisely the same result. Appendix <ref> demonstrates how to apply the constraints formulated in this section to five-step sequences (such as the Knill sequence) that are fully-compensating to first order in both amplitude and detuning error.
  
  
  
  
  § SECOND-ORDER CONSTRAINT.
  
  Second-order errors are eliminated when Eq.(<ref>) is satisfied. Assume that the first-order constraint is obeyed and substitute the definition of the error integral (t) (see Eq.(<ref>)) into the second-order constraint,
  
      _2'|_t=t_f   =∫_0^t_fs(s)×((s)×_0(0)) s = 0.
  
  Using the fact that the (t) curve is closed, this equation can be manipulated (see appendix <ref>) into the form:
  
      _2'|_t=t_f=_0(0)×(1/2∮×) = 0.
  
  The vector area A=∫_𝒮𝐒 of any surface bounded by the same curve 𝒞 is given by
  
      A= 1/2∮_𝒞r× dr,
  
  where r traces out the boundary curve <cit.>. It follows that if the vector area of any surface enclosed by the error integral is zero, then the second-order error is zero independent of the initial condition. The corresponding pulse is then fully-compensating to second-order. Otherwise, the sequence suppresses second-order error only for states initially polarized in the same direction as the vector area. 
  
  
  
   §.§ Three-step Sequences.
  
  First apply the second-order constraint to the two three-step sequences Eq.(<ref>) and Eq.(<ref>), which were shown to be fully-compensating to first-order for, respectively, amplitude and detuning error. Start with Eq.(<ref>). The signed area enclosed by the vectors I, II, III is an equilateral triangle with a normal vector along the z' direction. Thus this sequence is not fully-compensating to second-order. Note though that the second-order error does vanish for initial states polarized along the z-axis. 
  
  Next, consider the sequence Eq.(<ref>) for the case of detuning error. The enclosed area can be divided into three planar parts bounded by semi-circles plus a planar part bounded by the triangle, as shown in figure <ref>. The directions of vector areas of the three semi-circles are all in the x'y'-plane and thus cannot cancel the vector area of the triangle, which is along the z' direction.  It follows that the net vector area is non-zero as well, so this sequence is also not fully-compensating to second-order with respect to detuning error. Examples of sequences that are fully-compensating to second order are provided in appendix <ref>.
   
   
  
  
  
   §.§ Comparison between the Quasi-Classical and Time-Evolution Operator Frameworks (II).
  
  
  Following <cit.> the condition for second-order amplitude error suppression in the time-evolution operator method is
  
      ∑_j∑_k<j[σ_ϕ_j',σ_ϕ_k']=0 (amplitude).
  
  As discussed in Ref. <cit.> (see Eq.(3)) the sum of commutators in this equation is in fact the signed area formed by a walk defined by the different angles in the plane. This can be seen by rewriting the condition as
  
      ∑_j∑_k<jsin(ϕ_j'-ϕ_k')σ_z=0,
  
  and recalling that the cross-product of two unit vectors is the vector area of the parallelogram spanned by them. Similarly, the condition for the second-order detuning error is
  
      ∑_j∑_k<jsin(ϕ_j”-ϕ_k”)σ_z=0  (detuning).
  
  For both the amplitude and detuning errors, the signed area formed by the walk in the plane specified by the different angles must be zero. We conclude that up to second order the quasi-classical framework produces the same error-suppressing pulse sequences as the time-evolution operator method.
  
  
  
  
  § GENERAL ROTATION ANGLES.
  
  
  We have assumed so far that the desired net effect of the sequence is a π-pulse. The quasi-classical framework for amplitude error suppression can be extended if the net effect of the sequence is a rotation around the x-axis by some arbitrary angle θ. We may choose to set up the pulse sequence as follows: R_ϕ_1^π→ R_ϕ_2^π→ R_ϕ_3^π→ R_ϕ_4^π→ R_0^θ. For the overall net effect to be correct, we let the first 4 pulses have the net effect of identity. It is most straightforward, though not necessary, to use the propagator framework to match the net effect:
  
      Û_0   =exp[-iπσ̂_ϕ_4/2]⋯exp[-iπσ̂_ϕ_1/2] 
         =σ̂_ϕ_4σ̂_ϕ_3σ̂_ϕ_2σ̂_ϕ_1
         =exp[-i(ϕ_4-ϕ_3+ϕ_2-ϕ_1)σ̂_z]
         =cos(ϕ_4-ϕ_3+ϕ_2-ϕ_1)𝐈
             -isin(ϕ_4-ϕ_3+ϕ_2-ϕ_1)σ̂_z
  
  Thus we need
  
      ϕ_4-ϕ_3+ϕ_2-ϕ_1 = 2π k,
  
  where k is an integer. Since we are free to add/subtract 2π to/from the phases, we may simply write the constraint as
  
      ϕ_1-ϕ_2+ϕ_3-ϕ_4=0
  
  Now work in the toggling frame and rewrite the above net effect constraint with the toggling frame phases,
  
      ϕ_1'-(2ϕ_1'-ϕ_2')+(2ϕ_1'-2ϕ_2'+ϕ_3)
      -(2ϕ_1'-2ϕ_2'+2ϕ_3'-ϕ_4')=0.
  
  Therefore,
  
      -ϕ_1'+ϕ_2'-ϕ_3'+ϕ_4'   =0.
  
  Under this condition, the fifth toggling frame phase is
  
      ϕ_5'    = 2ϕ_1-2ϕ_2+2ϕ_3-2ϕ_4+ϕ_5 
         =2(ϕ_1-ϕ_2+ϕ_3-ϕ_4)+0 
         =0.
  
  Now define α, β, γ, δ such that
  
      ϕ_1'    = α + γ, ϕ_2' = α - γ, 
      ϕ_3'    = β + δ, ϕ_4' = β - δ.
  
  Plug these definitions into the net effect constraint gets us
  
      0    = (α + γ) - (α - γ) + (β + δ) - (β - δ) 
         = 2γ + 2δ
  
  Hence we must have δ = -γ. So far the results arise from the net effect constraint only. 
  
  Since the final pulse is not a π pulse, the usual equilateral pentagon that determines first-order error suppression will have unequal side-lengths, namely 1, 1, 1, 1, θ/π (disregarding overall scaling) where the last side-length is shortened (or lengthened) due to the specified pulse area. Next we force the polygon to be closed in the toggling frame.
  
  Figure <ref> shows what shape the error integral vectors must be given the net effect constraint and first-order amplitude error suppression. The auxiliary lines reveal three isosceles triangles. Because the error integral vectors for step I, II, III, and IV have length 1 and the base angles are γ, both auxiliary lines have length 2cosγ. The relationship between the length of the auxiliary lines and the length of step V can also be determined from trigonometry, which produces
  
      cosγcosα=-θ/4π
  
  Now we can express the lab frame phases in terms of α and γ
  
      ϕ=α(1,1,-1,-1,0)+γ(1,3,3,1)
  
  It is a one-parameter family of sequences which accomplish a θ rotation around the x-axis and suppresses first-order amplitude error. It is obvious from Figure <ref> that when α=π (which in fact reproduces the BB_1(θ) sequence <cit.>), we get a polygon with zero vector area, so the sequence suppresses error to second order.
  
  
  
  
  
  
  § FORMAL CONNECTION BETWEEN THE QUASI-CLASSICAL AND PROPAGATOR FRAMEWORKS.
  
  
  Let Û(t) be the time-evolution operator of the spin wavefunction (or propagator from hereon). It obeys the equation 
  
      idÛ(t)/dt = [((t)+_1(t))·σ̂/2]Û(t).
  
  Transform to the toggling frame by decomposing Û(t) as
  
      Û(t) = Û_0(t)V̂(t),
  
  where Û_0 will be called the error-free propagator, and V̂ the error propagator. Here, Û_0(t) satisfies
  
      idÛ_0(t)/dt = ((t)·σ̂/2)Û(t).
  
  Assuming a sequence that accomplishes the desired net effect in the error-free case, we are only concerned about V(t). Substituting Eq.(<ref>) into Eq.(<ref>) gives us an equation for V(t),
  
      dV̂(t)/dt = -i(_1'(t)·σ̂/2)V̂(t).
  
  We used the fact that U_0^†(t)(_1(t)·σ̂)U_0=_1'(t)·σ̂, where _1'(t) is the amplitude or detuning error in the toggling frame. Since V̂ is a unitary operator, it must have the form
  
      V̂ = exp[-i𝐚·σ̂/2],
  
  where 𝐚 is a dimensionless 3D vector whose magnitude is a measure of the error. For operator or matrix equations of the form
  
      dV̂(t)/dt = Â(t)V̂(t),
  
  the Magnus expansion provides the solution,
  
      V̂(t)    = exp[Φ̂(t)], 
      where    Φ̂(t) = Φ̂_1(t) + Φ̂_2(t) + ⋯ and
      Φ̂_1(t)    = ∫_0^t Â(t_1)dt_1, 
      Φ̂_2(t)    = 1/2∫_0^tdt_1∫_0^t_1dt_2 [Â(t_1), Â(t_2)], 
         ⋯
  
  Higher-order terms in this series are integrals of increasingly longer nested commutators of Â(t). Setting Â(t)=-i_1'(t)·σ̂/2 gives
  
      Φ̂_1(t)    = -i(∫_0^t _1'(t_1)dt_1)·σ̂/2 
         = -i (t)·σ̂/2 
      Φ̂_2(t)    = -1/8∫_0^tdt_1∫_0^t_1dt_2 [_1'(t_1)·σ̂, _1'(t_2)·σ̂] 
         = -i(1/2∫_0^tdt_1∫_0^t_1dt_2 _1'(t_1)×_1'(t_2))·σ̂/2 
         = -i(1/2∫_0^tdt_1 (t_1)×d(t_1)/dt)·σ̂/2 
         = -i(1/2∫_0^t×d)·σ̂/2,
  
  where we made use of the identity
  
      [-i𝐀·σ̂/2,-i𝐁·σ̂/2]=-i(𝐀×𝐁)·σ̂/2.
  
  This identity is the key relation between the commutators that appear in the propagator framework and the cross-products that appear in the quasi-classical framework. Equations (<ref>) and (<ref>) are the first- and second-order constraints that we derived previously within the classical framework. The Magnus expansion of the propagator leads to the same first- and second-order error suppression as the quasi-classical framework. We conjecture that the correspondence between the quasi-classical and propagator frameworks holds to all orders.
  
   
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  § CONCLUSION.
  
  In conclusion, we demonstrated that composite pulses that suppress systematic amplitude and detuning errors can be derived from the quasi-classical equation for the spin expectation value. This suggests that when teaching a class in quantum computing, error correction by composite pulses can be discussed most easily in terms of classical physics with simple diagrams. It would be interesting to investigate whether this conclusion will continue to hold for two entangled qubits. An objection could be that loss of phase coherence due to interaction with a dissipative environment cannot be treated in a completely classical context. It should be kept in mind that the classical Bloch equations do account for loss of phase coherence and we conjecture that the design of error-suppressing pulse sequences in the presence of dissipative coupling to the environment can be treated satisfactorily within the framework of the Bloch equations. It is interesting to speculate about error correction methods for quantum computing that are not quasi-classical in nature. Topological quantum computing <cit.> is an obvious possibility but it is not clear how a topologically protected state would behave in the presence of systematic detuning and amplitude errors.
  
  The focus of this paper has been mostly on sequences with an odd number of π-pulses. The technique becomes less straightforward for the case of constructing error-suppressing sequences from π/2-pulses because closed walks of _i vectors would no longer be planar. This is not a prohibitive objection and studying sequences of π/2 pulses is nevertheless a promising direction because the extra spatial degree of freedom could allow for shorter sequences that give the same order of error suppression. A related, but distinct, direction for potential development is to apply it to sequences that accomplish a net π/2-pulse (or any other fractional-π pulses) rather than just a π-pulse. One could prepend or append any number of correcting π- or 2π-pulses to the target pulse. The bulk of the spin evolution would still produce (t) curves that are planar so the technique developed in this paper would still be applicable. A partial solution to this problem is outlined in appendix <ref>.
  
  Another important assumption was that the amplitude or detuning errors are constant in time. In actuality, a drift over time often occurs. To model the drift in the experimental parameters one could allow for different errors for each step in the sequence, i.e. a set of {ϵ_1,ϵ_2,ϵ_3...} or {δ_1,δ_2,δ_3...}. The steps of the error integral vectors would no longer be of equal length in that case. The solution of the constraints would follow the same geometric principles, but it would be mathematically more involved. 
  
  
  
  Acknowledgements:  I would like to thank R. Bruinsma, W. Campbell and C. Romes for guidance, insights, and discussions and R. Bruinsma for assistance in the preparation of the manuscript. Initial work on this project was carried out by Xingchen Fan and Clementine Domine with support from the NSF-DMR under CMMT Grant 1836404.
  
  
  
  
  § ROTATING WAVE APPROXIMATION AND THE CLASSICAL EQUATION OF MOTION.
  
  
  Begin with the lab-frame Hamiltonian
  
      H=ħ/2[ω_0σ̂_z+Ωcos(ω t+ϕ)σ̂_x+Ωsin(ω t+ϕ)σ̂_y],
  
  which describes the rotation of the spin under the DC and AC magnetic field. Following <cit.>, cancel the spin precession caused by the DC field by transforming into a rotating frame. Define
  
      |ψ⟩=U(t)|ψ⟩^rot,
  
  where U=exp(-iω t/2σ̂_z) is a rotation about the z-axis. Plugging in this definition into the Schrodinger's equation i∂_t|ψ⟩=H|ψ⟩ produces the effective Hamiltonian
  
      H'=U^† HU-iħ U^†Ut.
  
  Notice that
  
      cosθ σ̂_x+sinθ σ̂_y = e^-iθσ̂_zσ̂_x = σ̂_xe^iθσ̂_z.
  
  Hence
  
      U^† (cos(ω t+ϕ) σ̂_x+sin(ω t+ϕ) σ̂_y) U    
         =e^iω t/2σ̂_z(e^-i(ω t+ϕ)σ̂_zσ̂_x)e^-iω t/2σ̂_z
         =e^iω t/2σ̂_ze^-i(ω t+ϕ)σ̂_ze^iω t/2σ̂_zσ̂_x    
         =e^-iϕσ̂_zσ̂_x    
         =cosϕ σ̂_x+sinϕ σ̂_y.
  
  Because Û commutes with σ̂_z and U^†Ut=-iωσ̂_z/2, the effective Hamiltonian is
  
      H'=ħ/2[(ω_0-ω)σ̂_z+Ωcosϕ σ̂_x+Ωsinϕ σ̂_y].
  
  
  In the case where the AC magnetic field is linearly polarized as opposed to circularly polarized, the field can be decomposed into two counter-rotating circularly polarized waves. The lab-frame Hamiltonian will have the term
  
      H_rf   =2Ωcos(ω t+ϕ)σ̂_x
         =Ω(cos(ω t+ϕ)σ̂_x+sin(ω t+ϕ)σ̂_y)    
            +Ω(cos(ω t+ϕ)σ̂_x-sin(ω t+ϕ)σ̂_y).
  
  Under the unitary transformation U^† H_rfU, the second term above produces
  
      U^† (cos(ω t+ϕ) σ̂_x-sin(ω t+ϕ) σ̂_y) U    
         =e^iω t/2σ̂_z(e^i(ω t+ϕ)σ̂_zσ̂_x)e^-iω t/2σ̂_z
         =e^iω t/2σ̂_ze^i(ω t+ϕ)σ̂_ze^iω t/2σ̂_zσ̂_x    
         =e^i(2ω t+ϕ)σ̂_zσ̂_x   .
  
  If the drive frequency ω is close to the Larmor frequency ω_0, then this high-frequency time-dependent term has only a minor effect and can be dropped. This dropping of the high frequency term is known as the rotating wave approximation. Hence the wave rotating against the Larmor precession caused by the DC field can be neglected.
  
  Now define the vector =(Δ,Ωcosϕ,Ωsinϕ), where, Δ=ω_0-ω. Then the effective Hamiltonian in the rotating frame is
  
      H'=ħ/2·σ.
  
  By Ehrenfest Theorem, the evolution of the Bloch vector is
  
      ⟨σ̂_k|⟩t=<i/ħ[H',σ̂_k]>+<σ̂_kt>.
  
  The time derivative of the operator vanishes. The commutator can be evaluated
  
      [H',σ̂_k]=ħ/2Ω_j[σ̂_j,σ̂_k]=ħ/2Ω_j(2iϵ_jklσ̂_l)=-iħϵ_jlkΩ_jσ̂_l.
  
  Therefore,
  
      ⟨σ̂_k|⟩t   =ϵ_jlkΩ_j⟨σ̂_l|⟩
      ⟨σ|⟩t   =×⟨σ|.⟩
  
  
  
  
  
  § TRANSFORMATION INTO THE TOGGLING FRAME.
  
  
  This section is concerned with solving the equation
  
      (t)t=((t)+_1(t))×(t)   ,
  
  by introducing the toggling frame controlled by the rotation operator 𝐑̂, which is the solution to the operator equation
  
      t𝐑̂(t)=(t)×𝐑̂(t) ,
  
  with initial condition 𝐑̂(0)=𝐈. Let the motion of the Bloch vector be the composition of both the rotation of the toggling frame and the motion with respect to the toggling frame, i.e. (t)=𝐑̂(t)'(t), where '(t) is the Bloch vector in the toggling frame. Direct substitution into Eq. (<ref>) gives
  
      t(𝐑̂')   =(+_1)×(𝐑̂')
      (t𝐑̂)'+𝐑̂'t   =(+_1)×(𝐑̂'),
  
  where the time-dependence is suppressed in the notation. Using Eq.(<ref>), for the time derivative of 𝐑̂,
  
      ×(𝐑̂')+𝐑̂'t   =(+_1)×(𝐑̂').
  
  The two terms involving  can be cancelled,
  
      𝐑̂'t   =_1×(𝐑̂').
  
  Multiply by the inverse of the operator 𝐑̂ on both sides,
  
      't   =𝐑̂^-1(_1×(𝐑̂')).
  
  If _1(t)=0, then the time derivative of '(t) must vanish, and the Bloch vector merely rotates with the toggling frame, as should be expected in the absence of errors. If errors are present and _1(t)≠0, one can use the following identity to distribute the inverse rotation operator 𝐑̂^-1 into both operands of the cross product: 
  
      (𝐑̂𝐀)×(𝐑̂𝐁)=𝐑̂(𝐀×𝐁),
  
  where 𝐑̂ is a proper rotation and 𝐀, 𝐁 are any pair of 3D vectors. Therefore
  
      't   =𝐑̂^-1(_1×(𝐑̂'))
         =(𝐑̂^-1_1)×(𝐑̂^-1𝐑̂')
         =(𝐑̂^-1_1)×'.
  
  Now one can define the vector _1'(t)=𝐑̂(t)^-1_1(t). The application of 𝐑̂^-1(t) on the un-primed vectors, such as in the case of (t), produces the coordinates of the vector in the toggling frame. Therefore _1'(t) is the error vector viewed in the toggling frame. Finally, one obtains the equation of motion for the Bloch vector in the toggling frame,
  
      '(t)t   =_1'(t)×'(t),
  
  with the time dependence restored in notation.
  
  
  
  
  
  § CONVERGENCE OF THE SERIES '(T)=∑_N=0^∞'_N(T)
  
  
  We obtained the following set of expressions for the terms of the series:
  
      _0'(t)   =_0(0)
      _1'(t)   =∫_0^t_1'(s)×_0(0) ds
      _2'(t)   =∫_0^t_1'(s)×_1'(s) ds
         ...
  
  We now show that the series '(t)=∑_n=0^∞_n'(t) is absolutely convergent. Take the norm of each term of the series and establish its upper bound. Trivially, ||_0'(t)||=||_0(0)||. For the first-order term, the upper bound for the norm is
  
      ||'_1(t)||    = ||∫_0^t_1'(t)×_0(0)ds|| 
         ≤∫_0^t||_1'(t)×_0(0)||ds 
         ≤∫_0^t||_1'||_max||_0(0)||ds 
         =||_0(0)|| ||_1'||_maxt.
  
  For the second-order term, the norm is
  
      ||'_2(t)||    = ||∫_0^t_1'(t)×'_1(s)ds|| 
         ≤∫_0^t||_1'(t)×'_1(s)||ds 
         ≤∫_0^t||_1'||_max||'_1(s)||ds 
         ≤∫_0^t(||_1'||_max)^2||_0(0)|| s ds 
         =||_0(0)|| 1/2(||_1'||_maxt)^2.
  
  Continuing the calculation, we find that for the nth term in the series, the upper bound is
  
      ||'_n(t)|| ≤ ||_0(0)|| 1/n!(||_1'||_maxt)^n.
  
  Clearly the power series
  	
      ∑_n=0^∞||_0(0)|| 1/n!(||_1'||_maxt)^n
  
  is convergent for all (finite) t. Hence by the comparison test, the series ∑_n=0^∞||'_n(t)|| also converges. Any absolutely convergent series is also convergent, hence the infinite sum '(t)=∑_n=0^∞'_n(t) converges.
  
  We can use the established upper bound to roughly estimate the error introduced by truncating the series at the nth order, which is approximately ||_0||1/n!(||_1'||_maxt)^n. For the truncated series to be a good approximation, we must have 
  
      1/n!(||_1'||_maxt)^n    ≪ 1 
      
      	(||_1'||_maxt)^n    ≪ n! ≈(n/e)^n 
      
      	||_1'||_maxt    ≪n/e.
  
  Since they are different coordinate frame representations of the same vector, Ω_1(t) and Ω_1'(t) has the same magnitude. Crudely, the first- and second-order approximations are valid for
  	
      ||Ω_1||_maxt≪1.
  
  
  
  
  
  
  § RELATIONSHIP BETWEEN _1'(T) AND _I FOR DETUNING ERROR.
  
  
  Since we are only considering composite pulses consisting of three π-pulses, the trajectory of the error _1'(t) for the detuning case must consist of three semi-circular arcs. By symmetry, for the integral in Eq.(<ref>) to vanish and the walk to close, one may postulate that the planes of the three arcs must make angles of 2π/3, so that the figure formed has its center of mass located at the origin, as shown in figure <ref>.
  
  
  It is necessary to draw this previous reasoning for the detuning case back to the equilateral triangle we began with. Treating the '_1(t) as the time-dependent velocity of a phantom particle performing uniform circular motion, it follows from figure <ref> that the three error integral vectors so generated indeed form an equilateral triangle, and '_1(t) is the unique way this can happen. 
  
  Notice in particular that the angle formed between the planes of the semi-circles in figure <ref> coincides with the angles formed between _i and the x'-axis in figure <ref>.
  
  Some additional work needs to be done to read off the pulse direction required in the toggling frame from figure <ref>. Recall that in case of detuning error, the apparent motion of _1'(t) in the toggling frame, such as that in figure <ref> is caused by the rotation of the toggling frame itself, while the vector _1=Δ ẑ in truth stays constant in the lab frame. To generate the apparent rotation of _1'(t) as seen in step I in the toggling frame, the pulse direction must be in the x' direction–rather than in the -x' direction, as one might expect if one naively uses the right-hand-rule on arc I. Similar arguments can be carried out for step II and III. As a result, the pulse directions must form the following angles with the x'-axis during the three steps respectively: 0→-π/3→-2π/3.
  
  Now compare these angles with those formed between _i and the x'-axis in figure <ref>. If one takes the angles from the pulse direction of odd-numbered steps in the toggling frame and add π/2, one obtains the angle for _i. For even-numbered steps (step II only, in this case) addition by π/2 is replaced by subtraction by π/2. This relationship will help us generalize to longer sequences. The differentiated treatment between even- and odd-numbered steps can be explained by the fact that the direction of traversal of the semi-circles in figure <ref> toggles between top-down and bottom-up.
  
  
  
  
  
  § MANIPULATING THE SECOND-ORDER CONSTRAINT.
  
  
  Substitute the definition of (t) into the second-order constraint to obtain
  
      _2'|_t=t_f   =∫_0^t_f(s)×((s)×û) s  
         =∫[(·û)-(·)û] s,
  
  where the simplified notation û=_0(0) is used for the initial condition. The second term is easily integrated since ·=1/2t^2. The first term contains such terms as p_x p_z, and p_y p_z, which motivates us to consider the area integral 1/2∫𝐩×𝐩̇  s. Using vector identities and the fact that the (t) curve is closed, Eq.(<ref>) can be manipulated by following the logic below,
  
      û×(×)
             =(·û)-(·û)
         =2(·û)-(·û)-(·û)
         =2(·û)-t[(·û)]   
      
          (·û)   =û×1/2(×)+1/2t[(·û)].
  
  Hence, 
  
      _2'|_t=t_f   =û×1/2∫_0^t_f×  s+1/2[(·û)-^2û]_s=0^t_f
         =û×1/2∫_0^t_f×  s+1/2[×(×û)]_s=0^t_f.
  
  If the composite pulse already fully compensates for either kind of first-order error, then the (t) curve for said error is necessarily closed, and the boundary term in the integral vanishes. One obtains
  
      _2'|_t=t_f=û×(1/2∮×).
  
  
  
  
  
  
  
  § FIVE-STEP SEQUENCES.
  
  
  
  As an illustration of the mapping between the propagator and perturbation approaches, and as another application of the toggling formula Eq.(<ref>), we consider here the Knill sequence <cit.>, the five-step sequence, mentioned in the Introduction, that provides effective amplitude and detuning error suppression. In our notation, the Knill sequence takes the form,
  
      R_π/6^π→ R_0^π→ R_π/2^π→ R_0^π→ R_π/6^π.
  
  Using Eq.(<ref>) this translates to toggling frame phases π/6→π/3→ 5π/6→ -2π/3→ -π/2. The corresponding five _i vectors for amplitude and detuning errors are shown in figure <ref>. The five-step walks are closed in both cases. The Knill sequence is thus fully-compensating to first-order with respect to both amplitude and detuning error. Note that the error integral vectors of the odd steps (i.e., steps I, III, and V) still form an equilateral triangle while the even steps (i.e., steps II and IV) are anti-parallel and thus cancel.
  
  
  The same algorithm can be used to identify other five-step sequences composed of π-pulses that share these same properties. Treat the five pulse-direction angles ϕ_i' as variables. According to the algorithm, the conditions for full compensation of amplitude and detuning error to first-order are 
  
      e^iϕ'_1+e^iϕ'_2+e^iϕ'_3+e^iϕ'_4+e^iϕ'_5   =0,  
      ie^iϕ'_1-ie^iϕ'_2+ie^iϕ'_3-ie^iϕ'_4+ie^iϕ'_5   =0.
  
  The two conditions are obeyed if
  
      e^iϕ'_1+e^iϕ'_3+e^iϕ'_5   =0, 
      e^iϕ'_2+e^iϕ'_4   =0.
  
  The geometric meaning of these conditions is as follows: the three _i vectors for odd i must form an equilateral triangle while the two _i vectors for even i must be anti-parallel. Ignoring inversion and global rotation, one is left with an undetermined relative angle α between the odd and even steps. In the toggling frame, the pulse directions are π/6→ (π/3+α)→ 5π/6→ (-2π/3+α)→ -π/2, where α=0 corresponds to the original Knill sequence. 
  
  
  The corresponding sequence in the lab frame is
  
      R_π/6+2α^π→ R_α^π→ R_π/2^π→ R_-α^π→ R_π/6-2α^π.
  
  This should be compared with the family of five-step composite pulses that was obtained using the full machinery of propagators (see Eq.(47) of ref.<cit.>). The angles that determine the pulse directions are:
  
      ϕ=(π+2α',α',-π/3,-5π/3-α',-7π/3-2α')
  
  depending on a single parameter α'. All members of this family are fully-compensating to first-order against amplitude and detuning errors. When α'=7π/6, the Knill sequence results. Although the α parameter of Eq.(<ref>) is shifted with respect to α', it is clear that the two expressions describe the same family, except that all angles differ by a constant 7π/6.
  
  As a second illustration, the second-order constraint is applied to the family of five-step sequences that obeys the first-order constraint. The five _i vectors of the five-step closed walks for α equal to π/3 are shown in figure <ref> both for amplitude (a) and detuning error (b). 
  
  For the case of amplitude error, the (t) curve is strictly planar so the direction of the vector area is in general along the z' direction. The area of the enclosed pentagonal figure is its magnitude. The second-order constraint for amplitude error is thus not obeyed for α=π/3. 
  
  
  
  For the case of the detuning error, the family of five-step Knill-like sequences has the property that the vector area contributed by the five semi-circles in the detuning (t) curve exactly cancel (due to the separate cancellation among odd steps and even steps). Only a pentagonal area is left. As shown in figure <ref>, for α=π/3 the pentagon is self-intersecting, breaking up the figure in two separate parts. The vector areas of the two parts have opposite signs. For α=π/3, the two contributions nearly cancel. This suggests that for general α the five-step sequence is not fully-compensating but there could be a special value of α close to α=π/3 for which there is an exact cancellation. As shown in figure <ref>, this is indeed the case for  α=±(π-arccos(-√(3)/4))=±1.1230. We will call this a “magic angle". The value of the magic angle is calculated by equating the area of the parallelogram formed by steps II, III, and, IV of the five-step sequence to the area of the equilateral triangle formed by steps I and V. Similarly, for α=±arccos(-√(3)/4)=±2.0186, the amplitude (t) curve has zero vector area, and the corresponding sequence is fully-compensating to the second-order with respect to amplitude error. These two magic angles agree with the ones reported in <cit.>, up to a shift due to the definition of α.
  
  
  
  
  
  
  