Mathematician Explains Optimal Stopping Strategy: The Wisdom of Dating and Algorithmic Decision-Making

A mathematician uses the secretary problem to explain optimal stopping and online algorithms, exploring decision-making under uncertainty.
Based on a mathematician's conversation on the Lex Fridman podcast, the article explores optimal stopping theory and its application to dating strategies. It analyzes the power and limits of worst-case analysis in algorithm design, noting that going beyond it by exploiting instance structure is an important open direction in theoretical computer science. Using the secretary problem, it introduces the core framework of online algorithms: under random input order, observing first and then choosing guarantees a constant competitive ratio. The mathematician stresses that complexity theory cannot offer matchmaking advice, but algorithmic thinking reveals the art of balancing generality and specificity under uncertainty, offering inspiration for real-world problems.
In a Lex Fridman podcast, a mathematician discusses optimal stopping theory and its application to dating strategies. This conversation not only reveals core challenges in algorithm design but also offers mathematical insight into how we make decisions under uncertainty.
The Limits and Transcendence of Worst-Case Analysis
The mathematician first explains the importance of worst-case analysis in algorithm design. Taking the SAT problem as an example: given an arbitrary formula, determine whether it is satisfiable. The key is that this analysis ignores the concrete structural details of the formula—clause size, connection topology, and so on—and instead attempts to provide a general solution for all possible inputs. This approach is "very powerful," because many algorithmic problems (such as maximum flow) can indeed be solved efficiently in the worst case.
But problems arise as well: is worst-case abstraction always useful? The mathematician points out that sometimes we need to understand the specific structure of an instance in order to do better. This is precisely the core of the open problem of "beyond worst-case analysis." He calls on theoretical computer science to work in this direction, although it is "very hard to pin down which details should be extracted for natural problems so that algorithms can exploit them."

The SAT problem (Boolean satisfiability problem) is a classic NP-complete problem in theoretical computer science: given a Boolean formula composed of variables, logical operators (AND, OR, NOT), and parentheses, determine whether there exists an assignment of variables that makes the entire formula true. Although no polynomial-time algorithm is known for the worst case, modern SAT solvers perform excellently on industrial instances by extracting structural features of formulas (such as clause length distribution, community structure, and variable occurrence frequency). This is a typical scenario of "beyond worst-case analysis"—using the specific structure of input instances to design more efficient algorithms, rather than merely pursuing a uniform worst-case guarantee for all possible inputs.
Online Algorithms and the Secretary Problem: Mathematical Strategies for Choosing a Partner
The conversation turns to a classic example of online algorithms—the secretary problem. Imagine a sequence of candidates appearing one by one (from 1 to n). At each moment you know only the current candidate's rank relative to the candidates you have already seen, and you do not know anything about future candidates. The goal is to maximize the probability of finding the best candidate when you must decide immediately whether to choose.
The mathematician describes the optimal strategy: first wait for a period as a "trial period," hiring no one; afterward, as soon as you encounter a candidate better than all previous ones, choose immediately. Under the assumption that the input order is uniformly random, this strategy guarantees a constant competitive ratio—that is, it performs well enough compared with the ideal case in which the order of all candidates is known in advance.

From Dating to Algorithms: The Art of Uncertainty
The mathematician admits: "I have no advice about whom you should marry; complexity theory will not give you that." But he acknowledges that the secretary problem does provide a mathematically optimal strategic framework, although when applied to decisions about interpersonal relationships, average-case rather than worst-case considerations may be needed.
The core of online algorithms lies in the "veil of uncertainty": we do not know what the input sequence will look like, but we hope to perform well regardless of the sequence. However, if an algorithm is not good enough for an application, we can try to model the world around us in order to do better. Here there is an art: deciding what to model and what not to model. The mathematician regards this as an extremely important area of exploration.

The competitive ratio is a core metric in online algorithm analysis, defined as the ratio between the algorithm's performance on the worst input sequence and the performance of the offline optimal algorithm (which knows the entire input sequence in advance). For the secretary problem, the classic strategy (first reject the first n/e candidates, then choose the first applicant better than all previous candidates) has a competitive ratio of about 1/e≈0.368, meaning it selects the best candidate with probability at least 37%, and this ratio is optimal. The competitive ratio provides a robustness guarantee that does not depend on assumptions about the input distribution. It is in the same lineage as worst-case analysis, but applies to online decision-making scenarios in which information arrives gradually.
The "veil of uncertainty" borrows the imagery of Rawls's "veil of ignorance" in political philosophy, but in the context of online algorithms it refers to the state of information deficiency faced by a decision-maker confronting an unknown input sequence: the algorithm must make irrevocable decisions without knowing future input. This concept emphasizes that the design goal of online algorithms is not to optimize for a particular sequence, but to maintain acceptable performance under all possible sequences. In contrast, if the input distribution or structure can be modeled (for example, by assuming that candidate quality follows some probability distribution), Bayesian methods or average-case analysis can be used to improve the strategy, but modeling itself entails assumption risk.
What Algorithmic Thinking Reveals About Real-World Decisions
This conversation reveals a deep connection between algorithm design and real-world decision-making. Worst-case analysis provides robustness guarantees but may overlook exploitable structure; the online algorithm framework provides competitive guarantees when information is incomplete. For real-world problems such as dating and hiring, the strategy from the secretary problem, though simplified, reminds us that in an uncertain environment, setting an observation period and then decisively choosing an option better than past ones may be a reasonable heuristic.
The mathematician emphasizes that going beyond worst-case analysis is an important direction for theoretical computer science, and that how to balance generality and specificity is an eternal art in algorithm design and even in human decision-making.
One-line Summary
A mathematician uses the secretary problem to explain optimal stopping and online algorithms, exploring the art of decision-making under uncertainty.
Paragraph Summary
Based on a conversation with a mathematician on the Lex Fridman podcast, this article explores optimal stopping theory and its application to dating strategies. It first analyzes the power and limits of worst-case analysis in algorithm design, pointing out that going beyond worst-case analysis and exploiting instance structure is an important open direction in theoretical computer science. It then uses the secretary problem as an example to introduce the core framework of online algorithms: under the assumption of random input order, observing first and then choosing guarantees a constant competitive ratio. The mathematician stresses that complexity theory cannot offer advice on choosing a spouse, but algorithmic thinking reveals the art of balancing generality and specificity in decision-making under uncertainty, offering inspiration for real-world problems.
Related articles

Deleted Reddit Post Sparks Debate Over AI Content Moderation
A Reddit post removed with only a 'Removed by Reddit' notice highlights AI content moderation's transparency gaps, misjudgment risks, and appeal challenges for platforms and creators.

DSH + Ollama Local LLM Deployment in Practice: Free Chat with Da Fei Yu
Bilibili creator tests DSH + Ollama local LLM deployment end to end: Ollama install, Xunlei-accelerated downloads, ModelScope GGUF model import, DSH custom API address setup, and a comparison of Qwen 3.5 4B, 8B, Gemma, and other models on 8GB VRAM, with advice on choosing local deployment vs. API calls.

Tested: A $899 Mac Mini vs. a $200/Month AI Subscription
Real-world test of whether an M4 Mac mini can replace a $200 AI subscription: 16GB can't fit large models, and both speed and quality fall short—but privacy, no caps, and near-zero running costs make it an ideal host for an always-on agent. Includes buying advice per configuration and money-saving strategies.