How much time does it take for two molecules to react? If a reaction occurs upon contact, the answer to this question boils down to the classic first-passage time problem: find the time it takes for the two molecules to meet. However, this is not always the case as molecules switch stochastically between reactive and non-reactive states. The reaction is then said to be “gated” by the internal states of the molecules involved, which could have a dramatic influence on kinetics. A unified, continuous-time, approach to gated reactions on networks was presented in a recent paper [Scher and Reuveni, Phys. Rev. Lett. **127**, 018301 (2021)]. Here, we build on this recent advancement and develop an analogous discrete-time version of the theory. Similar to continuous-time, we employ a renewal approach to show that the gated reaction time can always be expressed in terms of the corresponding ungated first-passage and return times, which yields formulas for the generating function of the gated reaction-time distribution and its corresponding mean and variance. In cases where the mean reaction time diverges, we show that the long-time asymptotics of the gated problem is inherited from its ungated counterpart. However, when molecules spend most of their time non-reactive, an interim regime of slower power-law decay emerges prior to the terminal asymptotics. The discretization of time also gives rise to resonances and anti-resonances, which were absent from the continuous-time picture. These features are illustrated using two case studies that also demonstrate how the general approach presented herein greatly simplifies the analysis of gated reactions.

## I. INTRODUCTION

Gated processes are ubiquitous in the chemical,^{1–5} biological,^{6–10} and physical sciences.^{11–17} An example of a gated process is given in Fig. 1, which illustrates a gated cleavage reaction. Adopting a chemical prone nomenclature, we imagine a “particle,” e.g., enzyme, that can react with a “target,” e.g., a cleavage site on a peptide or DNA strand. The particle switches between two states—a reactive state and a non-reactive state. Importantly, a reaction occurs only when the particle meets the target while being in the reactive state. Thus, the reaction is said to be “gated” by the particle’s internal state.

More generally, a gated reaction has an underlying spatial component on top of which an internal (gating) component is added. The spatial component can be any stochastic motion that the particle undertakes in search of the target.^{18–21} Similarly, one can, in principle, consider any internal dynamics, e.g., multiple reactive and/or non-reactive states^{14} or even non-Markovian dynamics.^{12}

Recently, gated processes enjoyed renewed attention across a wide range of disciplines and directions: Kochugaeva, Shvets, and Kolomeisky considered the switching dynamics of a protein undertaking facilitated diffusion on a DNA strand.^{22} A later general model, which bears some similarity, is the gated continuous-time and discrete-space random search for a target on a 1D interval by Shin and Kolomeisky.^{23} Markedly, both models allow for diffusion rates that depend on the internal state. Gated diffusion with different diffusivities was also considered by Godec and Metzler for 3D Brownian motion inside a spherical domain, with a spherical target at its center,^{24} thus generalizing the pioneering works of Szabo *et al.*^{1,25}

Even when considering a particle with diffusivity that is decoupled from the internal state, there are still many directions to explore. Mercado-Vásquez and Boyer studied the reaction time of a gated 1D diffusing particle on the infinite line,^{26} adding novel insights into the works of Budde, Cáceres, and Ré.^{11–13} They then proceeded to extend their theory to the cases of a gated run-and-tumble particle^{27} and a gated diffusive particle under restart.^{28} The latter was also previously considered by Bressloff with a slightly different model.^{29} Gopich and Szabo deepened the exploration of multiple gated particles/targets in a model that allows for reversible binding.^{30} Lawley and Keener mathematically demonstrated the connection between the Robin (radiation) boundary condition, which is central in the theory of diffusion-influenced reactions^{31,32} and a gated boundary.^{33}

In a previous letter this year, we developed a unifying approach to gated reactions on networks in the framework of the Montroll–Weiss Continuous-Time Random-Walk (CTRW).^{34} We showed that the mean and distribution of the gated reaction time can always be expressed in terms of ungated first-passage and return times. A related result is that of Spouge, Szabo, and Weiss, which connected between gated and ungated propagators of Markovian diffusion processes.^{14} We instead focused on the reaction time distribution, which is generally more attainable, be it analytically, experimentally, or numerically. Utilizing a renewal framework, we were able to treat general spatial processes, which can be non-homogenous and non-Markovian.^{34} Here, we develop an analogous discrete-time version of this framework and illustrate its applicability with examples.

Previously, a discrete time multi-particle gating reaction on a d-dimensional regular lattice was considered by Bénichou, Moreau, and Oshanin.^{5} However, to the best of our knowledge, *single-particle* discrete time and space gating problems were not considered before. One reason to do so is because discrete space–time models are the bread-and-butter of stochastic analysis and first-passage modeling.^{19,21,35} Discrete-time Markov chains, in particular, are widely applied in this context, and extending these to include gating dynamics is thus desirable. Not less important is the fact that discrete space–time models of gating provide a convenient testbed for resonance and anti-resonance effects that were completely absent from the class of continuous-time models considered in our previous work.^{34} While such effects can still be studied in continuous-time using models of non-Markovian internal gating dynamics, understanding their origin within a much simpler discrete-time Markovian framework has significant advantages in terms of analytical tractability.

The remainder of this paper is structured as follows: In Sec. II, we develop a general theory for gated reactions on networks. Working in discrete time, we employ a renewal approach to express the gated reaction time in terms of the corresponding ungated reaction time. Formulas for the generating function of the gated reaction-time distribution, as well its mean and variance, are derived. In cases where the mean reaction time diverges, we prove that the long-time asymptotics of the gated problem is inherited from its ungated counterpart, where only the pre-factor of the power-law tail changes. We also study these cases under conditions of high-cripticity, i.e., when the molecules spend most of their time in the non-reactive state. We show that the terminal asymptotic regime is then preceded by a transient regime of slower power-law decay, which we determine exactly.

In Secs. III and IV, we utilize the general results obtained to analyze two case studies. The first is of a particle moving in a unidirectional manner on a circle in search of a target. While the ungated version of this problem is nothing but trivial, it is more challenging to solve the gated version, and indeed, interesting features arise when gating is added. Specifically, we see that while the results in Sec. II bear resemblance to the results of Ref. 34, the discretization of time introduces new features that do not exist in the continuous-time analog. Noticeably, resonance and anti-resonance effects emerge when the internal gating dynamics is in, or out of, phase with the spatial process governing particle-target encounters.

The case study considered in Sec. III belongs to a wide class of problems in which the mean reaction time is well-defined. Yet, one often encounters problems in which the mean diverges, e.g., when considering open systems. In such cases, one is usually interested in the reaction time distribution itself, especially in its long-time asymptotics. In Sec. IV, we demonstrate how our formalism allows one to deal with such cases by using it to solve for the gated reaction time of a symmetric random-walk on a 1D lattice. As this problem was not solved previously, we offer two approaches to the solution: (a) writing the corresponding master equation and solving it brute-force and (b) using the renewal approach developed in Sec. II. One can then appreciate how the latter elegantly replaces a complex calculation in favor of a straightforward solution method, which readily reveals key features of the gated analog of a classic first-passage problem. To put things in context, we conclude Sec. IV with a general perspective on gated 1D random walks and reactions.

