Feedback between motion and sensation provides nonlinear boost in run-and-tumble navigation

Many organisms navigate gradients by alternating straight motions (runs) with random reorientations (tumbles), transiently suppressing tumbles whenever attractant signal increases. This induces a functional coupling between movement and sensation, since tumbling probability is controlled by the internal state of the organism which, in turn, depends on previous signal levels. Although a negative feedback tends to maintain this internal state close to adapted levels, positive feedback can arise when motion up the gradient reduces tumbling probability, further boosting drift up the gradient. Importantly, such positive feedback can drive large fluctuations in the internal state, complicating analytical approaches. Previous studies focused on what happens when the negative feedback dominates the dynamics. By contrast, we show here that there is a large portion of physiologically-relevant parameter space where the positive feedback can dominate, even when gradients are relatively shallow. We demonstrate how large transients emerge because of non-normal dynamics (non-orthogonal eigenvectors near a stable fixed point) inherent in the positive feedback, and further identify a fundamental nonlinearity that strongly amplifies their effect. Most importantly, this amplification is asymmetric, elongating runs in favorable directions and abbreviating others. The result is a “ratchet-like” gradient climbing behavior with drift speeds that can approach half the maximum run speed of the organism. Our results thus show that the classical drawback of run-and-tumble navigation—wasteful runs in the wrong direction—can be mitigated by exploiting the non-normal dynamics implicit in the run-and-tumble strategy.


Introduction
Navigation up a gradient succeeds by finding those directions in which signals of interest increase. This can be difficult when the size of the navigator is small compared to the length scale of the gradient because local directional information becomes unreliable. In this case, cells [1,2], worms [3], larvae [4], and even robots [5] often adopt a run-and-tumble strategy to navigate. During runs the organism moves approximately straight, collecting differential sensor information in one direction. Tumbles, or reorientations at zero speed, enable the organism to explore other directions. Signal levels are transduced rapidly to the motility apparatus through an internal state variable, so that increases in attractant transiently raise the probability to run longer (and tumble less) before a negative integral feedback adapts it back [6]. Classically, averaging over many runs and tumbles results in a net drift up the gradient, although this is usually rather modest because of the occasional runs in the wrong direction. We here focus on the positive feedback inherent to this strategy wherein motion up the gradient lowers the probability to tumble, which further boosts drift up the gradient. Our analysis reveals an unstudied regime in which rapid progress can be achieved. Small fluctuations in the speed of the organism along the gradient grow into large transients in the correct direction but small ones otherwise. We show that this asymmetric amplification arises from the positive feedback, which causes the eigenvectors near the adapted state of the dynamical system to become nonorthogonal, therefore leading to non-normal dynamics. The resulting large transient are further boosted by a nonlinearity that is intrinsic to the positive feedback. Such non-normal dynamics were first discovered in fluid mechanics where they were shown to play an important role in the onset of turbulence in the absence of unstable modes [7,8].
Past theoretical studies of run-and-tumble navigation have mostly focused on what happens when adaptation dominates the dynamics (e.g. [9][10][11][12][13]). In this regime, the internal state of the organism exhibits small fluctuations around its mean, and mean field theory (MFT) can be applied to make predictions. This approach has been used to describe the motile behavior or populations of E. coli bacteria in exponential ramps [13][14][15] and oscillating gradients [16]. Beyond the well-understood negative feedback-dominated regime there is a large portion of physiologically relevant parameter space where the positive feedback between movement and sensation dominates the run-and-tumble dynamics. Agent-based simulations have shown that, in this case, large transient fluctuations can emerge in the internal state of an individual organism climbing a gradient, precluding the use of mean field approaches [13]. While systems of partial differential equations (PDEs) can be integrated numerically to reproduce these dynamics [17], a precise understanding of the role of the positive feedback in generating such large fluctuations and the impact of those on the performance of a biased random walk are fundamental questions that remain largely unanswered because of difficulties in obtaining analytical results.
Here we develop an analytical model of run-and-tumble gradient ascent that preserves the rich nonlinearity of the problem and incorporates the internal state, 3D-direction of motion, and position of the organism as stochastic variables. We find that large fluctuations in the internal state originate from two key mechanisms: (i) the non-normal dynamical structure of the positive feedback that enables small fluctuations to grow, and (ii) a quadratic nonlinearity in the speed along the gradient that further amplifies such transients asymmetrically. Utilizing phase space analysis and stochastic simulations, we show how these two effects combine to generate a highly effective "ratchet-like" gradient-climbing mode that strongly mitigates the classic drawback of biased random walks: wasteful runs in wrong directions. In this new regime an organism should be able to achieve drift speeds on the order of the maximum swim speed. Our results are general in that they apply to a large class of biased random walk strategies, where run speed and sampling of new directions may be modulated based on previously encountered signals.

