In this communication, we show that the residence time of a Brownian particle, defined as the cumulative time spent in a given region of space, can be optimized as a function of the diffusion coefficient. We discuss the relevance of this effect to several schematic experimental situations classified in nature—random or deterministic—both of the observation time and of the starting position of the Brownian particle.

Among the numerous features of stochastic processes, the time it takes a random walker to reach a target—the so-called first-passage time (FPT)—is a crucial quantity that governs a variety of physical systems.^{1–5} Indeed, numerous real situations ranging from (sub)diffusion limited reactions^{6,7} to animals searching for food^{8,9} can be rephrased as first-passage problems. In all these situations, the FPT is a limiting quantity, whose optimization is a crucial issue.

Very often, however, the reaction process is not infinitely efficient, so that the relevant quantity which has to be optimized is not the FPT to the target itself, but rather the residence time of the random walker in the vicinity of the target.^{10} The importance of this observable, defined as the cumulative time spent by the random walker in a given subdomain centered on the target up to a fixed observation time (see Fig. 1), comes from the fact that it can be seen as a measure of the interaction time between the random walker and the target. The study of the statistics of this general quantity has been a subject of interest for long, both for mathematicians^{11–13} and physicists.^{10,14–24} As a matter of fact, the residence time has proven to be a key quantity in various fields, ranging from astrophysics,^{25} transport in porous media,^{26} and diffusion limited reactions.^{10,14,27}

The question we address here is to determine how the residence time depends on transport properties of the random walker, and more precisely on its diffusion coefficient. As we proceed to show, this dependence is nontrivial, and in some situations it is possible to tune the value of the diffusion coefficient in order to maximize the residence time.

To get an intuition of this effect, let us start with a simple analysis of the problem. Each time the random walker enters the interaction zone of typical size $r$, it spends inside a typical time of order $r2/D$, which is a decreasing function of the diffusion coefficient $D$. On the other hand, after an observation time $t$, the number of times the interaction zone has been visited is an increasing function of $D$, and behaves like $Dt/r2$ in dimension 1, $ln(Dt/r2)$ in dimension 2, and like a constant in dimension $d\u22653$ in the long time limit $t\u2192\u221e$.^{13} For a walker starting from the exterior of the interaction zone, it is thus clear that both limits of small and large diffusion coefficient $D$ lead to a small residence time, indicating the existence of a maximum as a function of $D$. However, it has to be noted that the observation time has to be *finite* to make this optimization possible. Indeed, the mean residence time $\mu $ goes to infinity with the observation time in dimension $d\u22642$, and tends to a constant divided by $D$ in dimension $d\u22653$, which is a decreasing function of $D$.

With the exception of Ref. 28—which only deals with a one-dimensional situation in the context of DNA/protein interactions—the dependence of $\mu $ on $D$ does not seem to have received much attention so far, probably for two reasons. First, in most of the calculations of residence times, the diffusion coefficient is taken fixed ($D=1/2$ in the mathematical literature, $D=1$ in Ref. 29). Second, the observation time is generally taken to be infinite or at least large in explicit determinations of residence times (see, for instance, Sec. III of Ref. 29), which, as mentioned above, does not permit to reveal the nonmonotonic behavior we are looking for.

In the following, we focus on the generic case of a Brownian particle evolving in a three-dimensional space, and discuss three “experimental” situations, potentially relevant to different problems of chemical reactivity: (i) the observation time is a deterministic variable; (ii) the observation time is a random variable; (iii) both the observation time and the starting position of the particle are random.

We denote by $R$ the initial position of the particle and $r$ the radius of the target, assumed to be a sphere centered at the origin $O$, and study the probability density function $Pt(T)$ of the residence time $T$ after an observation time $t$. Following Kac,^{11} we introduce the following trapping problem: we assume that the Brownian particle disappears on the target with a constant and uniform rate $k$. The survival probability $S(t)$ after an observation time $t$ can be written in two different ways. First, it is defined as

where $e\u2212kt\u2032$ represents the survival probability at time $t\u2032$ conditioned by the fact that the particle has spent a time $t\u2032$ in the reactive zone. Second, it is easy to see that $S$ satisfies the backward Fokker–Planck equation^{2}

where $H(x)=1$ if $x>0$ and 0 otherwise and the Laplacian $\Delta R$ involves derivatives with respect to the starting point $R$ and $R\u2261|R|$. This partial differential equation has to be completed by the initial condition $S(t)\u21921$ if $t\u21920$ and the boundary condition $S(t)\u21921$ if $R\u2192\u221e$. Denoting by $S\u0302(s)=\u222b0\u221ee\u2212stS(t)dt$ the Laplace transform of the survival probability and Laplace transforming Eq. (2), it is easily seen that if the starting point $R$ is exterior to the sphere of radius $r$,

while if $R$ is interior,

where constants $A$ and $B$ are given by continuity conditions of the survival probability and of its first spatial derivative at $R=r$, $K\nu $ and $I\nu $ stand for modified Bessel functions and the space dimension is $d$. Note that in Eqs. (3) and (4), only one of the two Bessel functions $Id/2\u22121$ and $Kd/2\u22121$ generating the set of solutions appears in order to fulfill boundary conditions when $R\u21920$ and $R\u2192\u221e$. In our case $d=3$, it is explicitly found that if the starting point is exterior to the sphere of radius $r$,

while if it is interior,

The Laplace transform $\mu \u0302(s)$ of the mean residence time $\mu (t)$ is then obtained by expanding Eqs. (5) and (6) as a function of the parameter $k$, since $S\u0302(s)$ writes