The *modus operandi* employed in Secs. III and IV is not limited to 1D systems and applies without change to gated reactions on lattices of higher dimensions and to gated reactions on networks of arbitrary topology. This fact is further stressed in Sec. V, which concludes this work with a simple “algorithm” that allows one to generate solutions to gated reaction problems from solutions to their ungated counterparts, thus circumventing the need to solve gated problems directly. Importantly, this approach can be utilized even when an analytical solution to the ungated first-passage problem is not known and as long as it can be estimated numerically. In this way, the analysis of gated problems is greatly simplified.

## II. GENERAL THEORY

Consider a single particle in search of a single target site that is embedded in a general network (N.B., the network can be a lattice, but it need not be). To find the target, the particle conducts a general random walk on the network. This is done in discrete time. In particular, in each time step, the particle jumps from its site of origin to a different site according to some prescribed law of motion. To keep things general, we allow for non-homogeneous random walks, where the set of accessible sites and the probabilities to reach each one of them can depend on the site of origin. Our only requirement is that the prescribed law of motion is not time dependent, i.e., that the connectivity at each site and its jumping probabilities do not change in time. We will refer to this property as time-homogeneity.

In contrast to classical first-passage problems,^{18–21} in gated problems, the particle stochastically transitions between a reactive state and a non-reactive state such that arrival to the target is not sufficient by itself. To react, the particle must reach the target in the reactive state. We are interested in the statistics of the reaction time, defined to be the first-passage to target while in the reactive state. Our theory yields close formulas for the mean, variance, and the generating function of the probability mass function (PMF) of the reaction time in terms of the corresponding ungated first-passage statistics. It is important to note that we hereby focus on a single particle and a single target, and it is of no matter whether gating occurs on the particle, on the target, or is due to a joint effect. We will thus often remain general and consider “a gated system.” In the case of multiple particles, however, the statistics for gated particles and gated targets do differ.^{2,3,30,36}

In what follows, we use ⟨*X*⟩, *σ*(*X*), and $X\u0303(z)\u2261zX=\u2211n=0\u221eP(X=n)zn$ to denote, respectively, the expectation, standard deviation, and Z-transform of a integer-valued random variable *X*.

### A. Internal dynamics of a two-state system

The internal dynamics of the particle is described by a discrete-time Markov chain composed of two states (Fig. 2): Reactive (R) and Non-Reactive (NR). The transition probability from R to NR is denoted by *p*, and the complementary self-transition probability is denoted by 1 − *p*. Similarly, the transition probability from NR to R is denoted by *q*, and the complementary self-transition probability is denoted by 1 − *q*.

We are interested in P(R, *n*∣*ω*_{0}), the conditional probability to be in the reactive state after *n* steps, given an initial internal state *ω*_{0} ∈ {R, NR, eq}, where “eq” stands for equilibrium. Solving, we obtain ( Appendix A)

where Δ ≔ 1 − *p* − *q* and the equilibrium occupancies of the two states are *π*_{R} = P(R, *n*∣eq) = *q*/(*p* + *q*) and *π*_{NR} = P(NR, *n*∣eq) = *p*/(*p* + *q*). The complementary probabilities to be in the non-reactive state are given by

where Δ = 1 − 2*p* and $\pi R=\pi NR=12$.

### B. The renewal approach

We now set out to find the statistics of the discrete random reaction time $N(x\u20d70)$, which is defined as the number of steps it takes for the particle to react with a target that is placed at the origin. This happens when the particle reaches the origin in the reactive state for the first time. Here, we let $r\u20d70$ denote the particle’s initial position and *ω*_{0} denote its initial internal state, which we jointly denote by $x\u20d70=(r\u20d70,\omega 0)$. Setting $0\u20d7NR\u2261(0\u20d7,NR)$, we consider first $N(0\u20d7NR)$, which is the reaction time of a particle that starts at the origin, albeit in the non-reactive state. We observe that $N(0\u20d7NR)$ can be thought of as a gated first-return time to the origin.

Starting at the origin, the particle can leave and return multiple times, but the overall reaction ends only when the particle arrives at the origin in the reactive state. We can thus write the following renewal equation:

where *N*_{i} is the number of steps the particle takes to return to the origin for the i-th time and

are indicator random variables. Since the walk is Markovian and time-homogeneous, return processes are independent of each other and statistically identical. Thus, {*N*_{1}, *N*_{2}, …} are independent and identically distributed (IID) copies of a generic return time, which we will henceforth denote *N*_{FR} (where “FR” stand for First-Return). Similarly, {*I*_{1}, *I*_{2}, …} are IID copies of a generic indicator, which we will henceforth denote *I*_{FR}. To see that the indicators are IID, recall that the internal dynamics are also taken to be Markovian so that the future internal state depends solely on the current one. Furthermore, note that in the beginning of each return process, the overall state of the system is the same: the particle is at the origin in the non-reactive state (otherwise, reaction would have occurred). Indeed, this is exactly the renewal property that allows for the solution presented below.

### C. Distribution of the reaction time

In principle, Eq. (4) allows us to compute the distribution of $N(0\u20d7NR)$ directly. For example, the probability that $N(0\u20d7NR)=2$ can be found by summing over all possible combinations with this reaction time: *N*_{1} = 2, *I*_{1} = 0 being the first and *N*_{1} = 1, *I*_{1} = 1 followed by *N*_{2} = 1, *I*_{2} = 0 being the second. However, this straightforward approach complicates rather quickly, yielding cumbersome expressions. Instead, we use a trick of the trade and compute the Z-transform, also known as the generating function, of $N(0\u20d7NR)$,

By using the law of iterated expectations,

For a given value of *N*_{1}, the inner expectation in Eq. (7) reads

where we have used the fact that *I*_{1} = 0 with probability P(R, *n*∣NR) and *I*_{1} = 1 with probability P(NR, *n*∣NR). Plugging this result back into Eq. (7), we obtain

We now observe that due to statistical identity of the return processes, $zN2+I2[\u2026]=zN(0\u20d7NR)=N\u0303(0\u20d7NR,z)$. Then, by plugging the relations in Eqs. (1) and (2) into Eq. (9) and rearranging, we get