Minimal model of run-and-tumble navigation
Consider a random walker with an internal state variable F that follows linear relaxation towards the adapted state F 0 over the timescale t M , which represents the memory duration of the random walker. We assume that the perceived signal, ϕ (X, t) = ϕ (C (X, t)), at position X and time t (here C represents the signal), is rapidly transduced to determine the value of an internal state variable F via a receptor with gain N: Stochastic switching between runs and tumbles depends on F and follows inhomogeneous Poisson statistics with probability to run r (F ) = λ T /(λ R + λ T ) = 1/(1 + exp(−HF)), where H is the gain of the motor, and λ R (F ) and λ T (F ) are the transition rates from run to tumble and vice versa [15,18]. During runs the speed is constant k _ X k¼ v 0 and the direction of motion is subject to rotational Brownian motion with diffusion coefficient D R . During tumbles the speed is nil and reorientation follows rotational diffusion D T > D R to account for persistence effects [19]. Taken together, these two processes cause the random walker to lose its original direction at the expected rate t À 1 D ¼ ðn À 1ÞðrD R þ ð1 À rD T Þ where n = 2, 3 for two-and three-dimensional motion respectively. Note that, in this minimal model we ignore possible internal signaling noise [20,21], and all randomness comes from the rotational diffusions D R and D T as well as the stochastic switchings with rates λ R ( f ) and λ T ( f ). The effect of signaling noise is considered below using agent-based simulations. Since ϕ (C) can be nonlinear, Eq (1) includes possible effects of saturation of the sensory system.
Consider a static one-dimensional gradient and define the length scale of the perceived gradient as LðXÞ ¼ 1=jjr0ðXÞjj and the direction of motion as s ¼û ÁX. Then from Eq (1) the internal dynamics satisfies the following equations during runs and tumbles, respectively: We are interested in the displacement of the random walker along the gradient over timescales longer than individual runs and tumbles. In the limit where the switching timescale t S = 1/(λ R + λ T ) is much shorter than the other timescales we derive from a two-state stochastic model and Eq (2) (Methods Eqs (13) and (14)): where f = HF. The first term is the negative feedback towards the adapted run probability r 0 = r ( f 0 ). The second term shows how motion up the gradient (s > 0) causes the probability to run r to feed back on itself-when the organism is oriented up the gradient (s > 0), F increases only during runs (Eq (2)), and this increase in turn raises r (F ) so that the probability that the dynamics of F follows _ Fj run rather than _ Fj tumble is increased, and so on. A positive feedback is thereby created with characteristic timescale t E = L/(NHv 0 ). Steeper gradient (smaller L), stronger receptor gain N or motor gain H, or faster speed v 0 , all lead to stronger positive feedback (shorter t E ). This important timescale, t E , together with t M (memory duration) and t D (direction decorrelation time), effectively determines the dynamics.
Expressing time in units of t M , we introduce the following two non-dimensional timescales: Here τ E quantifies the ratio between the negative and positive feedbacks. (See Table 1 for a summary of the symbols used.) From above, we expect that the dynamics will depend on how τ E and τ D compare with one.

