Manuscript Offprint
arXiv:2610.10253On the Cyclic Assumption of the Cow-Path Search Algorithm
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
In the cow-path problem, a cow must find a goal lying at an unknown distance on one of paths connected only at the origin, and performance is measured by competitive ratio. An efficient randomized algorithm is designed in [2], in which the cow visits the paths in a fixed cyclic order. The algorithm is proved to be optimal for in [2], and for all in [3] with a claim that no algorithm does better than the best cyclic one. This note provides a detailed proof of that claim.
1 Introduction
In the w-lane cow-path problem, there are w infinite paths from a common origin and a goal lying at an unknown distance on one of these paths. A cow (or robot) starts at the origin but does not know which path contains the goal or how far the goal is, and it discovers the goal only upon reaching it. Its objective is to find the goal while minimising the total distance travelled, and its performance is measured by competitive ratio.
Baeza-Yates, Culberson and Rawlins [1] determined the optimal deterministic competitive ratio, , which is 9 for w = 2. Kao, Reif and Tate [2] introduced a randomized algorithm with competitive ratio
which is approximately 4.5911 for , proved its optimality for , and conjectured its optimality for . Kao, Ma, Sipser and Yin [3] subsequently proved this conjecture.
A common feature of these analyses is that the algorithm visits the paths in a fixed cyclic order, which means that the algorithm visits all the w paths in its first w visits and then repeatedly searches these paths in that order. Fact 4 in [3] stated explicitly that it suffices to analyze these cyclic algorithms but left a detailed proof to a manuscript by us [4], which was never formally published. This note constructs a complete proof from some surviving hand-written notes.
Corresponding author: yiqun@alum.mit.edu
2.1 Algorithms
A search algorithm is represented by a sequence
fixed in advance and independent of the goal's location, where and are the path and length of step , respectively. To avoid any ambiguity, a step in an algorithm sweeps a path from the origin to a finite distance and then returns to the origin.
We write for path 's frontier, defined to be the distance to which it has been swept when step is about to begin. Note that .
Step costs in travelled distance, out and back—with one exception, where the goal located at some distance from the origin is found during this step. On that step the cow stops at the goal on the outward leg and does not return, so step costs rather than , and the algorithm ends. The total distance travelled is , the sum running over steps and excluding step itself.
Throughout, ; for the cow simply walks down the single path and the ratio is 1. Without loss of generality, we only need to work on algorithms with a finite expected competitive ratio, because such an algorithm was constructed in [2] already. This requires that the cow will not continue on a path indefinitely (i.e., is finite for all ) and it will search every path without a constant upper bound (i.e., each path's sweep lengths are unbounded): otherwise the goal may never be found, leading to an infinite expected competitive ratio.
2.2 The distribution and competitive ratio
At the highest level, Yao’s principle [6] allows us to lower-bound the worst-case expected ratio of every randomized algorithm by proving a lower bound on the expected ratio of every deterministic algorithm under a fixed input distribution. The goal’s distribution is that specified in [2, p. 70], where the path containing the goal is chosen uniformly from the w paths, and the distance x along that path has density
Throughout, is fixed.
Let H denote the per-path measure, with density
Thus each path carries mass 1/w. If the goal is found at step k, the competitive ratio is
where the leading 1 accounts for the final trip to the goal and the remaining term accounts for unsuccessful round trips.
Deleting search steps that do not cover any new ground, we can also assume
This way, the outward leg retraces the already swept portion , and only is searched for the first time. Under this assumption (otherwise the integrals below would be ill-defined), summing over the goal locations gives
Each unit of unsuccessful travel adds 1/h to the ratio. For a path searched to frontier x, define
For ease of notation, define
Then
Also,
so , and as .
2.3 States, remaining weights, and contributions
The state of the search is defined by the collection of all paths' frontiers plus the location of the cow. By default, the cow is understood to be at the origin, when not specified explicitly, and so a state can be understood to be the collection of all frontiers of the paths. With such an understanding, we use capital letter F to denote a state.
In particular, assigns to each path a frontier . We write for the state when step is about to be taken, so that .
We call the remaining weight on the path: the probability mass beyond x normalized by h, reflecting that the same extra travel is more costly relative to a nearby goal. The function is positive, strictly decreasing, and smooth; searching farther reduces this remaining weight. The constant is an overall positive factor in every comparison below and cancels; only the exponent matters.
For a given state F, summing the remaining weights over all paths gives us the total remaining weight
The total remaining weight depends only on the current frontiers and is unchanged by relabelling paths. Note that under such definitions, and are total remaining weights before and after step , respectively.
We next define the contribution for a full round-trip step that travels the distance for goal locations that remain un-searched after step . The total remaining weight after step is , and step contributes to the expected future cost. Summing over all steps of algorithm starting from gives us the following:
Notice that the above quantity is unchanged by permuting the labels of the paths, since is a symmetric sum and all paths carry the same and the same dynamics. In addition, affects both the travel distance now and the post-step remaining weight through : a longer sweep costs more travel now but leaves less remaining weight.
For the initial state , in which for every path , interchanging the nonnegative terms in (2) gives the expected competitive ratio
Minimising the expected competitive ratio is therefore equivalent to minimising , which we will work on in the rest of the paper.
Equation (9) is a sum over all steps, so comparisons of algorithms modified from a certain step onwards must account for their continuations, defined to be the remaining steps of an algorithm starting from a certain state. By (9) the contribution of a step depends on the past only through the current state. Identical continuations started at the same state have equal contributions, and the infimum of the contribution of a continuation depends only on that state.
Finally, since we only need to deal with algorithms with finite competitive ratios, we assume in all our arguments that the algorithms we will modify all have finite contributions.
3 Proposition 1: prioritize a least-frontier path
Proposition 1 (least-frontier first). If algorithm X sweeps a path whose frontier is strictly larger than the least frontier at some step, then X can be modified into another algorithm such that starting from that state and that step the contribution of is strictly less than that of X.
Proof. Suppose that in X, starting from state F, step t first sweeps path B, whose frontier is b, to a distance y > b, while another path A has frontier a < b.
Construct from X as follows. Make no change before step t, but let step t sweep A to y, which is larger than b > a, and then follow the remaining steps of X with the labels A and B interchanged, keeping all search distances unchanged.
To make satisfy condition (1), we skip any prescribed sweep of B whose searched distance is at most b (note the relabelled continuation of X starts with A at y and B at a, whereas starts its continuation with A at y and B already at b > a). The prescribed search distances on B are strictly increasing and unbounded, and so only finitely many sweeps are skipped.

Figure 1: Comparison of X and in the proof of Proposition 1.
For X, let be the contributions of step t and continuation, respectively. Let be the corresponding contributions of . It suffices to show
For step t, X leaves A at a and advances B to y, while advances A to y and leaves B at b. All other frontiers are unchanged. The post-step remaining weights are therefore
for X and respectively. Both steps have length y, so
(11)
because and is strictly decreasing.
For the continuation, interchanging the labels A and B preserves the contribution of X, since is symmetric in the path frontiers. Compare this relabelled continuation with that of . Until the first prescribed sweep of B beyond b, the frontier of B in is at least as large as that of X, while all other frontiers agree at corresponding steps. From that sweep onward, the states coincide. Consequently, every retained step has the same length and no larger post-step remaining weight, and so it contributes no more. The skipped steps contribute nothing. Thus
Combining the comparisons gives
☐
4 Proposition 2: each sweep advances its path by strictly more than a factor
In what follows, let be a step in algorithm , let be the next step sweeping , and define
Lemma 1 (stationarity). Unless
replacing by a suitable y (and leaving all other steps unchanged) yields an algorithm contributing strictly less than X.
Proof. Define
the total remaining weight (post-step-t) associated with all paths other than .
We vary only the length of step , replacing by , while leaving all other steps unchanged. The feasible range is , so is an interior point and can be varied in either direction.
Step now contributes . During the steps strictly between and , path remains at frontier , so its associated contribution is . At step , its frontier becomes . Thus the total contribution is
where K collects all contributions unaffected by y.
Differentiating (14),
At , we have and , and hence
If this derivative is positive, a small decrease of improves the algorithm; if it is negative, a small increase does. Thus an algorithm admitting no one-step variation improvement must satisfy
Lemma 1 says that each step must balance its current sweep length against the accumulated sweep lengths until that path is swept again. We call X stationary if equality (13) holds at every step.
Proposition 2 (advance factor). For a stationary algorithm, if
at some step t, then deleting step t yields an algorithm with strictly less contribution.
Proof. Define
Deleting step saves its contribution . However, until step , path remains at frontier rather than , adding contribution
Note that condition (1) holds since the next sweep of this path reaches and that every path remains swept without bound. Thus it suffices to show that the additional contribution is smaller than the saving.
Since X is stationary, by Lemma 1, the following equality holds:
Since , we obtain
Now let . Since and , we have
Combining inequalities (15) and (16) gives
The deletion penalty is therefore strictly smaller than the saving, so deleting step t yields an algorithm contributing strictly less.
5 Proposition 3: step lengths are nondecreasing
In this section, we analyze the effect of exchanging the search lengths of two consecutive sweeps, especially when the lengths decrease. By relabelling the paths, we can reduce the comparison to the two exchanged steps.
Let X be an algorithm with a finite contribution. Suppose step k sweeps path A from a to u, and step sweeps a distinct path B from b to v. Define as follows:
• Steps 1, ..., k - 1 are the same as in X.
• Step k sweeps A from a to v, and step sweeps B from b to u.
• For every step , use the same sweep length as X, with the path labels A and B interchanged.
Lemma 2 (exchange of adjacent sweep lengths). For any algorithm X and its corresponding , if , then
Proof. First, the two algorithms agree before step . Secondly, after step , paths have frontiers in and in and all other frontiers agree. Interchanging the labels after step therefore makes the two states identical. So the continuations of and are the same.

Post-step- frontiers:
Post-step- frontiers:
Post-step- frontiers:
Previously searched
sweeps in steps and
Figure 2: Comparison of X and in Lemma 2. After relabelling, the frontiers of match those of X, allowing the same continuation of the algorithm.
In sum, only steps and contribute to any difference. Moreover, since , both algorithms satisfy condition (1) and so we can use our established formulae to compute the difference of for the two algorithms. Write and for the corresponding remaining weights in . Since the states after the two sweeps differ only by relabelling,
Also,
Thus
Note that (18) involves only , the frontier of the path swept second, and not .
Proposition 3 (monotonicity). Let X be an algorithm started from such that no algorithm from contributes strictly less than X. Then the step lengths of X are nondecreasing.
Proof. Because no algorithm contributes strictly less than X, no local modification improves it either. Also, X has finite contribution, as otherwise an algorithm sweeping the paths cyclically with a fixed geometric ratio larger than 1 will be an improvement. Hence, by Proposition 1, Lemma 1 and Proposition 2 in contrapositive form,
• every step sweeps a path of least current frontier;
• X is stationary;
• every step satisfies .
Suppose the step lengths are not nondecreasing in X, and choose an adjacent decrease (i.e., ). Write
Steps and sweep different paths, because two consecutive sweeps of the same path must strictly increase its frontier. Let
Since step k sweeps a path of least frontier,
Also, Proposition 2 applied to step gives
The above two inequalities imply , and so we can use Lemma 2 now. Substituting into (18) and cancelling , the exchange strictly lowers the contribution if and only if
To prove (21), we may assume : dividing by multiplies its left-hand side by the positive factor , preserving its sign. We then have . Define
We must show .
For fixed v, we have . Thus it is enough to show that g increases as u moves above v. Differentiating with respect to u,
The role of Proposition 2 is now clear: alone is not enough. At the diagonal,
which is positive exactly when , since .
Moreover, for , , so . Therefore,
which is already proved to be positive in the diagonal case. Thus (21) is proved. So Lemma 2 gives an algorithm that contributes strictly less than X, leading to a contradiction.
6 Main result
The theorem below shows that the lower bound established in [3] for cyclic algorithms is a lower bound for all algorithms. Therefore, the cyclic assumption may be dropped, as claimed in Fact 4 of [3].
Theorem. The least expected competitive ratio over all algorithms started from the state can be attained by a cyclic algorithm.
Proof. First, we should not take for granted that an optimal algorithm exists: there could be infinitely many algorithms that approach optimality without ever reaching it. The proof that an optimal algorithm exists for our chosen distribution is rather technical and left to Appendix A. Here, we simply start with an optimal algorithm X and prove that X can be converted into a cyclic algorithm.
By Propositions 1 and 3, every step of X sweeps a path of least frontier and the sweeping lengths satisfy . Note that each path's frontier is the length of its last sweep, or 1 if unswept. We construct an algorithm Y from X by breaking every least-frontier tie in favor of the least recently swept path and interchanging the tied labels from that step on; this preserves the multiset frontiers and the contribution.
The resulting algorithm Y is cyclic. Since every , the first steps sweep distinct paths. Inductively, suppose steps sweep distinct paths. The least frontier is then , held by , which is also the least recently swept path. Step therefore sweeps , continuing the cyclic order. The cyclic algorithm Y attains the least competitive ratio.
7 Discussion
Professor Allan Borodin recently pointed out to us that Schuierer [5] introduced another probability distribution to give an alternative and simpler proof of the lower bound established in [3], but his proof relied on the cyclic assumption. It is natural to ask if one can prove an optimal algorithm must be cyclic under his distribution (a truncated where density is 0 beyond a bound ). However, our arguments use the facts that is positive, strictly decreasing, and smooth, whereas under the function vanishes at and beyond . Moreover, each path is swept to in finitely many steps in [5], and algorithm modifications like ours become difficult. Nevertheless, numerics for suggest the optimal algorithm may still be cyclic.
Acknowledgements
We thank Professor Allan Borodin for his recent inquiry about the cyclic assumption, which prompted this research note. His inquiry made us realize there is a continued interest in our proof, which was obtained in 1994 but probably not typed up.
With efforts, we were able to find only some hand-written claims and proof sketches that survived two cross-country moves. The detailed proof presented here is constructed from those notes, with the aid of AI, especially Claude Opus 5, in September 2026.
We thank Professor Dan Kleitman again for his invaluable discussions, which helped us come up with the original proof when we conducted this research at MIT in the 1990s.
References
[1] R. A. Baeza-Yates, J. C. Culberson and G. J. E. Rawlins, Searching in the plane, Information and Computation 106 (1993), 234–252.
[2] M.-Y. Kao, J. H. Reif and S. R. Tate, Searching in an unknown environment: an optimal randomized algorithm for the cow-path problem, Information and Computation 131 (1996), no. 1, 63–79; preliminary version in Proc. 4th ACM-SIAM Symposium on Discrete Algorithms (1993), 441–447.
[3] M.-Y. Kao, Y. Ma, M. Sipser and Y. Yin, Optimal constructions of hybrid algorithms, Journal of Algorithms 29 (1998), 142–164; preliminary version in Proc. 5th ACM-SIAM Symposium on Discrete Algorithms (1994), 372–381.
[4] Y. Ma and Y. Yin, On the cyclic assumption of an on-line search algorithm, manuscript, 1994; earlier version of this note.
[5] S. Schuierer, A lower bound for randomized searching on m rays, in: Computer Science in Perspective (Ottmann Festschrift), Lecture Notes in Computer Science 2598, Springer, 2003, 264–277.
[6] A. C.-C. Yao, Probabilistic computations: toward a unified measure of complexity, Proc. 18th IEEE Symposium on Foundations of Computer Science (1977), 222–227.
A Existence of an optimal algorithm
We begin by defining the following infimum, as opposed to a minimum, because we do not want to assume the infimum is reachable by an algorithm:
The proof in this section is rather technical but independent of any of the propositions proved in earlier sections. In particular, the following general statement has nothing to do with cyclicity.
Statement. For , there exists an algorithm starting from such that .
Proof. Write , which is finite because sweeping the paths cyclically with geometrically increasing lengths gives finite contribution. Choose algorithms from such that
Denote step lengths and swept paths of by and . We will extract a limiting sequence and show that it yields an algorithm attaining .
Part 1: bound each step length so that convergent subsequences can be extracted.
We show that, for every fixed , there is a finite constant , independent of , such that . The proof proceeds by induction on . Since every term of (9) is nonnegative,
Base case: . The paths other than still have frontier 1 after the first step. Thus . Define
where the denominator is positive as . Therefore, by (22).
Induction step: Now suppose for all and all , and define
where
After step , every path other than has frontier at most : its frontier is either 1 or a length from an earlier step. Since is decreasing, each of these paths contributes at least , and so . Hence, by (22), thereby completing the induction.
Part 2: extract a limiting sequence whose contribution is at most .
Among the algorithms , some path label at step 1 occurs infinitely often. Select a subsequence on which this label is constant, and call it . Since the lengths lie in , the Bolzano–Weierstrass theorem gives a further subsequence on which they converge to some .
Repeat these two selections for step 2, then step 3, and so on, each time working within the preceding subsequence. For each step , define to be the constant path label and to be the limit of the step lengths. Further selections preserve the labels and limits established earlier. This defines the following algorithm:
We will verify in Part 3 that every path is swept without bound and every step strictly advances its path's frontier.
Fix and consider the subsequence obtained after the selections for step . Along this subsequence, the first path labels agree with those of , and the corresponding lengths converge. The frontiers therefore also converge, giving for . By continuity of ,
Thus, taking limits along this subsequence,
where the inequality holds because the omitted terms are nonnegative. Since this holds for every T, taking gives
Part 3: ensure unbounded search and conclude optimality.
First, every path is swept without bound in (so that the resulting algorithm always finds the goal). Otherwise, some path would have frontier at most at every step, giving . Since ,
contrary to Part 2.
Note that no step would have : such a step changes no frontier but has a positive contribution and can be deleted with a reduced total contribution, contradicting the definition of .
By the definition of and the contribution bound from Part 2,
Thus , as required.
B Terminology and notation
| Notation/term | Meaning |
|---|---|
| Number of paths. | |
| Distance of the goal from the origin. | |
| Parameter of the input distribution. | |
| Input distribution: conditional distance density , for , and uniform choice of path. | |
| Per-path measure, with for . | |
| Exponent in the remaining-weight function. | |
| Scaling constant in . | |
| Advance-factor threshold in Proposition 2; . | |
| Stationary | Algorithm is stationary if . |
| Next step after that sweeps the same path . | |
| Path swept at step . | |
| Sweep length at step , measured from the origin. | |
| Frontier of path before step . | |
| State before step : the collection of all path frontiers. | |
| Initial state, with every frontier set to . | |
| Remaining weight on a path with frontier . | |
| Total remaining weight in state . | |
| Total remaining weight right before step . | |
| Total remaining weight associated with all paths other than after step . | |
| Contribution of step to the expected competitive ratio. | |
| Contribution of algorithm , started from state : . | |
| Total (one-way) sweep length from step up to, but excluding, step : | |
| . | |
| Total (one-way) sweep length strictly between steps and : | |
| . |