where *K*_{eq} = *p*/*q* and $N\u0303FR(z)$ is the Z-transform of *N*_{FR}, which was defined below Eq. (5) as the time it takes the particle to return to the origin. This is the first main result of this paper, as it shows that the gated reaction time when starting at the origin at the non-reactive state can be expressed in terms of the corresponding ungated first-return time. Thus, via Eq. (10), the solution of a gated problem is reduced to that of the much simpler ungated problem. We stress that this result is general and holds for any gated reaction in discrete time and space.

In the case of symmetric internal dynamics, *K*_{eq} = 1, Eq. (10) simplifies to

where Δ = 1 − 2*p*. There is an interesting case in which Eq. (11) displays a striking symmetry under the transformation *p* ↦ 1 − *p*, which is here equivalent to Δ↦ −Δ. Consider a situation where return to the origin can only be made in an even number of steps, as happens, for example, in a simple random walk in 1*D*. In this case, $N\u0303FR(z)$ is an even function since all terms with odd powers of *z* vanish in the Z-transform. We thus have $N\u0303FR(\Delta z)=N\u0303FR(\u2212\Delta z)$, which means that $N\u0303(0\u20d7NR,z)$ is itself invariant under the transformation *p* ↦ 1 − *p*. In Sec. IV, we return to this symmetry and its consequences when we treat the problem of a 1D random walk with a gated target.

Now that we have an expression for $N\u0303(0\u20d7NR,z)$, we can generalize to an arbitrary initial condition $x\u20d70=(r\u20d70,\omega 0)$, where we recall that $r\u20d70$ denotes the particle’s initial position and *ω*_{0} its initial internal state. To compute the reaction time, we observe that a particle that starts at $r\u20d70$ must first arrive to the origin. Letting $NFP(r\u20d70)$ denote the first-passage time from $r\u20d70$ to the origin, we now consider what happens next. When arriving at the origin, there are two options: (i) the particle is in the reactive state and a reaction takes place immediately and (ii) the particle is in the non-reactive state and the reaction does not take place. The second scenario brings us back to the situation described and solved above: an additional time $N(0\u20d7NR)$ is required for the reaction to complete. The total reaction time is thus

where *I*_{FP} is defined as in Eq. (5) but for the first-passage rather than return.

We proceed as before: Z-transforming Eq. (12), we obtain

where $N\u0303FP(r\u20d70,z)$ and $N\u0303FP(r\u20d70,\Delta z)$ are the Z-transforms of $NFP(r\u20d70)$ evaluated at *z* and Δ*z*, respectively, $N\u0303(0\u20d7NR,z)$ was defined in Eq. (10), and where

Equation (14) is the second main result of this paper. It shows that the gated reaction time can always be expressed in terms of the corresponding, and much simpler, ungated first-return and passage times. Note that for an equilibrium initial condition of the internal state, *ω*_{0} = eq, the result simplifies considerably as the second row of Eq. (14) vanishes. In addition, when the starting position $r\u20d70$ is far away from the origin, the internal state equilibrates before the particle arrives there and all information on the internal initial condition is lost. Mathematically, this can be seen by observing that $NFP(r\u20d70)$ is then typically very large, making $N\u0303FP(r\u20d70,\Delta z)=(\Delta z)NFP(r\u20d70)$ negligible with respect to $N\u0303FP(r\u20d70,z)=zNFP(r\u20d70)$. Thus, this case is effectively equivalent to that of the equilibrium initial condition.

### D. Mean and variance

The Z-transform is a moment generating function, so the moments of $N(0\u20d7NR)$ can be calculated directly from Eq. (10) by taking derivatives.^{20} Nonetheless, we think that the following independent calculation of the mean of $N(0\u20d7NR)$ is instructive. To find $\u27e8N(0\u20d7NR)\u27e9$, we take the mean of both sides of Eq. (4),

Using the independence of the random variables at hand, we get

Now recalling that the return times are IID, we have ⟨*N*_{i}⟩ = ⟨*N*_{FR}⟩ and ⟨*I*_{i}⟩ = ⟨*I*_{FR}⟩, and thus,

Observe that the probability that the particle returns to the origin in the reactive state is given by ⟨P(R, *N*_{FR}∣NR)⟩ = 1 − ⟨P(NR, *N*_{FR}∣NR)⟩. Thus, on average, the particle returns to the origin $\u27e8P(R,NFR\u2223NR)\u27e9\u22121$ times, with each return taking ⟨*N*_{FR}⟩ time units on average before a reaction occurs. Recalling Eq. (1), we have $P(R,NFR\u2223NR)=\pi R[1\u2212N\u0303FR(\Delta )]$. Plugging this result into Eq. (18) and rearranging, we conclude that

Once again, note that this result is completely general.

In the same manner, one can average Eq. (12) to get

Noting that $IFP=P(NR,NFP(r\u20d70)\u2223\omega 0)$, we can plug in the relevant term from Eqs. (1) and (2) for *ω*_{0} ∈ {R, NR, eq} to calculate the corresponding $IFP$ and plug it into Eq. (20). This gives

where $I\omega 0$ was defined in Eq. (15) and where $N\u0303FP(r\u20d70,\Delta )=\Delta NFP(r\u20d70)$ is the Z-transform of $NFP(r\u20d70)$ evaluated at Δ. Here as well, if the particle starts far enough such that the internal state equilibrates before the particle arrives at the origin, $N\u0303FP(r\u20d70,\Delta )$ is negligible and the mean reaction time in Eq. (21) becomes independent of the initial internal state (clearly, $\Delta NFP(r\u20d70)$ is then typically very small, as |Δ| < 1 for all cases but the redundant cases of *p* = *q* = 0 or *p* = *q* = 1). The result is then equivalent to that obtained in the case of *ω*_{0} = eq and is very intuitive: The first arrival to the origin occurs after $\u27e8NFP(r\u20d70)\u27e9$ on average. With probability *π*_{R}, the first arrival is fertile, so it is also the last one. With the complementary probability, *π*_{NR}, the first arrival is infertile, and the reaction continues for an additional $\u27e8N(0\u20d7NR)\u27e9$ steps on average.

As mentioned in the beginning of this section, we could have reached Eq. (19) by using the fact that the Z-transform in Eq. (10) is, in fact, a moment generating function. For the mean, one employs $\u27e8N(0\u20d7NR)\u27e9=dN\u0303(0\u20d7NR,z)dzz=1$, which reproduces Eq. (10) with little algebra. For the second moment, we have $\u27e8N2(0\u20d7NR)\u27e9=d2N\u0303(0\u20d7NR,z)dz2z=1+\u27e8N(0\u20d7NR)\u27e9$. Recalling $Var(N(0\u20d7NR))=\u27e8N2(0\u20d7NR)\u27e9\u2212\u27e8N(0\u20d7NR)\u27e92$, we obtain

and a result for $Var(N(x\u20d70))$ can be obtained in a similar way.

### E. When the mean diverges

When deriving Eq. (19), we implicitly assumed that ⟨*N*_{FR}⟩ is finite. The expression is, of course, meaningless if ⟨*N*_{FR}⟩ diverges, as in this case, $\u27e8N(0\u20d7NR)\u27e9$ must also diverge. This is easy to see from Eq. (4), which implies that the gated reaction time $N(0\u20d7NR)$ is always larger or equal to the return time *N*_{FR}. Nonetheless, even when the mean diverges, Eq. (10), which gives the Z-transform of $N(0\u20d7NR)$, is still valid and of use. This is not to say that the inverse transformation is a simple task or that the distribution can always be obtained in closed form. Rather, we hereby focus on the long-time asymptotics and show that when the underlying ungated process is controlled by a heavy power-law tail, this tail is inherited by the corresponding gated process. More precisely, we show that the power law remains the same and that the asymptotics differ only in the corresponding prefactor, which is determined exactly.

Consider the ungated process, and let *f*_{0}(*n*) be the PMF of the random variable *N*_{FR}, i.e., *f*_{0}(*n*) is the probability that the first return to the origin occurs exactly after n steps. The survival is defined to be $S(n)=\u2211n+1\u221ef0(n)$, namely, the probability that the particle did *not* return to the origin by step *n*. The following relation between the Z-transforms $S\u0303(z)=\u2211n=0\u221eS(n)zn$ and $N\u0303FR(z)=\u2211n=0\u221ef0(n)zn$ holds:

The derivation of this relation can found in Appendix C of Ref. 37.

Let us now assume that *f*_{0}(*n*) is monotonic (at least asymptotically) with a heavy power-law tail such that for *n* ≫ 1, we have

with 1 < *γ* < 2; note that in this case, ⟨*N*_{FR}⟩ diverges. The asymptotics of the survival function is then given by $S(n)\u2243C\gamma \u22121n1\u2212\gamma $. By applying the Tauberian theorem,^{20} we obtain $S\u0303(z)\u2243C\Gamma (2\u2212\gamma )\gamma \u22121(1\u2212z)\gamma \u22122$ in the limit *z* → 1, where Γ(·) is the Gamma function. Using Eq. (23), we obtain

To emphasize, we have found that if the long-time asymptotics of the first return time is given by Eq. (24), then its Z-transform is given by Eq. (25).

Plugging the result of Eq. (25) into Eq. (10) and taking the limit *z* → 1, we obtain (after some algebra)

Equation (26) is of the same form of Eq. (25), up to a different pre-factor. Thus, their inversions are also the same, up to the same pre-factor,

where *f*_{0,NR}(*n*) is the PMF of the gated reaction time $N(0\u20d7NR)$. We have thus proved that the asymptotic power law of the ungated problem is inherited by its gated counterpart. The pre-factor is changed, however, by a factor of $\pi R\u221211\u2212N\u0303FR(\Delta )$ as can be seen by comparing Eqs. (24) and (27). Note that this is the same factor appearing in Eq. (19).

There is one last subtle point to note here. In Eq. (24), we have assumed that *f*_{0}(*n*) is asymptotically monotonic. In reality, discrete time random walks on networks often possess non-monotonic first-return PMFs. For example, in the simple 1D random walk, return on odd number of steps has zero probability. However, the even sequence {*f*_{0}(2*n*)} is indeed monotonic. In this case, Eq. (24) should be understood as an average of subsequent even and odd steps. Then, *f*_{0}(*n*) is zero for odd *n* and two times the quantity of Eq. (24) for even *n*. Alternatively, one can solve directly for the sequence {*f*_{0}(2*n*)} and obtain the same factor of 2. In more complicated networks, one should be careful and apply similar considerations if needed.

### F. Transient power-law behavior in high crypticity

Let us continue with the exact same scenario of the heavy-tailed *f*_{0}(*n*) given in Eq. (24). However, now let us also assume high crypticity, i.e., *K*_{eq} = *p*/*q* ≫ 1. To study the transition to the long-time asymptotics under the high-cripticity assumption, we take *z* close to 1 in Eq. (10) but keep *K*_{eq} large enough such that $Keq1\u2212N\u0303FR(z)\u226b1$ holds. Using $N\u0303FR(z)$ from Eq. (25), we obtain