Exploration of the dynamical regimes
To explore how run-and-tumble dynamics depend on τ E and τ D , we used a previously published stochastic agent-based simulator of the bacteria E. coli that reproduces well available experimental data on the wild-type laboratory strain RP437 ( [15,22] and S1 Appendix). In this case the internal state F represents the free energy of the chemoreceptors. Since E. coli approximately detects log-concentrations (S1 Appendix Eq (S11)), we simulated an exponential gradient so that τ E is a constant. In this case the cells reach steady state with a constant drift speed V D . Calculating V D from 10 4 simulated trajectories for a range of τ E and τ D0 = τ D (r 0 ) values reveals that cells climb the gradient much faster when the positive feedback dominates (τ E < 1) (Fig 1A). The trajectories of individual cells resembled that of a ratchet that moves almost only in one direction (Fig 1B green). In contrast, when the negative feedback dominates (τ E > 1) the trajectories exhibit both up and down runs of similar although slightly biased lengths (Fig 1B red). V D also depends on τ D and peaks when the direction decorrelation time is on the same order as the memory duration (τ D ' 1), consistent with previous studies [11,23,24]. In these simulations the adapted probability to run r 0 = 0.8 and the ratio D T /D R = 37 were kept constant. Changing these values did not change the main results (S1A-S1C Fig).
In a wild type population, individual isogenic cells will have different values of τ E and τ D0 due to cell-to-cell variabilities in swimming speed and in the abundance of chemotaxis proteins [22,25,26]. In a recent experimental study, the phenotype and performance of individual wild type cells (RP437 strain) was quantified by tracking cells swimming up a static quasi-linear gradient of methyl-aspartate (varying from 0 to 1 mM over 10 mm). This experiment revealed large differences among the performances of individual cells within the isogenic population [22], which could be reproduced by complementing the model of bacterial chemotaxis just described with a simple model of noisy gene expression (Fig 2 in [22]). To examine in which region of the (τ E , τ D0 ) space these cells might have been operating, we used this same model (complemented with diversity in rotational diffusion coefficients D R and D T due to variations in cell length; see S1 Appendix) with the same parameter values to run simulations of 16,000 cells climbing the experimentally measured ( Fig 1A). We find that even in this relatively shallow gradient some cells might have been operating in the positive-

Independent Variables
Name Definition Normalized expected speed projected along gradient v = rs

Dependent Variables
Name Definition L (X) Gradient length scale 1/krϕ (X)k λ R (F ) Transition rate from run to tumble λ T (F ) Transition rate from tumble to run feedback-dominated regime, especially near the bottom of the gradient (black dots). As the cells climb the gradient, τ E becomes larger (white dots) because, as concentration increases, the log-sensing cells in the quasi-linear gradient face a shallower gradient, and thus weaker positive feedback.

Positive feedback between motion and sensation generates large internal state fluctuations and fast drift
To better understand the origin of the fast drift speed and its associated "ratchet-like" behavior, we examine the relationship between the drift speed V D and the statistics of the internal state f. Using t M as the unit of time and v 0 t M as the unit of length we derive a Fokker-Planck equation for the probability P (x, f, s, τ) that at time τ = t/t M the cell is at position x = X/(v 0 t M ) with internal state f and orientation s (Methods Eq (14)): 2 @ s is the rotational diffusion operator on the (n − 1)sphere. All symbols used are summarized in Table 1.
For simplicity we consider a log-sensing organism swimming in a static exponential gradient. In this case, τ E (x) = τ E is constant (more complex gradient profiles and the effect of receptor saturation are considered later in the paper). Therefore the positive feedback becomes independent of position and the system can reach a steady state drift speed. Separating the variable x and integrating over x we obtain (Methods Eq (17)) where hÁi represents averaging over f and s and the bar indicates steady state. Eq (6) indicates that the drift speed is determined by the steady state marginal distribution pð f Þ. To find an analytical expression for pð f Þ, we expand the steady state joint distribution Pð f ; sÞ in orthonormal eigenfunctions of the angular operatorL s -the first two coefficients are the marginal distribution pð f Þ and the first angular moment p 1 ð f Þ= ffiffiffi n p ¼ Z Psds-and discard higher orders to obtain a closed system of equations. The analytical solution for the steady state marginal distribution pð f Þ reads where W is a normalization constant. The full derivation is provided in Methods Eqs (25)- (27), together with an interpretation of the distribution as a potential solution pð f Þ / exp ðÀ Vð f ÞÞ where V ( f ) is the "potential". We also examine how the shape of the potential depends on τ E and τ D .
The solution pð f Þ is plotted in Fig 1C. When the negative feedback dominates (τ E ≳ 1) the distribution is sharply peaked and nearly Gaussian with variance s 2 ¼ t D0 r 2 0 =nt 2 E (Methods Eq (32)) and its mean barely deviates from the adapted state f 0 ( Fig 1C red and blue). Substituting pð f Þ into Eq (6) and taking the limit τ E ) 1 yields known MFT results [11][12][13] (Methods Eq (43)). When the positive feedback dominates (τ E ( 1) the distribution pð f Þ now exhibits large asymmetrical deviations (Fig 1C green) between the lower and upper bounds f L and f U , which satisfy the relations (46)). MFT becomes inadequate in this regime, as recently suggested by 1D approximations [17]. When the positive feedback dominates, matching the memory of the cell with the direction decorrelation time becomes important: keeping the direction of motion long enough (τ D ≳ 1) allows the distribution to develop a peak near f U (Fig 1C green), which according to Eq (6) results in higher drift speed (S2 Fig). We verified the approximate analytical solution pð f Þ captures the run-and-tumble dynamics well by plotting it against the distribution of f obtained from the agent-based simulations (Fig 1C). Integrating pð f Þ according to Eq (6) predicts well the drift speed for all τ E (Fig 1D), including where the positive feedback dominates (τ E < 1).

