Arrow of time and its reversal on the IBM quantum computer

Uncovering the origin of the “arrow of time” remains a fundamental scientific challenge. Within the framework of statistical physics, this problem was inextricably associated with the Second Law of Thermodynamics, which declares that entropy growth proceeds from the system’s entanglement with the environment. This poses a question of whether it is possible to develop protocols for circumventing the irreversibility of time and if so to practically implement these protocols. Here we show that, while in nature the complex conjugation needed for time reversal may appear exponentially improbable, one can design a quantum algorithm that includes complex conjugation and thus reverses a given quantum state. Using this algorithm on an IBM quantum computer enables us to experimentally demonstrate a backward time dynamics for an electron scattered on a two-level impurity.

SI 1. Wave-packet reversal complexity Let a charged particle have one dimensional wave function ψ(x) ≡ p(x)e iϕ(x) . Consider a fluctuating electromagnetic field potential V (x, t) of the electromagnetic field which is approximated by the N -cell stepwise function V (x, t) = N n=1 I n (x)V (x n , t), where I n (x) is an indicator function of the cell with the index n. Let us assume that during the short time interval a relatively strong non-homogenous fluctuation has emerged and the wave packet ψ(x) acquires the coordinate dependent phase shift ψ(x) →ψ(x) = ψ(x) exp(i n I n (x)φ n ), where φ n =´dt eV (x n , t)/ . Consider then the specific fluctuation with φ n (x) = −2ϕ(x n ) which drives the original wave packet ψ(x) into its approximate complex conjugated formψ * (x). The accuracy of such a conjugation procedure is defined through the overlap of the exact conjugated state ψ * (x) with the approximate conjugated stateψ * (x), S = ψ * (x)|ψ * (x) , x I n (x)p(x) e 2i(ϕ(x)−ϕ(xn)) . (1) Then the probability of the correct reversion is given by |S| 2 . Assuming that the particle density p(x) changes slowly on the scale of large fluctuations of the particle phase ϕ(x) one arrives at for the sufficiently small δx n of the cells defined through the condition g(x n ) ≡ ϕ (x n )δx n 1. Then the error probability of the incorrect conjugation of the wavepacket is given by |S| 2 = 1 − and in the continuous limit one has Let us now find the number of cells N needed to approximate the electromagnetic field complex conjugation procedure with a given error probability level . From the definition g(x) = ϕ (x)δx one has Minimizing the functional N [g(x)] under the constraint Eq. (3) one finds Generalization of the above result to a d-dimensional case is straightforward Applying these results to the wave packet given by the Eq. (1) of the main text, one obtains λ(Ψ) ∼ ( τ /m) 2/3´d x(f 2 (x)x 2 ) 1/3 . We assume that initially at τ = 0 the wave packet has the size L 0 , so that f 2 (k) ∼ L 0 for |k| ≤ 1/L 0 and, therefore, λ(Ψ) ∼ (L τ /L 0 ) 2/3 where L τ = τ /mL 0 is the size of the wave packet after the free evolution during the time τ . Therefore, the number of the elementary cells needed to arrange the electromagnetic potential fluctuation which reverses the dynamics of a one dimensional wave packet is linear in τ since N ∼ −1/2 L τ /L 0 , see also (S1). For a d-dimensional wave packet the number of cells grows polynomially with τ as N ∼ −d/2 (L τ /L 0 ) d .

SI 2. Reversal of the qubit register dynamics
Let the forward time dynamics of the n-qubit register state |ψ(t) = N −1 i=0 ψ i (t)|i be governed by the HamiltonianĤ, i ∂ t |ψ(t) =Ĥ|ψ(t) . The time-reversal symmetry of the Schrödinger equation implies that if there is a forward time solution |ψ(t) then the backward time solution also exists and is uniquely defined through the forward time solution via the time-reversal oper-ationR such that |ψ(t) =R|ψ(t) . The time-reversal operationR is an anti-unitary operation: R ψ 1 |Rψ 2 = ψ 1 |ψ 2 * and can be presented as a productR =Û RK of some unitary operator U R and the complex conjugation operationK which we define with respect to the computational basis |i of the qubit register asK Substituting |ψ(t) =Û RK |ψ(t) into Eq. (7) one finds and therefore the unitary operationÛ R has to satisfy a relation, The relation (10) defines the unitaryÛ R . Indeed, the hermitian operatorĤ can be represented in a formĤ =Û † HÊÛ H , whereÊ is a real diagonal operator andÛ H is unitary. Then it follows from the Eq. (10)Û The forward time evolution operatorÛ (τ ) = exp(−iĤτ / ) applied to the time reversed state |ψ(τ ) drives it into the new stateÛ Indeed,Û Making use of the explicit form of theÛ R operator, see Eq. (11), one hasÛ RĤ tÛ † R =Ĥ that proves Eq. (12). Therefore, in order to restore the original state |ψ(0) from the time-evolved state |ψ(τ ) one has to apply the following sequence of operations