Applying the Tauberian theorem gives

Equation (29) means that under high crypticity, there is a transient regime, possibly very long, which is governed by a $\u223cn\gamma \u22122$ power law, before the terminal $\u223cn\u2212\gamma $ asymptotics enters. It is interesting to note that by using Euler’s reflection formula, Eq. (29) can be re-written as

where we have denoted *x* ≔ *γ* − 1 such that 0 < *x* < 1. We can thus easily see that the pre-factor is maximized for the case *x* = 1/2 (which corresponds to *γ* = 3/2) and that it decreases toward zero for both larger and smaller values of *x*, but in an asymmetric manner, as the sine function is multiplied by *x*.

## III. EXAMPLE: GATED REACTION WITH UNIDIRECTIONAL MOTION ON A RING

To illustrate the framework developed above, consider the following problem: A particle is bound to a ring lattice of *N* sites. The particle’s motion is unidirectional, namely, at every time step, the particle takes one step clockwise. In addition, the particle switches between a reactive (red) and non-reactive (blue) states as illustrated in Fig. 3. Starting the particle at the origin, in the non-reactive state, we are interested in the gated reaction time, namely, the time it takes the particle to return to the origin in the reactive state.

Recall that in Sec. II F we showed that the statistics of the gated reaction time $N(0\u20d7NR)$ can be expressed in terms of the corresponding ungated reaction time *N*_{FR}, i.e., the first return time to the origin. Specifically, in the case considered above, calculation of the ungated reaction time is extremely simple. Since the particle’s motion is unidirectional, it will return to the origin after taking exactly N steps. In other words, we have ⟨*N*_{FR}⟩ = *N* and Var(*N*_{FR}) = 0, which means $N\u0303FR(\Delta )=\Delta N$. The mean of the gated reaction time, which is less trivial, now follows directly from Eq. (19),

which for the symmetric case, *p* = *q*, boils down to

A few interesting features can be deduced from Eq. (31). For −1 < Δ < 1, we have $\u27e8N(0\u20d7NR)\u27e9\u2192\pi R\u22121N$ as *N* → *∞*. To understand this, observe that when *N* is large enough, the internal state has enough time to equilibrate within a single revolution of the ring. Thus, the probability to find the particle in the reactive state when it returns to the origin is the equilibrium probability *π*_{R}. For example, when *p* = *q*, we have $\pi R=1/2$ and so $\u27e8N(0\u20d7NR)\u27e9\u21922N$. Thus, on average, the particle misses the target in half of its returns, yielding a mean reaction time that is twice that of the ungated problem. Note that this limit is independent on the value of Δ and that it can give a fair approximation for $\u27e8N(0\u20d7NR)\u27e9$ even for moderate values of *N*. This is illustrated in Fig. 4, where we compare numerical simulations with theory for the symmetric, *p* = *q*, case. Observe that $\u27e8N(0\u20d7NR)\u27e9\u22432N$, except for extreme values of *p*, where this approximation is expected to break.

The mean gated reaction time displays clear parity effects with regard to the size of the ring. This happens because the internal gating dynamics can be in, or out of, phase with the molecular encounters of the particle with the target, thus leading to resonance and anti-resonance effects. For example, in the symmetric case illustrated in Fig. 4, two distinct behaviors arise in the limit *p* → 1: (i) If *N* is even, the mean reaction time diverges. Indeed, for *p* = 1, the particle changes its internal state with every step, and given that it started non-reactive, it is sure to return to the origin non-reactive. (ii) On the contrary, when *N* is odd, the mean reaction time approaches *N* because the particle is almost sure to transition to the reactive state as it steps back into the origin at the end of a revolution. The same effect is apparent in Figs. 5(a) and 5(b), where either *q* or *p* is set constant to a high value of 0.9 and the other parameter is swept across the unit interval. As this parameter approaches 1, we reach a scenario in which both *p* and *q* are large and similar parity effects are observed.