Nonlinear amplification of non-normal dynamics generates long runs uphill but short ones otherwise
In the fast gradient climbing regime (τ E ( 1) trajectories resemble that of a ratchet (Fig 1B). To gain mechanistic insight into this striking efficiency we examined the Langevin system equivalent to the Fokker-Planck Eq (5). Defining v = rs as the normalized run speed projected along the gradient, we change variables from ( f, s) to (r, v) and obtain (Methods Eqs (47)-(52)): where v = dx/dτ and η (τ) denotes delta-correlated Gaussian white noise. The nullclines of the system (Fig 2A and 2C) intersect at the only stable fixed point (r, v) = (r 0 , 0) of Eq (8) where the eigenvalues of the relaxation matrix  Fig 2A) the eigenvectors of the relaxation matrix, (1, 0) T and ð1À r 0 Þr 0 t E t D0 t D0 À 1 ; 1 T , are highly non-orthogonal. This defines a non-normal dynamics that enables linear deviations to grow transiently [7,8] to feed the nonlinear positive feedback (v 2 term second line in Eq (8)) leading to large deviations. Importantly, this only happens for runs that start in the correct direction. If the run is in the wrong direction the linear deviation does not grow (Fig 2B; see also S1 Movie). Asymmetry arises because the v 2 term is always positive. Similar selective amplification properties are observed in neuronal networks, where non-normal dynamics enables the network to respond to certain signals while ignoring others (including noise) [27,28]. Thus, a random walker running in the correct direction is aided by the positive feedback, which pushes its internal dynamics towards the upper right corner of the phase plane where r = 1 and v = 1. If, instead, the run is in the wrong direction (v < 0), the nonlinearity pushes the system back into the high noise region near the fixed point where it will rapidly pick a new direction (Fig 2B).
In contrast, when the negative feedback dominates (τ E ≳ 1; Fig 2C), the eigenvectors become nearly orthogonal. Linear deviations from the fixed point simply relax to the fixed point regardless of the initial direction of the run. Thus runs up and down the gradient are only marginally different in length, resulting in a small net drift (Fig 2D). This key difference between the positive and negative feedback regimes is reflected in the flow field (white curves in Fig 2A and 2C).

