{'fraction_non_alphanumeric': 0.038352615087973004, 'fraction_numerical': 0.01096649795131357, 'mean_word_length': 4.1598010259598945, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Receptor crosstalk improves concentration sensing of multiple ligands

Cells need to reliably sense external ligand concentrations to achieve various biological functions such as chemotaxis or signaling. The molecular recognition of ligands by surface receptors is degenerate in many systems leading to crosstalk between different receptors. Crosstalk is often thought of as a deviation from optimal specific recognition, as the binding of non-cognate ligands can interfere with the detection of the receptor's cognate ligand, possibly leading to a false triggering of a downstream signaling pathway. Here we quantify the optimal precision of sensing the concentrations of multiple ligands by a collection of promiscuous receptors. We demonstrate that crosstalk can improve precision in concentration sensing and discrimination tasks. To achieve superior precision, the additional information about ligand concentrations contained in short binding events of the non-cognate ligand should be exploited. We present a proofreading scheme to realize an approximate estimation of multiple ligand concentrations that reaches a precision close to the derived optimal bounds. Our results help rationalize the observed ubiquity of receptor crosstalk in molecular sensing.


I. INTRODUCTION
Living cells need to collect information with high precision to respond and adapt to their environment [1]. For example, chemotactic swimming bacteria can react to changes in concentrations of nutrients and toxins [2]; and cells from the innate immune system can recognize distinct microbial components and initiate immune responses [3]. Presence or concentrations of key ligands are measured via receptor proteins, which are usually located in the cell surface, and later processed by complex downstream signaling networks to trigger cellular responses. The accuracy of these measurements suffer from multiple sources of noise, including the transport of ligands by diffusion, the binding of the ligands to the receptors after they have arrived to the surface, and the communication between components of the signaling network.
In recent years, the fundamental limits to cellular sensing has received thorough theoretical consideration [4][5][6][7]. Berg and Purcell [8] were the first to study the problem and found that the sensing error can be minimized by either increasing the number of receptors or the number of measurements per receptor. More recently, Endres and Wingreen showed [9] using a maximum likelihood estimation that the accuracy can be increased by a factor of 2 by solely taking into account the unoccupied time intervals. Further theoretical work has concentrated on un-Most of the aforementioned models assume that receptors sense individual ligands. However, cognate ligands usually reside among other spurious ligands and receptor must identify them accurately [16,[31][32][33]. Recently, Mora [34] derived the fundamental limit to measuring concentrations among spurious ligands, and devised a signaling network, based on a kinetic proofreading scheme [35], to approximately reach this limit. Similarly, Singh and Nemenman [36] found that a single receptor is capable of correctly measuring two different ligands with disparate binding affinities using a similar network. These studies focused on understanding the optimal sensing capacity of one receptor with a cognate and one (or many) non-cognate ligands. In reality, receptors with different cognate ligands may communicate with each other through their downstream signaling networks, thereby increasing the efficiency of the measurement of the concentration of all ligands. This crosstalk between receptors is likely to be the case for systems with a larger number of ligands than receptors. For example, in the bone morphogenetic protein signaling pathway, more than 30 different ligands interact with only 7 different receptors [37,38]. Similar circumstances arise for Toll-like receptors in the innate immune system [39] and T-cell receptors in the adaptive immune system [40,41]. The fundamental limits to how different receptors combine infor-mation through crosstalk is currently unknown.
In this paper, we place physical limits on concentration sensing with crosstalking receptors. We consider two types of receptors, each with their own cognate ligands and compare specific to crossreactive binding. To gain intuition, we first consider specific receptors which never bind to non-cognate ligands. We then analyze the more realistic case where both receptors bind to both ligands with different binding strengths in a background with other ligands. In the latter case, we call the receptors specific if the off-rates of the non-cognate ligand are as high as those for the background ligands. In both cases, we demonstrate that crosstalk outperforms specific binding of ligands in some parameter regimes as measured by relative errors on concentration estimation of the two ligands. We also discuss a related problem: detection of the presence of a ligand over a given concentration threshold using sequential probability ratio tests.

II. MAXIMUM LIKELIHOOD ANALYSIS OF TWO CROSSTALKING RECEPTORS
We consider a situation of crosstalk in the simplified case of two receptors, labeled A and B, and two ligands, labeled 1 and 2. The binding rates of the two receptors k A and k B are assumed to be independent of the identity of the ligand, as in the case of diffusion-limited binding, in which case k A = 4Ds A , k B = 4Ds B , where s A , s B are the sizes of idealized circular receptors located on the cell surface, and D is the diffusivity of the ligand molecules. The distinction between the two ligands appears in the distinct rates of unbinding, which are denoted by r A,1 , r A,2 , r B,1 , r B,2 . In the presence of both ligands, receptors alternate between bound and unbound states with exponential waiting times associated with the off and on rates respectively. In general, the mean occupancy of each receptor contains useful information about the concentrations of each ligand. However, the temporal information contained in the sequence of bound and unbound times is lost; a maximum likelihood estimation based off the binding and unbinding events yields an estimator that is unbiased and asymptotically achieves the least variance, as given by the Cramér-Rao bound [9,34,42]. For independent receptors, we may split the log-likelihood L into contributions from binding events at each receptor, L = L A + L B . For ligands with concentrations c 1 and c 2 (with c tot = c 1 + c 2 ), the probability of a sequence of bound and unbound times on receptor A is written as where {u A i , b A i } denotes the sequence of unbound and bound times, and the index i runs from one to the total number of binding events n A in a fixed time interval T , which is taken to be much longer than the typical binding and unbinding times. A similar expression can be written for receptor B. The log-likelihood now reads with x = c 1 /c tot and T R u is the total unbound time of the receptor R. Maximum likelihood (ML) estimates of x and c tot are obtained from the conditions ∂L ∂x | x * = 0 and ∂L ∂ctot | c * tot = 0. The ML estimate of the total concentration, c * tot , is given by The ML estimate x * satisfies the equation Here, we have defined α A = r A,1 /r A,2 and α B = r B,2 /r B,1 .

III. PRECISION IN CONCENTRATION SENSING
Since c tot and x are involved in separate terms of the log-likelihood (2), the variances of their optimal estima-tors are given, in the limit of large numbers of binding events, by the inverse of their respective Fisher information, δx 2 = ∂ 2 L Crosstalk is defined as the receptors additionally binding to another non-cognate ligand. The non-cognate ligand unbinds faster (r > r), which allows for discrimination between the two types of binding events. (B) The two receptors bind to both ligand species, as well as to a pool of background ligands 0, all with the same binding rate k. The off rates of the non-cognate ligand can either be identical to the background ligands (specific case, r < r = r0) or in between the background and the cognate ligand (crosstalk case, r < r < r0).
angled brackets denote an expectation over the distribution parametrized by the true parameter values. A similar approach is taken in [34]; here, we simply write the final form for the variance in the estimates of c tot and x: where averages and variances are taken over realizations of sequences of bound and unbound times (or equivalently, averaged over one sequence in the limit of large T ) and . Before proceeding further, we make a few simplifying assumptions of symmetric binding of the two ligands on the two receptors. Particularly, we assume r A,1 = r B,2 = r, r A,2 = r B,1 = r and k A = k B = k, which give α A = α B ≡ α = r/r . For α < 1, the conditions imply that ligand 1 acts as a cognate ligand for receptor A and a non-cognate ligand for receptor B, whereas the reciprocal relationship is true for ligand 2. The discriminability of the two ligands is set by α, which measures the ratio of bound times of the cognate and non-cognate ligands. It is convenient to nondimensionalize the concentrations of the two ligands asc 1 = kc 1 /r andc 2 = kc 2 /r. The mean number of binding events on the two receptors is given by the total time divided by the mean time for each binding and unbinding cycle, which gives n A = rT (c 1 +c 2 ) 1 +c 1 + αc 2 , n B = rT (c 1 +c 2 ) 1 + αc 1 +c 2 .
In the case of specific receptors i.e., when each ligand binds to only one receptor type, the minimum variance of the estimated concentration of each ligand can be derived in a similar fashion from the log-likelihood (see [9]). If we suppose ligand 1 binds specifically to receptor A (with the same binding and unbinding rates as in the crosstalk case above), and ligand 2 binds only to receptor B, the error in ML estimation is given by n A spec = rTc 1 1 +c 1 , n B spec = rTc 2 1 +c 2 , where, n A spec , n B spec are the average number of binding events for the specific receptor case in the same interval T . Note that (10) does not correspond to the r → ∞ limit in (5) and (6): when r is very large, non-cognate ligand bound times can be read easily because there is no cutoff for the readout of small bound times. This biological inconsistency can be removed by taking into account binding of non-specific molecules (see Section V).
To make a comparison between the effectiveness of crosstalking and specific receptors, it is more pertinent to estimate relative errors, δc 1 /c 1 , δc 2 /c 2 , as concentrations can span many orders of magnitude. In the limit of long times, where errors are Gaussian-distributed, the covariance matrix describes the magnitude and shape of relative estimation errors as an ellipse around the true value. Its determinant, Ω = det(Σ), gives the volume of that ellipse and is used as a measure of error. Intuitively, the discriminability between two pairs of concentrations (c 1 , c 2 ) and (c 1 , c 2 ) depends on the overlap in the areas of the two ellipses centered around the pairs [43]. In the crosstalk case, from (5) we have For the case of specific binding, the measurements of c 1 and c 2 are independent, and from (10), the determinant of the covariance matrix is In the limit of weak crosstalk, α 1, we find that crosstalk between receptors always improves sensing capacity over non-crosstalking receptors, regardless of the concentrations of each ligand. To see this, (7)), and so where µ = (c 1 +c 2 ) −1 . In particular, when c 1 ≈ c 2 , the number of binding events for the crosstalking receptors is twice that for the specific receptors and consequently, Ω S is a factor two greater than Ω CT in this limit. In Figure 2 we mark the regions in the (c 1 ,c 2 ) plane where Ω S > Ω CT for different values of α. We make two major observations. First, for α = 0 i.e., for perfect discriminability, crosstalking receptors always show lower estimation error (Eq. 14). Second, there is a critical value of α, α c ≈ 0.27, beyond which Ω S is smaller than Ω CT for all concentrations. Thus, the usefulness of crosstalk diminishes with increasing α, as in Ref. [36].

IV. PERFORMANCE COMPARISON IN DISCRIMINATION TASKS
Next, we consider the task of discriminating between two external environmental states or 'hypotheses', H 0 and H 1 , corresponding to ligand concentrations (c 1 , c 2 ) and (c 1 , c 2 ) respectively. A Bayes-optimal decision-maker compares the likelihood ratio, or equivalently, the difference in log-likelihoods, L 0 − L 1 ≡ ∆L, for the two hypotheses given the observed bound and unbound times and makes a decision if ∆L crosses a certain threshold θ in a given amount of time T . The false positive and false negative error rates depend on θ and the distribution of Crosstalking receptors show improved discriminability relative to specific receptors. Ratio of sensitivity index d for the cross-talk (d CT ) and specific (d S ) cases, as a function of the concentration of the second ligand c2, and the specificity ratio α = r/r , in the task of discriminating two values of the first ligand concentration, kc1/r = 0.5 or kc 1 /r = 2. The orange line separates the regions in which each of the two strategy (crosstalk or specific) is optimal. Crosstalk is beneficial for small c2 and α, i.e. when the ligands are easy to distinguish and do not saturate the receptor. The sensitivity index was computed using rT = 10 4 .
∆L under the hypotheses. To conveniently compare the discriminability for the crosstalk and specific cases, we use the discriminability (or 'sensitivity index' d ), defined as where subscripts c and c denotes expectation values under concentrations (c 1 , c 2 ) and (c 1 , c 2 ) respectively. If ∆L is Gaussian-distributed and its variance equal for both sets of concentrations, d and θ together uniquely determine the false positive and false negative error rates. For large T , the central limit theorem guarantees that the Gaussian approximation is a good one. Although the variances δ 2 ∆L c and δ 2 ∆L c are not equal in general, d is often used as a general measure of discriminability.
To calculate the mean and variance of ∆L c , we first observe that since the two receptors are independent, it is sufficient to compute them for a single receptor and sum them up. We show in the Appendix that for a single receptor with arbitrary unbound and bound time distributions, the cumulant generating function of ∆L c has a simple form in the limit of large T , from which we derive explicit forms for the mean and variance. In Figure 7, we validate these analytical expressions using numerical simulations.
The discriminabilities for the crosstalking and specific receptors, d CT and d S , are compared in Figure 3. The orange line mark the region where crosstalk offers greater discriminability compared to the specific case. Large concentrations of the non-cognate ligand can mask the accurate discrimination between different concentrations of the cognate ligand, as evidenced by the blue region. As α → 0, masking plays a limited role, since even though binding events are dominated by the non-cognate ligand, the bound times are extremely short and easily distinguishable from the bound times of the cognate ligand.

V. CONCENTRATION ESTIMATES OF TWO LIGANDS IN A POOL OF NONSPECIFIC LIGANDS
Next, we consider a more realistic scenario the cell faces: the problem of concentration estimation of two ligands in a presence of a pool of background nonspecific ligands. This scenario also allows us to resolve the inconsistency of the limit of perfect specificity, α → 0. As we observed earlier, that limit did not reduce to the case of no cross-talk, because of infinitely short but mathematically informative nonspecific binding events. Adding a background of nonspecific ligands removes the informative content of these spurious events by making them indistinguishable from background ligand binding. Here, as before, we have two receptors, A and B, and two cognate ligands, 1 and 2, whose concentrations c 1 and c 2 the cells needs to be estimate. In addition, there exists a pool of nonspecific ligands labeled 0, with concentration c 0 . The receptors now have to differentiate between three types of ligands to correctly estimate their concentrations. We assume diffusion-limited ligand-receptor binding as before. The off-rates for the nonspecific ligands are r A,0 = r B,0 = r 0 ≥ r > r from both receptors. With total concentration given by c tot = c 0 + c 1 + c 2 , and relative fractions x = c 1 /c tot , y = c 2 /c tot , the probability P ({u R i , b R i }) of a sequence of bound and unbound times can be written as a function of the on-rate, various off-rates and concentrations. As before, the ML estimate of θ = [x, y, c tot ] can be obtained by maximimizing the log-likelihood L = log P , by setting ∂L(θ) ∂θ | θ * = 0. Further, in the limit of large numbers of binding events, the Cramér-Rao bound guarantees that the covariance matrix of the estimator θ is given by the inverse of the Fisher Information matrix: The covariance matrix Σ NS of the relative errors on concentrations, δc 1 /c 1 and δc 2 /c 2 , can then be obtained by a change of variable from θ to (c 0 , c 1 , c 2 ), from which the error volume Ω NS = det(Σ NS ) is computed, analogous to Ω S and Ω CT defined earlier.
We are interested in how Ω NS varies as a function of r and r , to understand if crosstalk (defined now as r < r 0 by contrast to background unspecific binding, r = r 0 ) can result in relatively better concentration estimates. Up to scalar scaling, Ω NS depends only on the ratios kc tot /r 0 , r/r 0 and r /r 0 and the ligand concentration fractions x and y.
The estimation error quantified by Ω NS attains a minimum (Fig. 4a) at some finite values of r = r min and r = r min < r 0 , meaning that a finite crosstalk minimizes the estimation error. At a fixed r, for r > r, while Ω CT monotonically decreases with increasing r , Ω NS is nonmonotonic with a local minimum at r = r min ∈ (r, r 0 ) (inset, Fig. 4a). The existence of a minimum results from a tradeoff between three conflicting effects. First, when r is large, receptors cannot reliably distinguish between the noncognate and the nonspecific ligand, resulting in an increased estimation error for x and y. On the other hand, larger values of r and r result in more binding events, thereby improving statistics and accuracy. Lastly, r and r should as far as possible from each other for each receptor to be able to distinguish cognate from noncognate ligands. These opposing forces result in a local minimum at (r min , r min ), balancing the need for speed (high unbinding rates r, r ) with that of specificity (low but different r and r ), ensuring that receptors can maximally distinguish between the three different kinds of ligands by looking at their binding times.
Distinct regimes emerge depending on the value of the dimensionless parameter kc tot /r 0 , which can be viewed as an effective unspecific receptor occupancy quantifying the effect of background binding, as well as on the ligand fractions x and y. For small kc tot /r 0 , (Fig. 4a), a tradeoff exists between speed and specificity (r min < r 0 ), while for large kc tot /r 0 (Fig. 4b), the low receptor availability caused by unspecific background binding makes the speed requirement dominate, resulting in absence of cross-talk in the optimal solution (r min = r 0 ). Fig. 5 shows the phase diagram as a function of the ligand fractions x and y, for fixed values of kc tot /r 0 = 0.01. Three phases emerge: cross-talk (r min < r 0 , I), no cross-talk (r min = r 0 , II), and impossibility region (x + y > 1, III). When one ligand is present in very low concentrations and the other in high concentrations (low x, high y, or vice-versa), introducing cross-talk would cause the abundant ligand to saturate both receptors, keeping the receptor that is cognate to the sparse ligand from sensing its concentration. In that regime, cross-talk is not optimal (region II of Fig. 5a). As kc tot /r 0 increases (Fig.  5b), this region spreads towards smaller values of x and y. Yet even when the effect of background ligand is felt strongly, cross-talk is still advantageous when the cognate ligands are sparse (x + y 1).

VI. A BIOCHEMICAL NETWORK SCHEME THAT REACHES CLOSE TO THE OPTIMAL BOUNDS
In this section, we present a simple kinetic proofreading-based scheme that implements an approximate maximum likelihood estimation with a precision close to the derived optimal bounds. In the following analysis, for simplicity, we revert to the former case of one cognate and one non-cognate ligand. We note that the ML estimate for the total concentration c tot = (n A + n B )/(k A T A u + k B T B u ) has a simple expression; the terms in the numerator and denominator can be measured biochemically and combined to formĉ tot .
To estimate x, the scheme relies on a proofreading 'classifier' associated to each receptor that distinguishes between bound times above and below a certain threshold. An unbiased estimate of x, which we denote bỹ x R , can be formed for each receptor R (R = A or B), based on the fractionf R of binding events where the ligand is bound longer than τ R . Defining y R = e −r τ R , h R = e −rτ R − e −r τ R = y α R − y R , this estimate reads: The error in each estimate is δx 2 , where n R is the mean total number of binding events in time T and f R ≡ f R . Because the estimates from receptors A and B stem from independent binding events, the best way to combine them is through a weighted average of the estimates from each receptor: with β = 1/ 1 + δx 2 A /δx 2 B . The value of the threshold τ A can be optimized to yield the most precision inx A . In Appendix B, we show that the optimum is reached for r τ * A = (1 − α) −1 log 1−2α αx , valid for α < 1/2. We note here that even though τ * A depends on x, the dependence is logarithmic. To implement adaptive thresholds that depend on log x, we can imagine a collection of 'gating' networks which apply different thresholds to the length of the binding events. An independent crude estimate of x is sufficient to choose the network that has a threshold closest to τ * A . The optimal value for τ B has a similar form with x replaced by 1 − x.
The cell can easily computex A andx B using a proofreading motif followed by a downstream push-pull network as shown in Figure 6A. For concreteness, consider the case of receptor A. Suppose the proofreading motif produces a molecule of enzyme E 1 for each binding event longer than the threshold τ A . Further, every binding event generates a single protein X and an enzyme molecule E 2 . The enzymes E 1 and E 2 catalyze the conversion of X to its active state X * and vice-versa, respectively. Assuming that X and X * are in excess in the enzymatic reaction, the rate at which X and X * are interconverted is directly proportional to the enzyme numbers with catalytic rates denoted by k 1 and k 2 . Suppose also that X * reverts to X at a finite rate r −1 . At steady state, dX * /dt = 0, and we have r −1 X * = k 1 E 1 − k 2 E 2 . Then, setting k 1 /r −1 = 1/h A and k 2 /r −1 = y A /h A , the fraction of X molecules in the active state tracksx A .
Combiningx A andx B as in (19) using a biochemical network can be done at fixed β. For instance, when x ∼ 1/2, the errors from both receptors are about the same and we may weight the estimate from each receptor equally, β = 1/2. However, tuning β to reflect its dependency of the concentrations requires additional adaptive mechanisms. In the regime x 1, receptor A has the highest precision in estimating x, andx A can be taken as a crude estimate of x (and symmetrically for B when 1 − x 1). In Figure 6B, we compare the error from this crude estimate against the optimal crosstalk error and the error from using the optimal network weights (19). This comparison shows that although the approximate biochemical solutions are not optimal, they stand reasonably close to the ML estimate.

VII. DISCUSSION
The key result of our paper is that crosstalk is generically the optimal strategy for sensing multiple ligand concentration using multiple receptors. The theory predicts an optimal level of crosstalk, which balances the opposing requirements of maximizing the number of binding events with the receptor's ability to distinguish the ligands involved in those events. For this discrimination to be possible, the difference between cognate and noncognate binding affinities is maintained.
In the simplest theory that we presented (Sec. 2 and 3), higher unbinding rates are always advantageous because they increase receptor availability without hurting discriminability. However, in reality there are several reasons why high unbinding rates are not optimal. First, the molecular machinery required to process the information of the receptor binding state operates with its own incompressible time scale, which sets a lower bound on the duration of binding events that can be detected. Second, it is not realistic to assume that unbinding rate can be increased arbitrarily without affect binding rates as well. Very unspecific ligands that unbind very quickly are also less likely to bind in the first place, and the assumption of diffusion-limited binding rate is no longer valid. Lastly, for high enough unbinding rates, cognate and cross-talk binding events become indistinguishable from completely unspecific binding with other generic molecules. Modeling that situation as we did in Section V allowed us to find well-defined optimal unbinding rates.
In addition to maximizing the use of each receptor to gain information about each ligand, crosstalk has the additional advantage of expanding the dynamic range of concentrations over which ligands can be sensed. For instance, when a ligand is present at high concentration, its cognate receptors will be fully saturated, making it difficult to reliably read off the concentration from the receptor's activity. Lower-affinity binding to a second receptor can then allow for more accurate sensing, as long as that receptor is not itself saturated by other ligands. In our language, when receptor A is saturated by ligand 1, c 1 r/k ≡ K d , then receptor B is still sensitive to the concentration of ligand 1 in the regime c 1 ∼ r /k = α −1 K d . More generally in the presence of multiple ligands and multiple receptors, a good strategy could be to organize specificities (i. e., unbinding rates) so that, for each ligand, dissociation constants collectively tile the sensory space. For such strategies to work, the concentration space must be sparse, meaning that only one or a few of the ligands of interest are present in large concentrations at the same time.
Cross-talk, also known as promiscuous binding, cross-reactivity, or multiplexing, depending on the context, is widespread in biology. It is an important feature of the BMP [37], Notch, Wnt [44], and JAK-STAT [45] pathways, as well as the Eph-ephrin system for cell positioning [46], T-and B-cell receptor antigen recognition [41,47], and olfactory receptors [48]. An often cited benefit of promiscuity is that it confers the ability to design combinatorial codes. In the context of olfaction [49], such design can be advantageous in the presence of sparse odors [50]. Combinatorial codes also allow for flexible computations in signaling pathways [38]. In the adaptive immune system, cross-reactivity is necessary to cover the large space of possible antigens with a limited number of receptors [40,41]. Our results suggests another advantage of cross-talk: sensing accuracy. It would be interesting to study whether some of the biological systems that exhibit cross-talk make use of that benefit, and whether they are organized in a way that approaches the optimal solution.
Consider a receptor switching between two states, bound and unbound, where the bound times u and unbound times b are drawn from general distributions that depend on the external ligand environment. We will consider the problem of discriminating two possible environmental states, labeled H 0 and H 1 , given the time series of receptor states for a fixed time T , where T is much larger than the typical bound and unbound times. Our interest is in calculating the cumulants of the log-likelihood difference between the two hypotheses, L 0 − L 1 ≡ ∆L, under the hypothesis that either H 0 or H 1 is the true external state. We shall use P i (u) and Q i (b) to denote the distributions of unbound and bound times respectively for H i .
The moment generating function M (λ) of ∆L under H i is where the measure denotes an integral over all possible bound and unbound times in the interval T . The range of the integral can be split over distinct regions with a particular number of binding events n in time T i.e., n j=0 u j +b j > T but n−1 j=0 u j + b j < T , where u j and b j denote the unbound and bound time at the jth binding event. Conditioning over n using the Heaviside function, we have Note that L i is a sum of 2n independent contributions: L i = n j=1 p i (u j ) + n j=1 q i (b j ), where p i ≡ log P i and q i ≡ log Q i . The Heaviside function Θ can be replaced by its integral form where the pole at σ = 0 should be taken to be in the left half of the complex plane. Applying this expression, we have Using the same representation for the other Θ function, we have where ∆p(u j ) = p 0 (u j ) − p 1 (u j ) and similarly for ∆q. Simplifying, we have where we have defined Summing over n, we get From Cauchy's Residue Theorem, for large T , this integral is dominated by the residue from the smallest, positive pole σ such that f (σ, λ) = 1, which we call σ s (λ). Since we are interested in the cumulants of ∆L, which are generated by the Taylor series of log M (λ) as λ → 0, it is sufficient to consider only small λ. To see that σ s exists and is positive, we expand f (σ, λ) around f (0, 0) up to first order in a Taylor series where all derivatives here and below are evaluated at (σ, λ) = (0, 0). Since f (0, 0) = 1 and f (σ s (λ), λ) = 1, we have To keep the moment-generating function well-defined, for i = 0, we take λ → 0 − and for i = 1, we take λ → 0 + , which together ensure that for both cases σ s is a positive pole of the integrand in (A8). We circumvent the problem of calculating σ s for each P i and Q i by noticing that for large T , the cumulant generating function log M can be simply written as The mth-order cumulants are then obtained by taking the mth-order derivatives of σ s (λ) at λ = 0. Here, we will derive the expressions for the mean and the variance; higher-order cumulants can be obtained by taking further derivatives.
As noted above, f (σ s (λ), λ) = 1. Differentiating both sides by λ, we obtain From here, we get Taking the partial derivatives of f and evaluating at (0, 0) gives: where we have defined P = log P0 P1 , Q = log Q0 Q1 and n i = T tu+t b i is the total number of binding events on the receptor in time T . For instance, at (0,0), we have ∂f /∂λ = log P0 P1 + log Q0 Q1 i and ∂f /∂σ = u + b i . The variance can similarly be obtained by applying another derivative w.r.t λ on (A12). Finally, we get The expression above can be evaluated as in the examples above to obtain: Appendix B: Optimizing the proofreading scheme The variance ofx A is where f A = xe −rτ A + (1 − x) e −r τ A . We define y A = e −r τ A and write the above equation as To make the RHS of the above expression tractable for optimization, we observe that we are imposing a cutoff that discriminates between samples drawn from exponential distributions of means with ratio α −1 . As α → 0, the ratio gets larger and we expect the threshold to be placed much greater than mean bound time of non-cognate binding events, ∼ r −1 . Accordingly, we propose an ansatz that y α A = O(1) and y A 1 as α → 0. Using the ansatz, we simplify the equation above to get Optimizing the right hand side of the above equation w.r.t y A by taking the derivative in y A and equating to zero, we get which is reproduced in the main text and used in Figure 6. We verify then that as α → 0, e −r τ * A 1 and since α α → 1, we have e −αr τ * A = O(1). A similar expression can be derived for τ * B with x replaced by 1 − x in (B4).

Appendix C: Nonspecific ligand pool
With total concentration given by c tot = c 1 + c 2 + c 0 , the probability of a sequence of bound and unbound times {u R i , b R i } can be written as, with index R running over the receptors A and B, and index i running over the binding events n R in a fixed interval T . Now, log-likelihood L(x, y, c tot ) as a function of the fractions of the cognate ligands, x and y, and the total concentration, c tot , is given by, log xλ R,1 e (1−λ R,1 )r R,0 b R i + yλ R,2 e (1−λ R,2 )r R,0 b R i + 1 − x − y , This describes an ellipsoid in l all space. We are interested only in θ . So we obtain the marginal distribution of l 1 and l 2 and obtain the covariance matrix, Σ θ = JΣ θ J T , and the cost function Ω N S as the area of the ellipse centered at (l 1 , l 2 ) as Ω N S = det(Σ θ ) = det(JΣ θ J T ), where the Jacobian J given by