An interesting scenario is that of Fig. 5(c), where *q* is set to the low value of 0.1. If *p* is also low, once the particle becomes reactive, it will stay that way for a long time. We thus observe a mean reaction time that corresponds to the number of revolutions needed for the particle to become reactive for the first time. However, as *p* increases, it becomes much more likely that the particle reverts back to the non-reactive state before completing a revolution. As a result, the mean reaction time is greatly prolonged. In Fig. 5(a), we set *q* to a high value of 0.9 and the effects are much less pronounced: When *p* is low, the mean reaction time tends to the size of the ring, as it is very likely that the particle will become reactive within the first revolution and stay that way. As *p* is increased, we again have the same effect of prolonged reaction times but to a lesser extent [note differences in slopes compared to Fig. 5(c)].

Finally, in Fig. 5(d), we set *p* = 0.1 and vary *q*. When *q* → 0, the probability to leave the initial non-reactive state vanishes and the mean reaction time diverges. When *q* → 1, the particle transitions from the non-reactive state to the reactive state very frequently relative to the opposite transition, and it thus highly likely to arrive reactive at the end of the first revolution.

We can also obtain the PMF of the reaction time when starting on the target in the non-reactive state. By plugging $N\u0303FR(z)=zN$ in Eq. (10), we obtain

By denoting *ζ* = *z*^{N} and recalling Eq. (1), P(R, *n*∣NR) = *π*_{R}(1 − Δ^{n}), we can rewrite Eq. (33) as

which is a Z-transform of a geometric distribution evaluated at *ζ*. Here, the success probability is P(R, *N*∣NR), as each geometric trial is equivalent to a full revolution of *N* steps. To understand this result, we observe that the particle returns to the target every *N* steps. The probability of the particle to be reactive on return is exactly P(R, *N*∣NR). If the particle is reactive on return, then the walk is over. However, if it is non-reactive, the process is renewed and again the probability to be reactive in the next revolution is P(R, *N*∣NR). This is indeed a geometric distribution.

In fact, because the *N*_{FR} is deterministic, the gated problem is effectively reduced to that of a radiating boundary condition, i.e., following each revolution, there is a constant probability of reacting. We stress that this reduction is not due to equilibration of the internal state but rather due to the deterministic return time. This, of course, makes the gated problem considerably easier to solve, but our formalism also allows us to treat cases where the return time fluctuates. For such cases, the reduction above is impossible (unless internal state equilibrium is certain to be reached between any two consecutive returns to the target). In Sec. IV, we consider a problem in which not only that the return time fluctuates — it varies so greatly that the mean return time diverges.

## IV. EXAMPLE: SYMMETRIC RANDOM-WALK ON A SEMI-INFINITE INTERVAL WITH A GATED BOUNDARY

Consider a random walk on a semi-infinite one-dimensional lattice with a two-state gated boundary as depicted in Fig. 6. Assuming that the particle starts at an initial location *x*_{0}, we are interested in the first-reaction time PMF, namely, the probability distribution of its first-return (or passage) to the origin while in the reactive state.

The conventional way in which one would approach such a problem is by writing and solving the master equation for *C*_{i}(*x*, *n*), the probability that the boundary is at state *i* ∈ {R, NR}, and the particle is at position *x* after *n* steps. The master equation for the bulk lattice sites reads

while the equations for the boundary (*x* = 0) and near boundary (*x* = 1) sites are given by

These equations are supplemented by an initial condition. For example, if we assume that the particle starts at the boundary (*x*_{0} = 0) in the non-reactive state, we have *C*_{R}(*x*, 0) = 0 and *C*_{NR}(*x*, 0) = *δ*_{x,0}.

Although doable, solving the above set of equations brute force is a laborious task. To demonstrate this, we present a solution for the symmetric case, *p* = *q*, in Appendix B. In the following, we instead note that the problem of a gated boundary is completely equivalent to the problem of gated particle switching between a reactive state and non-reactive state. We can thus evoke the results derived in Sec. II and calculate the generating function of the first-reaction time by a simple “plug and play” method.

### A. Applying the renewal approach

To calculate the gated reaction time using Eq. (10), we require the Z-transform of the ungated first return time *N*_{FR}. This is known to be given by^{20}

where

is the probability that a symmetric random walker that started at the origin returns to the origin for the first time at the n-th step.

Substituting Eq. (37) into Eq. (10), we immediately obtain the Z-transform of the gated reaction time,

In Appendix C, we show how Eq. (39) can be inverted to find *f*_{0,NR}(*n*), the probability that a reaction occurs exactly after *n* steps where the walker starts on the boundary in the non-reactive state. In the symmetric case, *K*_{eq} = 1, we find

where

and

Exact formulas for the case *K*_{eq} ≠ 1 are given in Appendix C.

Equation (40) gives the full distribution of the gated reaction time, but since it is given in the form of a convolution, it is hard to extract insight from it directly and without further analysis (one might say it is convoluted). Of main interest is the long-time asymptotics, which can instead be readily obtained by utilizing the fact that the gated asymptotics inherits the ungated asymptotics.

For the ungated problem, by use of the Stirling approximation in Eq. (38), an asymptotic behavior $f0(n)\u22432\pi n\u22123/2$ is obtained for the even step sequence, while the probability of return on an odd step is zero. Averaging subsequent even and odd steps, we get an average asymptotic behavior of $f0(n)\u223c12\pi n\u22123/2$.^{20} Note that the mean of the first return time *N*_{FR} diverges and that the same is true for all its higher order moments. To obtain the gated problem asymptotics, all we need to do is identify $C=12\pi $ and *γ* = 3/2 in Eq. (24) and to substitute them, along with $N\u0303FR(\Delta )=1\u22121\u2212\Delta 2$, into Eq. (27). We then get, without any further calculation, that the average asymptotic behavior for the gated problem is

where we have defined

As expected, Eq. (43) asserts that the mean of the gated reaction time diverges along with all its higher moments.

### B. The case of symmetric internal dynamics

In Fig. 7, we provide some realizations of the gated reaction depicted in Fig. 6. We focus on the symmetric case *p* = *q*. It can be seen that for *p* = 0 and *p* = 1, a reaction will never occur, albeit for completely different reasons. In the former case, the probability to transition to the reactive state is zero, and since the walker starts in the non-reactive state, it simply stays in it. In the latter case, the walker is sure to switch internal states with every step it takes such that it is in the reactive state for odd number of steps and in the non-reactive state for even number of steps. Furthermore, it is generally true that the walker can return to the origin only after taking an even number of steps. Thus, the walker will never arrive there in the reactive state. We thus conclude that for *p* ∈ {0, 1}, we have *f*_{0,NR}(*n*) = 0 and, equivalently, that the survival probability is *S*(*n*) = 1 for all *n*.

To better understand what happens for *p* ∈ (0, 1), we set *p* = *q* in Eq. (43) to obtain (N.B. averaged subsequent even and odd steps)

which corresponds to a survival probability of

