INAIO Guide Stage 1 7Combinatorics and Discrete Reasoning
7.6 Worst-case reasoning
Prove a guarantee by showing how long an unfavourable outcome can last, then why one more choice forces success.
A question asking what is guaranteed is different from one asking what is likely. You must allow the most inconvenient sequence of choices that the rules permit. If a successful outcome is unavoidable even then, you have a worst-case guarantee. This appears in drawing objects without looking, dividing items among categories, and deciding how many questions an algorithm needs.
This is intermediate counting and reasoning. MIT's counting notes introduce the pigeonhole principle; the broader MIT course has more exercises. The casework method from Module 7.5 helps when the categories have different capacities.
A basic idea: delay success as long as possible
Imagine a drawer with socks in three colours and enough socks of each colour. How many must you draw without looking to guarantee a same-colour pair? The first three could all have different colours; no pair is forced. A fourth sock must match one of those three colours. Thus the guarantee is four draws. The first three form a counterexample to any smaller claimed guarantee, while the fourth proves the upper bound.
A quick tour of guarantees
The pigeonhole principle says that placing more than objects into categories forces some category to hold at least two. More generally, among objects in categories, one category has at least objects. For a guaranteed threshold, find the largest unsuccessful arrangement and add one; then check that such an unsuccessful arrangement really can occur.
Worst-case reasoning also applies to algorithms. A yes-or-no question can distinguish at most two possibilities. After such answers, there are at most answer patterns. To identify one of equally possible labels in every case, we need . This is a lower bound; an actual strategy must still show that the bound can be reached.
Do not replace a guarantee with an average. Randomly drawn socks will often match earlier, but “often” does not prove the fourth-draw threshold.
Application 1: a matching sock
The drawer contains at least four socks of each of three colours. What is the smallest draw count that guarantees two of the same colour?
- Draw one of each colour: three socks with no match are possible, so three draws do not guarantee success.
- The fourth sock must have one of the same three colours, making a pair.
- Therefore the smallest guaranteed number is .
Application 2: identify a hidden number
A hidden integer is one of . You may ask yes-or-no questions whose answers can guide later questions. How many questions are needed in the worst case?
- Three questions produce at most different answer strings, too few to distinguish integers. At least four are necessary.
- Ask whether the number is greater than . That leaves a group of eight; ask whether it is in the upper half of that group, then repeat twice more.
- The candidate group shrinks . Four questions are sufficient, so the worst-case minimum is four.
Resources
| Source | Title | Why read it |
|---|---|---|
| MIT OpenCourseWare | Lecture 17: More Counting | Study the pigeonhole principle and guarantee proofs. |
| MIT OpenCourseWare | Mathematics for Computer Science | Use the counting and algorithm sections for more practice. |
Finished this module? Mark it done.
Comments
Stuck on something, spotted a mistake, or found a resource that helped you? Tell us below.
Loading comments