If the starting point is exterior to the sphere of radius $r$, the small $k$ expansion of Eq. (5) leads to

while if the starting point is interior to the sphere of radius $r$, the small $k$ expansion of Eq. (6) leads to

*Deterministic observation time*. In the first case of a deterministic observation time $t$, corresponding for instance to a chemical reaction designed to be terminated after a time $t$, it is actually possible to Laplace invert the transform of the mean residence time. Using the two known Laplace inverts

where $L\u22121$ stands for the inverse Laplace operator and $erf(x)$ is the error function, a direct Laplace inversion of Eqs. (8) and (9) gives the explicit expression

where

Note that in the limit of large observation times $t\u2192\u221e$, this expression reduces to the known results of Ref. 29: $\mu (\u221e)=(3r2\u2212R2)/6D$ if $R<r$ [compare with Eq. (3.16a) of Ref. 29] and $\mu (\u221e)=r3/3RD$ if $R>r$ [compare with Eq. (3.11) of Ref. 29]. Moreover, as expected, it is easily seen that if $R>r$, $\mu (t)\u21920$ if $D\u21920$ or if $D\u2192\u221e$. As a consequence, there exists a value of $D0$ that optimizes the residence time (see Fig. 2). Differentiating the expressions of $\mu (t)$ with respect to $D$, this optimal value is easily seen to satisfy the following implicit equation:

whose solution can be discussed in limiting regimes. When $R\u2aa2r$, we find that $D0\u223c\alpha R2/t$, where $\alpha \u22430.353$ is the implicit solution of the equation

obtained by replacing $D0$ by $\alpha R2/t$ in Eq. (13) and taking the limit $R\u2aa2r$. In other words, the optimal diffusion coefficient $D0$ does not depend of the extension of the target $r$ in this regime. This is in strong contrast with the opposite regime $R\u2192r+$, which leads after a similar analysis to an optimal diffusion coefficient $D0\u223c3r2(R/r\u22121)/(2t)$, which, in particular, vanishes when $R\u2192r+$ as could be expected from the qualitative analysis presented above.

*Random observation time*. We now consider another experimental situation, corresponding to a random observation time, distributed according to an exponential law with mean $1/p$. This case corresponds for example to a situation where the particle has a finite lifetime, as in many biological situations. Averaging over this random lifetime, the mean residence time becomes

where $\mu \u0302(s)$ is given by Eqs. (8) and (9). Once again, for $R>r$, the mean residence time can be shown to have an optimum as a function of $D$ (see Fig. 2). Interestingly, the optimal diffusion coefficient $D0$ satisfies the simple implicit equation

where $x=rp/D0$ and $a=R/r$.

For $a\u2aa21$, the Lagrange inversion formula^{30} allows one to obtain explicitly the expansion of $x$ as powers of $1/a$ up to arbitrary order. The first terms are given by $x=2/a+4/5a3+\cdots $. In the opposite limit $a\u21921$, it is easy to deduce from Eq. (16) that $x\u223c1/a\u22121$. Finally, this gives again two regimes for the optimal diffusion coefficient: $D0\u223cpR2/4$ when $R\u2aa2r$ and $D0\u223cpr2(R/r\u22121)$ when $R\u2192r+$, in close analogy with the two regimes found in the case of a deterministic observation time.

*Random observation time and random initial position*. In the last situation, we assume that both the observation time and the initial position are random variables. More precisely, the observation time is again assumed to be distributed according to an exponential law with mean $1/p$, while the initial position is assumed to be uniformly distributed in an annulus region centered on 0, of inner radius $b$ and outer radius $c$. This mimics, for example, a case of chemical reactions where the position of the source of reactants cannot be accurately determined. In this case of an annulus region, it is not clear *a priori* if the mean residence time is still nontrivially optimizable with respect to $D$. Indeed, if the initial position is within the reactive sphere, the best diffusion coefficient is simply $D0=0$. On the contrary, if the annulus region is entirely exterior to the reactive sphere, a nontrivial optimal $D0$ is expected from previous results. This raises the question of the intermediate case where the annulus partially covers the reactive sphere.

In the first case of an annulus region exterior to the target zone $(b>r)$, we find

where $l\u2261D/p$. This quantity is easily shown to tend toward 0 when $D\u2192\u221e$ while

This proves that $\u27e8\mu \u27e9\xaf$ admits an optimum diffusion coefficient, as expected in view of the previous results.

In the opposite situation of an annulus region such that $0<b<r<c$, we get

The local behavior of this quantity when $D\u21920$ actually depends on the relative order of the two distances $r\u2212b$ and $c\u2212r$. If $r\u2212b<c\u2212r$,

showing that there is an optimal diffusion coefficient.

Remarkably, if $r\u2212b>c\u2212r$,

and this time there is no possible optimization. The last case of an annulus region of inner radius equal to zero (i.e., $b=0$), i.e., a sphere of radius $c$, deserves some specific attention. In this case, Eq. (19) is still valid but, quite surprisingly, no optimization with respect to the diffusion coefficient is possible. This monotonic decrease is compatible with the local behavior $(D\u21920)$,

We stress that this result holds for arbitrary values of the radius $c$.

In conclusion, we have proposed a very simple mechanism that allows one to optimize the residence time of diffusing molecules with respect to the diffusion coefficient. We have discussed the relevance of this effect to several schematic experimental situations classified in nature—random or deterministic—both of the observation time and of the starting position. We believe that this optimization of the residence time discussed in the case of the standard Brownian motion is robust (see, in particular, supplementary material given in Ref. 31) and is generalizable to more complex transport processes.