The asymptotics of Eq. (45) is corroborated in Fig. 8 for even *n*. To do so, we multiply the averaged result in Eq. (45) by a factor of 2 since *f*_{0,NR}(*n*) = 0 for odd *n*.

It is evident from Eqs. (45) and (46) that there is a complete symmetry about *p* = 0.5 in terms of the first-passage and the survival probabilities. Indeed, in Sec. II, we have derived a general expression for $N\u0303(0\u20d7NR,z)$ for the case of symmetric internal dynamics, given by Eq. (11). In a short discussion below that equation, we have shown that when return to the origin is possible only on an even number of steps, the reaction time is invariant under the transformation *p* → 1 − *p*. The case under consideration here fulfills this criterion, and one can easily verify that this symmetry holds for all *n*. This is illustrated in Fig. 9(a), where we calculated the reaction time probability after *n* = 2, 20, 50, and 100 steps for different values of *p*. Interestingly, the reaction time probability function obtains two maxima at optimal transition probabilities *p** and 1 − *p**, which depend on *n*. As we explain below, this feature arises due to a certain resonance between the internal gating dynamics and the spatial dynamics, which governs molecular encounters of the particle with the target at the origin.

As *n* becomes large, *p** tends to zero and the existence of its corresponding maximum becomes more pronounced. Note that the curvature is very different to the left and right of the optimal transition probability *p**. To the left, there is a rapid drop in reaction probability. To the right, the decrease in reaction probability is quite moderate. Of course, a mirror image is obtained for the maximum point at 1 − *p**, thus creating a “safe zone” around *p* = 0.5. While transition probabilities in this zone are not optimal, they still provide relatively high values for the reaction probability regardless of the specific value of *n*. This is interesting as it highlights an inherent trade-off between point-optimization and robustness in our problem. If one ever finds applications of this model in biological systems, it would be interesting to check whether evolution tuned the system to work with *p** where small deviations from the optimum could decimate the probability to react or rather in the safe zone that is fairly robust to changes in parameters.