Receptor saturation, varying gradient length scales, and trade-offs
For simplicity in our analytical derivations we assumed the environment was a constant exponential gradient with concentrations in the (log-sensing) sensitivity range of the organism.
Here we explore what happens when the organism encounters concentrations beyond its sensitivity range. For wild type E. coli the change in the free energy of the chemorecetor cluster due to ligand binding is proportional to ln((1 + C/K i )/(1 + C/K a )) (S1 Appendix Eq (S8)). Therefore the receptor is log-sensing to methyl-aspartate only for concentrations between K i ( C ( K a , where K i = 0.0182 mM and K a = 3 mM are the dissociation constants of the inactive and active states of the receptor. When C < K i the receptor senses linear concentration [29], whereas when C > K a the receptors saturate [30][31][32][33]: as a cell approaches a high concentration source its sensitivity decreases (S1 Appendix Eq (S10)). This in turn increases the value of τ E . Simulations in an exponential gradient show that this effect results in an eventual slow-down as the cell approaches the source (Fig 3A-3C).
Realistic gradients are typically limited in spatial extent and often are not exponential, in which case L and therefore τ E are different in different regions. L is long near the source in a linear gradient, for example, and decreases linearly with distance from the source. Simulations show that the cell initially climbs the gradient fast but later slows down as the gradient length scale L increases and τ E increases (Fig 3D-3F). On the contrary, for a static localized source in three dimensions, L is short near the source but increases linearly with distance from it (Methods). Thus, τ E decreases and the cell accelerates as it approaches the source (Fig 3G-3I). gradient. Similar to A-C but for C = C 1 − a 1 R where the source concentration is C 1 = 1 mM and decreases linearly at rate a 1 = 0.0001 mM/μm with distance R from the source. Contour spacing decreases with distance from the source (at the top), illustrating decreasing L = 1/|@ R ln C| = C/a 1 = C 1 /a 1 − R. (G-I) Localized source. Similar to A-C but for a constant source concentration (C 2 = 1 mM) within a ball of radius R 0 = 100 μm and for R > R 0 , the concentration is C = C 2 R 0 /R (the steady state solution to the standard diffusion equation @ t C = r 2 C without decay), decreasing with radial distance as 1/R away from the source. Contour spacing increases away from the source (at the origin), illustrating increasing L = 1/|@ R ln C| = R. Comparing cells in various dynamical regimes (different values of τ E ) across these different gradients suggests that a lower value of τ E results in faster gradient ascent.
When entering a food gradient, it is natural to try to climb as fast as possible. However this strategy could create a problem: the longer runs implied by the positive feedback mechanism could propel the accelerating E. coli beyond the nutrient source. This is the case in Fig  3E, where cells with the lowest τ E (green) reach the source first but overshoot slightly; they settle, on average, at a further distance than those with intermediate τ E (blue). Thus there is a trade-off between transient gradient climbing and long-term aggregating, as previously observed [13,15,23]. In nature, as chemotactic bacteria live in swarms, chasing and eating nutrient patches driven by flows and diffusions while new plumes of nutrients are constantly created by other organisms [2,34], the actual environments experienced by bacteria are far more complex. The trade-off we found here hints that in these random small fluctuating gradients [11,16,[35][36][37] the bacteria should not aim for maximal drift speed but need to deal with this trade-off to avoid overshoot. In general, natural environments will be complex, with a variety of different sources and gradients, implying different parameter domains will be optimal for E. coli at different times. Such phenotypic diversity may well confer an advantage [15,[37][38][39][40][41].

Discussion
Our results illustrate the surprisingly new capabilities that can emerge when living systems exploit the full nonlinearity inherent within an otherwise simple and widely used strategy. For the particular case of bacterial chemotaxis we showed that cells that swim fast, have long memory (adaptation time), or large signal amplification, are likely to exhibit "ratchet-like" climbing behavior in a positive-feedback-dominated regime, even in shallow gradients. As we showed from simulations using a model that fits experimental data, this regime should be accessible to wild-type bacterial populations. Actually identifying these "ratcheting" cells from experimental trajectories would require observing them for a sufficient time (T ) t M , t D , t E ) and in a sufficiently steep gradient over the distance traveled (ΔX = V D T * 0.5v 0 T). Using parameter estimates from [13,20], for t E < t D ' t M * 10 s we take T * 200 s, and for v 0 = 20 μm/s we get ΔX = 2 mm. To see how this compares with existing experimental setup with a quasi-linear gradient varying from 0 to 1 mM over 10 mm [22], we note that the black dots in Fig 1A show that some cells located 1.5 mm away from 0 concentration can operate in the positive-feedbackdominated regime. Thus, using the same setup as in [22] these requirements would be satisfied near the bottom of the gradient if the source concentration was increased to 3 mM.
It is common to make simplifying assumptions to facilitate analysis, but we do not believe that ours are limiting. We showed with simulations that our results hold (S1 Fig for details) when we take into account: (i) different values of r 0 and D T /D R ; (ii) the limited range of the receptor sensitivity [15,18] (S1 Appendix Eq (S10)); (iii) possible nonlinearities (S1 Appendix Eq (S4)) and asymmetries of adaptation rates [14,42]. A hallmark of E. coli chemotaxis is that, in the absence of a gradient, run-and-tumble behavior adapts back to prestimulus statistics [6,43]. These robust properties of integral feedback control [6] remain in place in our study because the transients originate from non-normal dynamics around the stable fixed point. The boost from positive feedback described here is independent from other mechanisms that can enhance drift up a gradient such as imperfect adaptation in the response to some amino acids [44] and stochastic fluctuations in the adaptation mechanism [20,21]. The latter has been shown to enhance chemotactic performance in shallow gradients by transiently pushing the system into a regime of slower direction changing provided it is running up the gradient. There are some similarities between the effect of signaling noise and the positive feedback mechanism presented here: both can affect drift speed by causing long-lasting asymmetries in the internal state when running up the gradient. In S3 Fig we show using simulations that signaling noise in the adaptation mechanism does not change our conclusion that the drift speed is maximal in the positive-feedback-dominated regime. Depending on the region of the (τ E , τ D ) parameter space, the signaling noise can either enhance the drift speed by less than 10% or reduce it by up to 30%.
The fact that non-normal dynamics might be exploited to boost runs in the correct direction parallels recent findings in neuroscience [27] that suggest neuronal networks use similar strategies to selectively amplify neural activity patterns of interest. Thus, non-normal dynamics could be a feature that is selected for in living dynamical systems. Although we used bacterial chemotaxis as an example, our results do not depend on the specific form of the functions r ( f ) and t D ( f ), provided they are increasing. Therefore our findings should be applicable to a large class of biased random walk strategies exhibited by organisms when local directional information is unreliable. In essence, any stochastic navigation strategy requires a memory, t M , to make temporal comparisons, a reorientation mechanism, t D , to sample new directions, and external information, t E , relayed to decision-making circuitry through motion and signal amplification. Our theoretical contribution showed the (surprisingly) diverse behavioral repertoire that is possible by having these work in concert. In retrospect, perhaps this should not be surprising given the diverse environments in which running-and-tumbling organisms can thrive.

Agent-based simulation
Chemotaxis pathway model. A detailed description of the chemotaxis model and agentbased simulations is provided in S1 Appendix (parameters in S1 Table). Briefly, the agentbased simulations were performed using Euler's method to integrate a standard model of E. coli chemotaxis [12-14, 18, 20] in which the cell relays information from the external environment to the flagellar motor through a signaling cascade triggered by ligand-binding receptors. The receptors are described by a two-state model where the activity a is determined by the free energy difference F between the active and inactive states, which is determined by both the ligand concentration C and the receptors' methylation level m. At each time step, the cell moves forward or stays in place according to its motility state (run or tumble), which also determines whether its direction changes with rotational diffusion coefficients D R or D T . At the new position changes in ligand concentration C cause changes in free energy F and thus activity a, and the methylation state adapts to compensate that change to maintain a constant activity. The updated value of the free energy F then determines the switching rates between the clockwise and counter-clockwise rotation of the flagellar motor state, which in turn determines the motility state of the cell according to rules and parameters in [20], completing one time step. Noisy gene expression model. In Fig 1A we considered a wild type population in the scatter plot. To generate a population with realistic parameters, we used a recent model [22] of phenotypic diversity in E. coli chemotaxis that reproduces available experimental data on the laboratory strain RP437 climbing a linear gradient of methyl-aspartate. In this model individual cells have different abundances of the chemotaxis proteins (CheRBYZAW) and receptors (Tar, Tsr). These molecular abundances then determine the memory time t M and the adapted probability to run r 0 [15]. The run speed was different among cells and sampled from a Gaussian distribution to match experimental observations [22]. Rotational diffusion coefficients were also distributed to reflect differences in cell length.

Derivation of Eqs (3)-(5), the Fokker-Planck equation model in the fast switching limit
We define P R ðX;û; F; tÞ and P T ðX;û; F; tÞ as the probability distributions at time t to be running or tumbling at position X in directionû with internal variable F. As described, there is Poisson switching between runs and tumbles with rates λ R (F ) and λ T (F ), runs and tumbles follow rotational diffusion with D R and D T , and motion is constant in runs and 0 in tumbles. Thus we construct a two-state stochastic master equation model [45] where _ Fj run;tumble are defined in Eq (2). Since the gradient varies in one direction only we focus on motion in the gradient direction and integrate the probability over all other directions. Thus r Áû ¼ s@ X and r 2 u ¼L s , the polar angle part of the rotational diffusion operator on the (n − 1)-sphere. To derive the analytical form ofL s we note in n-dimensional space we can iteratively write down the Laplace-Beltrami operator [46] as where 0 < θ < π is the polar angle. In a one-dimensional gradient we define the gradient direction as the polar axis, thus s ¼û ÁX ¼ cos y. We can write sin y ¼ ffiffiffiffiffiffiffiffiffiffiffiffi 1 À s 2 p and @ y ¼ À ffiffiffiffiffiffiffiffiffiffiffiffi 1 À s 2 p @ s . Then the polar angle part is Using the definitions of the normalized internal state f = HF, of the timescale of switching between runs and tumbles t S = 1/(λ R + λ T ) [45], and of the probability to run r = λ T /(λ R + λ T ), we obtain If we assume the switching terms with t À 1 S in Eq (13) dominate, the probabilities to be running and tumbling equilibrate on a much faster timescale than the other ones. Therefore we can let P = P R + P T and can approximate the actual probability to run as P R /P % r. Adding the two equations above yields the Fokker-Planck equation: This is equivalent to a system of Langevin equations. Considering dr/df = r (1 − r) the internal variable dynamics (the first term on the right) gives Eq (3) which defines t E . The angular dynamics (the second term on the right) defines t D .
Using the time scale definitions in Eq (4) and non-dimensionalizing time τ = t/t M and position x = X/(v 0 t M ), we obtain the Fokker-Planck Eq (5).
Derivation of the drift speed V D , Eq (6), for a log-sensing organism moving in an exponential gradient From the Fokker-Planck Eq (5) we consider the steady state so that @ τ = 0. For a log-sensing organism moving in an exponential gradient τ E does not depend on x. We can therefore integrate over x to get an equation for the marginal steady state distribution Pð f ; sÞ-this removes the @ x term. Integrating over s gives where the bar indicates steady state. By the boundary conditions that P ! 0 at ±1, we must have From the −@ x (rsP) term of the Fokker-Planck Eq (5), the spatial flux is r ( f )s and the drift speed is its average over the distribution. Thus we get the drift speed as Eq (6) Derivation of the analytical solution to the Fokker-Planck Eq (5) by angular moment expansion when τ D0 ( 1 Here we use separation of variables and expand the solution to the Fokker-Planck Eq (5) as a sum of eigenfunctions of the operatorL s on s. We then ignore high order terms assuming τ D0 ( 1 and derive an approximate analytical solution. The eigenvalue problem of the angular operatorL s , defined in Eq (12), is ð1 À s 2 Þy 00 À ðn À 1Þsy 0 ¼ ly: We identify this as the Gegenbauer differential equation [47], with eigenfunctions the Gegenbauer polynomials C ðn=2À 1Þ k ðsÞ and the corresponding eigenvalues l ðn=2À 1Þ k ¼ À kðk þ n À 2Þ.
When n = 3 they are Legendre polynomials with eigenvalues l ð1=2Þ k ¼ À kðk þ 1Þ. The first few Gegenbauer polynomials are They are orthogonal in the sense that , those of Legendre polynomials. The weight in the integration above is consistent with the geometry on an (n − 1)-sphere S n −1 , whose the volume element are iteratively defined [46] as After a change of variable s = cos θ and integrating over all remaining dimensions, we see that any integration of s should carry a weight From orthogonality and completeness, we write any function of s, in particular the probability distribution P, as a series of Gegenbauer polynomials. When n = 3 this is the Fourier-Legendre Series.
Pðx; f ; s; tÞ ¼ From now on we denote the marginal distribution p ( f ) = p 0 ( f ). Also, from this definition Substitute the expansion Eq (23) into the Fokker-Planck Eq (5) and use the orthogonality Eq (20), we obtain q d kþ1;l (summation over l implied) is an operator relating neighboring orders. It comes from the positive feedback term. When n = 3 it is ŝ kl ¼ k spring constant k ( f ) is smaller and the distribution pð f Þ is wider. (ii) A slower change in direction (smaller τ D ) leads to a larger spring constant k ( f ) / 1/τ D ( f ), and thus the distribution pð f Þ is more concentrated near the "origin" f 0 . Intuitively, a shorter direction correlation time τ D inhibits coherent motion in a single direction, which is required by the positive feedback to consistently drive the internal state f away. Thus the distribution pð f Þ is more concentrated. (iii) Asymmetries are created by the functional dependencies of r ( f ) and τ D ( f ), both increasing in f-a "weaker spring" for higher values of f shifts the distribution pð f Þ there. Intuitively, more positive feedback / r ( f ) and more coherent motion / τ D ( f ) in the positive direction asymmetrically drives the internal state towards higher values. These 3 observations can all be found in Fig 1C. In Fig 1A heat map the drift speed V D was calculated by fitting the linear part of the mean trajectory. In Fig 1B the first 50 s were removed to avoid the start up transient. In Fig 1C, the steady state pð f Þ from agent-based simulations was calculated from the histogram of all the internal values of the 10 4 simulated cells between τ = 10 and τ = 20, sampled at regular steps of τ = 0.01. Numerical solutions of the Fokker-Planck Eq (5) were obtained by expanding the distribution in angles, as in Eq (25), and keeping the first 10 orders. The steady state pð f Þ was found by solving an initial value problem using the NDSolve function in Mathematica, with 10 4 spatial points and integration time up to τ = 10. Further orders, finer grid, and longer integration times were checked to ensure solution accuracy. In Fig 1D, V D from agent-based and Fokker-Planck were calculated by plugging into Eq (6) pð f Þ obtained from those methods in C. MFT was calculated by combining Eq (42) with Eq (6) to find both f m ¼ h f i and V D [12,13]. In the inset, the black curves show the approximate distribution in Eq (35).
In Fig 2B and 2D the Langevin trajectories were generated using Euler's method to integrate Eq (8).
In Fig 3C, 3F and 3I the τ E calculation considered receptor saturation as well as the varying gradient length scales, with C and L evaluated at mean positions. Note this is not the average τ E over the population.