SI 3. Optimal phase shifts arrangement
Here we outline an optimal arrangement of the state selective phase shift operationsΦ i (ϕ) = |i i|e iϕ entering the complex conjugation operationÛ ψ = 2 n −1 i=0Φ i (−2ϕ i ) for the qubit state |ψ = 2 n −1 i=0 |ψ i |e iϕ i |i . Let us consider 2 k−2 operationsΦ k with index k having the same values of two highest bits b 0 = b 1 = 1: k(k ) = 2 n−1 + 2 n−2 + k , k = 0, . . . , 2 n−2 − 1. Then in the product 2 n−2 −1 k =0Φ k (−2ϕ k ) one needs to check the values of the bits b 0 and b 1 only once, and this reduces the number of Toffoli gates. This recipe can be recursively repeated for the next lower bits b 2 , b 3 and so on, see Fig. 1B. Then the resulting quantum circuit comprises the sequence of nested blocks or subroutines A 11b 2 ...b n−1 ⊃ A 111b 3 ...b n−1 ⊃ · · · ⊃ A 1...1b n−1 where each subroutine A 1...1bm...b n−1 performs the controlled phase shift on all components |k with first m highest bits equal to 1. As follows from the Fig. 1B, the subroutine A 11...bm...b n−1 involves two subroutines of the next lower level A 11...1b m+1 ...b n−1 and A 11...0b m+1 ...b n−1 , and two additional Toffoli gates that are needed to check the value of the bit b m+1 . Therefore, the number of Toffoli gates N Λ 2 A 11...1bm...b n−1 needed for the implementation of the subroutine
However, the number of the CNOT gates can be reduced as far as some of operators CTXTX i 1 i 2 ... can be grouped together. Consider, for example, the unitary operation CTXTX 12 · CTXTX 123 . Its straightforward implementation requires 4 + 2 CNOT gates. A more savvy arrangement is shown in the Fig. 1F of the main text. There the computational state of the second qubit b 1 right after the first CNOT 0,1 gate is given by b 1 ⊕ b 2 . This enables one to implement the controlled phase shift CXTXT 01 right after the first CNOT 0,1 operation. At this moment, one need not to restore the original bit values b 0 and b 1 but rather to add the second CNOT 1,2 , set the third qubit b 3 into the state b 0 ⊕ b 1 ⊕ b 2 , and to implement the controlled phase shift CTXTX 012 . Hence the unitary operation CTXTX 01 · CTXTX 012 will require the same number of CNOT gates as the operation CTXTX 012 alone. As a result, the complex conjugation operation of a given 3-qubit state can be implemented using only 8 CNOT gates as shown in Fig. 1F.
The above CNOT optimization technique can be easily generalized to a n-qubit case. Consider a product CTXTX i 1 i 2 ·CTXTX i 1 i 2 i 3 ·CTXTX i 1 i 2 i 3 i 4 · · ··CTXTX i 1 i 2 i 3 i 4 ...in where a sequence of nested strings of the qubit indices i 1 i 2 ⊂ i 1 i 2 i 3 ⊂ · · · ⊂ i 1 i 2 i 3 i 4 . . . i n are formed by adding an additional index to the right hand side of a previous string. Then the implementation of this product requires the same number of CNOT gates as the largest CTXTX i 1 i 2 i 3 i 4 ...in factor of the product. This observation lets us find a number of CNOT gates N ⊕ K n needed to implement the complex conjugation unitary operationK n of a given n-qubit state.
Let us assume that N ⊕ K n−1 for a n − 1 qubit register b 1 . . . b n−1 is known. Let us add an additional qubit line b 0 and find how many additional operations CTXTX(i 1 i 2 . . . ) one needs in order to complete the complex conjugation task for n-qubit register b 0 . . . b n−1 . Obviously any such additional operation CTXTX s has its parameter string s = i 1 . . . i k starting from the index 0, i.e. i 1 = 0. Consider for example n = 4 case. Then there are seven additional operations, CTXTX 0123 · CTXTX 012 · CTXT 013 · CTXTX 02 · CTXTX 01 · CTXTX 02 · CTXTX 03 . (24) Making an optimization procedure one can group these operations as CTXTX 01 ·CTXTX 012 ·CTXTX 0123 · CTXTX 02 ·CTXTX 023 ·CTXTX 013 ·CTXTX 03 , (25) and hence where N ⊕ CTXTX s is the number of CNOT gates needed for the operation CTXTX s . One can note, that only generalized operations CTXTX s with the inputs strings s = i 1 . . . i k where first and last indices are equal to 0 and 3, respectively are counted for the total number of the CNOT gates. Therefore, for a general case, the following relation holds and, therefore, N ⊕ K n = (n − 1)2 n−1 , n > 1.
SI 5. Simulation of scattering on a two-level impurity Here we discuss a spinless particle which scatters on a two-level impurity (TLI). The free dynamics of the TLI is governed by a Hamiltonian The scattering process is described by the 2 × 2 scattering matrixŜ i , i = 0, 1 whose form depends on the impurity state. The quantum state of the particle-impurity system can be described as the two-bit state |ψ = b 0 ,b 1 =0,1 A b 1 b 0 |b 1 ⊗ |b 0 where the first qubit describes the TLI and the second one describes the propagation direction of an incoming/scattered particle. Let the system start in the state |ψ(0) = |0 ⊗ |L with the particle coming from the left. Let after the time τ > 0 the particle be scattered on the TLI. The resulting state |ψ(τ ) is generated by the sequence of unitary operations |ψ(τ ) =Ŝ ψ · Û i (τ ) ⊗ 1 |ψ(0) , where the unitary operator U i (τ ) ≡ exp −iĤ i τ / describes the free evolution of TLI and describes the state dependent scattering process of the incoming particle. The unitary operator U i (τ ) = exp −iωτ (σ x cos α +σ z sin α) is symmetric. In the absence of the magnetic field, the scattering operatorŜ ψ is symmetric as well. Let the state freely evolve after the scattering at the t = τ during the same time period τ . Then the resulting state |ψ(2τ ) = [Û i (τ ) ⊗ 1]|ψ(τ ) can be generated from the initial state |ψ(0) by the symmetric 2-qubit unitary operator Therefore, as we have already discussed in SI 2, the time reversal procedure of the 2-qubit state |ψ(2τ ) requires only the unitary implementation of the complex conjugation operation |ψ(2τ ) → |ψ * (2τ ) . Our goal is to implement the unitary operationÛ 2bit via the set of quantum gates available on the IBM public quantum computer. The only available two-qubit gate is the CNOT bc,bt gate, where b c the qubit serves as a control and b t qubit serves a target. Among the standard 1-qubit gates we will need two available generalized 1-qubit gates: the relative phase shift gateT (α), introduced in the SI 4 and the full 1-qubit unitary rotation whereR Any 2 × 2 unitary matrixÛ can be represented in the form (33) up to some phase factor: U = e iδÛ 3 (θ, α, β). In particular, any symmetric 2 × 2 unitary matrixÛ =Û t has the form e iδÛ 3 (θ, α, α+π). Therefore, a given set of matricesÛ i (τ ),Ŝ 0 andŜ 1 entering into the definition of the model can be presented aŝ The phase exponent e iφ gives only a trivial common phase factor for the system state and will be omitted in what follows. Without any loss of generality we assume δ 0 = 0 as well. Next, let us construct the 2-qubit operationŜ ψ using as less CNOT gates as possible. It turns out thatŜ ψ can be constructed with the help of only two CNOT gates. Indeed, where Λ b 1 ,b 0 (Ŵ ) is a controlledŴ -gate, where the first (control) qubit describes a state of TLI and the second (target) qubit describes a scattering state of the particle,Û 3 (α, ϕ, λ) andT (ϕ) are generalized one-qubit gates available on the IBM quantum computer. The free evolution operatorÛ i (τ ) = exp(−iĤ i τ / ) withĤ i = ω(cos ασ z + sin ασ x ) is parameterized by two parameters ωτ and α. The unitary operatorÛ i (τ ) is symmetric and for a fixed values of ωτ and α can be presented in the form, 1 for each qubit line are shown in the Table. 3. The errors of the CNOT gates CNOT q2,q0 , CNOT q2,q1 and CNOT q1,q0 used in the experiments are g20 = 1.91%, g21 = 2.68% and g10 = 1.70% respectively. These processor's state parameters allows us to estimate a theoretical value of a time-reversal fidelity F = | 0 . . . 0|ψ 0 | 2 , where |ψ 0 is a final state of the qubit register. For the used gate arrangement one has, while the experimentally observed values of the time-reversal fidelity are shown in Tables. 1  and 2.  Table 1: ωτ α |00 |10 |01 |11 F π/6 π/6 6949 437 562 244 84.8 ± 0.4% π/6 π/4 6916 440 576 260 84.4 ± 0.4% π/6 π/3 6983 370 560 279 85.2 ± 0.4% π/6 π/2 6950 338 551 353 84.8 ± 0.4%