We find that *p** is inversely proportional to *n*. The exact proportionality factor can easily be determined by numeric maximization of Eq. (40), but let us give instead the following heuristic estimation. To increase the likelihood of a reaction occurring, we want to choose a transition probability *p* that maximizes the probability of the particle to be reactive upon return to the origin. Focusing on situations where a return occurs exactly after *n* steps, it makes sense to try and time things such that this return falls in the middle of a reactive period. As the transition probability is *p*, the average length of a reactive period is 1/*p*, and one would want to maximize this duration to ensure that the reactive period covers the return time despite stochastic fluctuations. Naively, this could be done by taking *p* to zero. However, recall that the particle starts in the non-reactive state and that transitioning to the reactive state takes 1/*q* units of time on average. As we have assumed *p* = *q*, it is clear that *p* = 3/2*n* is the smallest transition probability for which the return, on average, occurs in the middle of a reactive period [Fig. 9(b) inset]. In Fig. 9(b), we show that this intuitive argument approximates *p** to a surprising accuracy, leaving just a mere $\u223c3%$ systemic relative error for large *n*.

### C. Additional interesting cases

So far, we have only discussed the intriguing symmetric case of *p* = *q*. This case eloquently reveals new features that are not observed in the analogous continuous-time problem and that are, in fact, due to the discretization of time. However, as mentioned above, we have also solved the problem for any choice of *p* and *q*, and we refer to Appendix C for the inversion of Eq. (39). In previous continuous-time works, it was shown that for a certain range of transition rates, an interesting transient behavior can be observed.^{26,34} In this so-called “cryptic regime,” the transition rate from the non-reactive state to the reactive state is low with respect to the rate of the reversed transition. Markedly, there is a prolonged transient regime governed by a $\u223ct\u22121/2$ power law before the known $\u223ct\u22123/2$ asymptotics kicks in. The analogous $\u223cn\u22121/2$ cryptic regime can also be observed here by taking *p* ≫ *q*.

Indeed, to obtain the gated problem transient behavior under high-cripticity, all we need to do is identify $C=12\pi $ and *γ* = 3/2 in Eq. (24) and to substitute them, along with $N\u0303FR(\Delta )=1\u22121\u2212\Delta 2$, into Eq. (29) to obtain

where we understand this result as an average of subsequent even and odd steps. Since *f*_{0,NR}(*n*) = 0 for odd *n*, the result for the even sequence is two times that given in Eq. (47).

Finally, note that we have only considered here the case in which the particle is initially on the target in the non-reactive state. However, plugging the result in Eq. (39) into Eq. (14), one can solve for any initial condition. As in the continuous-time analog,^{34} a bi-modal reaction time distribution can be observed when the particle starts away from the target in the reactive state and for the right choice of *p* and *q*. We trace this effect to the existence of two populations of particles: those that reached the origin and reacted without ever switching to the non-reactive state and those that switched to the non-reactive state prior to reaching. As the latter are blocked from reacting for 1/*q* steps on average, two distinct peaks are formed when this time period is taken to be much larger than the median return time to the origin.

### D. General perspective on gated 1D random walks and reactions

To put the example solved above in its right context, we offer a very brief review of previous works on gated 1D diffusion and random walks. Specifically, while a lot of work has been dedicated to the classical random walk in discrete space and time, it seems that the gated version of the corresponding first-passage and return problems was first solved here. With that said, solutions to the gated problem in continuous time and space and in continuous time and discrete space have been presented before, and in the following, we will review these cases for comparison.

#### 1. Continuous time and space

In his work on coagulation, Smoluchowski was the first to build a model where diffusive transport is the rate limiting step of the reaction kinetics. To find this so-called diffusion-controlled reaction rate, Smoluchowski solved for the flux of particles, initially uniformly distributed in an infinite pool of particles, into a 3D spherical symmetric sink fixed to the origin.^{38} Many excellent reviews have been written on Smoluchowski’s model and its generalizations.^{31,32,39,40}

Although here we consider the first-passage to the boundary of a single-particle diffusing on the semi-infinite line, the treatment of the boundary is essentially the same. The solution can be obtained by solving the diffusion equation with an absorbing boundary condition *c*(0, *t*) = 0, where the first-passage distribution through the origin is given by the flux to the origin $f(0,t)=D\u2202c(x,t)\u2202x|x=0$. The equation is supplemented with the delta initial condition *c*(*x*, 0) = *δ*(*x*_{0}). Note that here *x*_{0} = 0 is the trivial case in which the particle is immediately absorbed. Solving for *x*_{0} > 0, one gets a heavy-tailed distribution $fabs(0,t)=x04\pi Dt3e\u2212x02/4Dt$, with an asymptotic behavior of $\u223cx0t\u22123/2$ in the long-time limit.^{19}

In their seminal paper on diffusion-controlled reaction rates, Collins and Kimball extented Smoluchowski’s model to allow for the case in which the target is reactive only in a fraction of the visits, leading naturally to a radiating (partially absorbing) boundary condition $D\u2202c(x,t)\u2202x|x=0=\kappa c(0,t)$.^{41} When *κ* = 0, there is zero flux through the origin, i.e., a reflecting boundary. Similarly, if *κ* is taken to be very large, the absorbing boundary condition is restored. The corresponding single-particle model was solved by Sano and Tachiya for several cases of practical interest.^{42} Surprisingly enough, only recently Pal, Castillo, and Kundu conducted a comprehensive study on diffusion in finite and semi-infinite 1D intervals, where analytical expressions for the probability density of the particle displacement and its first-passage distribution were computed.^{43}

A subtle point to notice is that gating is implicit in the radiating boundary condition. Indeed, consider a gate for which the internal dynamics is much faster than the time between consecutive particle-target collisions. In this case, the time it takes for the internal gating state to reach equilibrium can be neglected, and the probability of the system to be in a reactive state when a collision occurs is always the equilibrium fractional population *π*_{R}. Thus, the partially absorbing case can be thought of as a special case of the gated problem.

Recently, the gated version of diffusion on the 1D infinite line was solved for the survival probability.^{26} Notably, it was shown that when the transition rate from the non-reactive state to the reactive state is much lower with respect to reversed transition rate, there is an intermediate regime governed by a power law $\u223ct\u22121/2$, before the known $\u223ct\u22123/2$ asymptotic kicks in. In Sec. II, when exploring transient behavior in high crypticity, we showed that this result is not limited to 1D diffusion as it extends to a large class of gated reactions in discrete time and space via Eq. (29).

#### 2. Continuous time and discrete space

Here, the underlying random walk process can be formulated using the framework of the CTRW.^{20} For waiting times with a finite mean, one can show that the probability density of the first-passage time to the origin follows *f*(*x*_{0}, *t*) ∼ *νt*^{−3/2}, where *ν* is some pre-exponential that depends on the initial location and the hopping rate of the random walker. The gated counterpart of this problem was solved.^{12,13,34} Specifically, it was shown that the ungated problem and its gated counterpart share the same power law in the asymptotic behavior, while differing only in the pre-exponential factor (the gated pre-exponential is dependent also on the internal dynamics). Here and in a previous work^{34} we proved that this is a universal feature of gating in discrete time and in the CTRW, which extends beyond 1D problems and onto general networks in arbitrary dimensions.

## V. SUMMARY

Stochastic gating, i.e., the random switching of molecules between reactive and non-reactive states, poses a barrier to the understanding and proper description of reaction kinetics. To overcome this, we presented a unified approach to gated reactions in discrete time and space. We showed that one can always express the distribution of the gated reaction time in terms of ungated first-passage and return times. Thus, instead of solving directly for the gated reaction time, which can be extremely difficult even for relatively straightforward scenarios, one can instead apply an indirect, but much simpler, solution algorithm. Given a network of interest, and the time-independent laws that govern stochastic motion on this network, act as follows to obtain the distribution of the gated reaction time:

Obtain the distribution of the

*ungated*first-passage time $NFP(r\u20d70)$, i.e., the number of steps a particle takes to go from its starting position $r\u20d70$ to a target whose position is set to the origin (by convention and without loss of generality).Obtain the distribution of the

*ungated*first-return time to the origin*N*_{FR}, i.e., the number of steps that a particle, which starts at the origin, takes to get back to the origin.Compute the generating functions of the

*ungated*first-passage and return times: $N\u0303FP(r\u20d70,z)=zNFP(r\u20d70)$ and $N\u0303FR(z)=zNFR$, respectively. Note that in many cases, it is actually easier to obtain these functions directly, thus bypassing computation of the first-passage and return distributions. One can then skip the first two stages.Substitute $N\u0303FR(z)$ into Eq. (10) to obtain the generating function of the

*gated*reaction time $N(0\u20d7NR)$, i.e., the total time it takes for the particle to react, given that it started from the origin in the non-reactive state.Substitute $N\u0303FP(r\u20d70,z)$, $N\u0303FR(z)$, and Eq. (10) into Eq. (14) to obtain the generating function of the

*gated*reaction time $N(x\u20d70)$, i.e., the total number of steps it takes for the particle to react, given that it started from an arbitrary initial condition $x\u20d70=(r\u20d70,\omega 0)$, where $r\u20d70$ stands for the particle’s initial position and*ω*_{0}stands for its initial internal state, which can be reactive or non-reactive.

As we have shown, the mean, variance, asymptotics, and additional properties of the gated reaction time can all be extracted from the generating functions in Eqs. (10) and (14).

We stress that the gated reaction times in Eqs. (10) and (14) depend on the probabilities *p* and *q*, which govern stochastic transitions between the reactive state and the non-reactive state as depicted in Fig. 2. This dependence is manifested not only via the internal equilibrium constant *K*_{eq} = *p*/*q* and occupancies *π*_{R} = *q*/(*p* + *q*) and *π*_{NR} = *p*/(*p* + *q*) but also via Δ = 1 − *p* − *q* that governs the rate of internal-state equilibration by Eqs. (1) and (2). From a physical stand-point, this can be traced back to the fact that the probability to react upon a particle-target encounter is not constant, but rather time dependent. Indeed, replacing the probability to react with the equilibrium probability to be reactive is an approximation that fails to take into account correlations between consecutive particle-target encounters. hence the need for the fully fledged theory of gated reactions that was developed here and in previous work.^{34}

The implementation of the solution algorithm presented above clearly hinges upon prior knowledge or computation of the ungated first-passage and return times. Luckily, these are known analytically in cases of particular interest,^{19–21} and newly made discoveries add to this knowledge routinely.^{44} Relating gated reaction times to their ungated counterparts, the framework developed herein extends our knowledge on the long studied topic of first-passage. Importantly, all the results obtained apply beyond the context of chemical reactions and could, e.g., be used to analyze analogous scenarios that arise when considering a search of stochastically gated targets^{27,28} and to the problem of first-detection with intermittent sensing.^{17}

## ACKNOWLEDGMENTS

The authors thank Ofek Lauber Bonomo for commenting on early versions of this manuscript. The authors thank an anonymous reviewer for suggesting a calculation that led to the addition of a subsection dedicated to the transient power-law behavior in the limit of high crypticity. S.R. acknowledges support from the Israel Science Foundation (Grant No. 394/19).

## AUTHOR DECLARATIONS

### Conflict of Interest

The authors have no conflicts to disclose.

## DATA AVAILABILITY

The data that support the findings of this study are available within the article and its appendixes.

### APPENDIX A: DERIVATION OF EQS. (1) AND (2)

Based on the Markov chain model in Fig. 2, we define the transition probability matrix (the stochastic matrix) as

Note that $v1=[qp1]T$ and $v2=[\u221211]T$ are the eigenvectors of the transition matrix, with eigenvalues *λ*_{1} = 1 and *λ*_{2} = 1 − *p* − *q* ≡Δ, respectively.

The conditional probability distributions to be in each of the states after *n* steps, given *ω*_{0} = NR, can be calculated by applying the transition matrix n times to $[01]T$,

Hence,

where $\pi R=qp+q$ and $\pi NR=pp+q$.

In the exact same manner, we can consider the case *ω*_{0} = R, i.e., the initial distribution is described by $[10]T$, and we have

Hence,

### APPENDIX B: DIRECT SOLUTION OF EQ. (35) FOR THE SYMMETRIC CASE

Here we denote the reactive state (R) by a subscript 1 and the non-reactive state (NR) by a subscript 2, where the transition probabilities between these states are described in Fig. 2. We also keep the definition Δ ≔ 1 − *p* − *q* of the main text. Later on, we will assume *p* = *q* in a carefully chosen place, which will greatly simplify the calculation.

#### 1. Master equations for the bulk sites

The master equation for the bulk sites—Eq. (35) of the main text—is given by

where *C*_{i}(*x*, *n*) is the probability that the boundary is at state *i* ∈ {R, NR} and the particle is at position *x* after *n* steps. Z-transforming, we get

Now, we can simplify the left-hand sides by invoking the initial condition, *C*_{R}(*x*, 0) = 0 and *C*_{NR}(*x*, 0) = *δ*_{x,0}. Doing so, we get

where $C\u0303i(x)$ is the Z-transform of *C*_{i}(*x*, *n*). Inserting Eq. (B3) back into Eq. (B2) we obtain

where we observed that *δ*_{x,0} = 0 for all bulk sites. Adding and subtracting the two equations above, we get

where $C\u0303\xb1(x)=C\u03031(x)\xb1C\u03032(x)$ and **where we have assumed symmetric internal dynamics***p* = *q***such that****Δ = 1 − 2 p**. Guessing

*C*

_{+}(

*x*) =

*Aω*

^{x},

The possible solutions are

However, the *ω*_{1} solution diverges with *x*, so we retain only the *ω*_{2} solution,

Similarly, guessing *C*_{−}(*x*) = *Bω*^{x}, yields

Once again, the *ω*_{1} solution diverges with *x*, so we retain only the *ω*_{2} solution. Summarizing,

so that

Setting *p* = *q* = 1 (then Δ = −1), we know that *C*_{1}(*x*, *n*) must vanish for all sites where *x* is even and that *C*_{2}(*x*, *n*) must vanish for all sites where *x* is odd. It follows that

Hence,

#### 2. Master equations for the boundary sites

Sites *x* = 0 and *x* = 1 are governed by different equations that reflect the boundary conditions. For the reactive state, we have

and

Similarly, for the non-reactive state [N.B. the initial condition *C*_{2}(*x*, 0) = *δ*_{x,0}],

and

#### 3. Overall solution

and

By assuming *p* = *q*, we already know from the equations of the bulk the forms of $C\u03031(2)$ and $C\u03032(2)$ up to the factor *A*(*z*). Thus, in Eqs. (B21) and (B22), there are three unknowns: *A*, $C\u03031(1)$, and $C\u03032(1)$. For the third equation, we use the Z-transform of the master equation for site *x* = 2 in the reactive state,

where we know that $C\u03031(2)$, $C\u03031(3)$, and $C\u03032(3)$ are set by the bulk solutions. Hence, Eq. (B23) is another equation for the unknowns *A*, $C\u03031(1)$, and $C\u03032(1)$. Overall, we have three equations for three unknowns: by solving (N.B. *p* = *q*), we obtain

the equations for sites *x* ≥ 1,

and the expression for the non-reactive boundary [from Eq. (B19)],

Note that indeed as *z* → 0, we get $C\u03032(0)\u21921$.

#### 4. First-passage PMF

For *x* = 1, Eq. (B25) becomes

We can rewrite *ϕ*(*z*) as

Using Newton’s generalized binomial theorem,

Expanding the binomial coefficient using the identity $1/2k=2kk(\u22121)k+122k(2k\u22121)$, we get

Inverse Z-transform gives

Similarly, using Newton’s generalized binomial theorem on Φ(*z*), we get

Inverse Z-transform gives

Note that the inverse transform of Φ(Δ*z*) is given by Δ^{n}*h*(*n*).

The inverse Z-transform of $C\u03031(1)$ and $C\u03032(1)$ can be calculated using the convolution theorem,

Note that if *n* is even both *C*_{1}(1, *n*) and *C*_{2}(1, *n*) are zero, since starting at *n* = 0 at *x* = 0, there is no way of being at *x* = 1 at even *n*. Now, to get the first-passage PMF, all we need to do is consider the probability to be at *x* = 1 at *n* − 1 and jump to *x* = 0 while being, or switching into, the reactive state in the n-th step,

which after some algebra can be shown equivalent to Eq. (40) in the main text.

#### 5. First-passage long-time asymptotic

The Z-transform of the survival probability is given by

Plugging in $C\u0303+(0)$ and *A*, we get

Taking the limit *z* → 1,

Invoking the Tauberian theorem, the survival probability is

Accordingly,

Note that the asymptotic behavior above gives an average between consecutive even and odd steps. In fact, the probability of returning to the origin in an odd number of steps is zero, and the probability of returning to the origin in an even number of steps is double of what is written in Eq. (B41). This point was further discussed in the main text.

### APPENDIX C: INVERSION OF EQ. (39) IN THE MAIN TEXT

The equation we want to invert is Eq. (39) of the main text,

#### 1. The case of *K*_{eq} = 1

Note that *K*_{eq} = 1 implies *p* = *q*. Our equation then simplifies to

Let us denote

and the denominator of Eq. (C2) as

where in the last equality we have used *p* = *q*. For completeness, let us denote the numerator of Eq. (C2) as

Now note that if we can inverse Z-transform *ψ*(*z*) and *χ*(*z*) independently, we will be able to inverse Z-transform Eq. (C2) by using the convolution theorem.

Using Newton’s generalized binomial theorem,

and using the identity $1/2k=2kk(\u22121)k+122k(2k\u22121)$, we rearrange to obtain

We thus have

Inverse Z-transform gives

Similarly, we have

Inverse Z-transform gives

By using the convolution theorem, we have the inverse of Eq. (C2),

#### 2. The case when *K*_{eq} ≠ 1

Let us multiply both the numerator and denominator of Eq. (C1) by $1\u2212(z\Delta )2\u2212Keq1\u2212z2$ to get

Using the same notation for *χ*(*z*) = Φ(Δ*z*) − Φ(*z*) as before and defining *η*(*z*) = Φ(Δ*z*) − *K*_{eq}Φ(*z*), we rewrite Eq. (C13) as

Now note that if we can inverse Z-transform *χ*(*z*), *η*(*z*), and *ξ*(*z*) independently, we will be able to inverse Z-transform Eq. (C14) by using the convolution theorem.

We already know the inverse of *χ*(*z*) from Eq. (C9), and the inverse of *η*(*z*) can be calculated in the same manner to give

We are left with the task of computing the inverse of *ξ*(*z*). Assuming *K*_{eq} ≠ 1, we now do some algebraic manipulations,

Let us now denote $A=Keq2\u2212\Delta 2$ and $B=Keq2\u22121Keq2\u2212\Delta 2$. We can then write

and expanding the two terms in the parentheses,

and so its inverse is given by