Extremal Principle and Working Backwards

Study Sheet

Extremal Principle and Working Backwards

Choose the largest, the smallest, the closest — and reason from the answer toward the start

The Extremal Principle

Concept
Pick the extreme object

Among finitely many objects, choose the one maximizing or minimizing something — the largest number, the point farthest from a line, the longest chain, the polynomial of least degree. Its extremality forces a property, or a "more extreme" object contradicts the choice.

The extremal principle is existence-by-optimization. It proves that some pair of points is at minimum distance, that some vertex has minimum degree, that some solution has minimal xx — and then the argument works with that special object. On the Putnam it is often the whole proof: "let MM be the maximum of the aia_i; then the equation at index ii gives M≤…M \le \ldots", and the inequality closes.

Concept
Vieta jumping

For an equation quadratic in each variable, take a solution with minimal x+yx + y; Vieta gives a second root, producing a smaller solution unless the minimal one is a fixed base case. Classic: if a2+b2ab+1\frac{a^2 + b^2}{ab + 1} is an integer, it is a perfect square.

Reminder — Vieta's formulas:  r1+r2=−ba,r1r2=car_1+r_2=-\frac{b}{a},\qquad r_1 r_2=\frac{c}{a}

Vieta jumping is the extremal principle applied to a family of solutions, with the quadratic formula supplying the "smaller solution". Write the equation as a quadratic in aa, note the other root a′=kb−a=b2−kaa\prime = kb - a = \frac{b^2 - k}{a} is an integer, show 0≤a′<a0 \le a\prime < a, and descend until a′=0a\prime = 0, which forces k=b2k = b^2.

Concept
Working backwards

Start from what you want and ask what would suffice. "f(n)=n2f(n) = n^2 would follow if ff is multiplicative and f(p)=p2f(p) = p^2…" Reduce the goal to a chain of sufficient conditions until one is something you can prove directly; then write it forwards.

Working backwards finds the proof; it is not the proof. The written solution must run from hypotheses to conclusion. The habit that makes it safe: at each backwards step, note whether the implication is reversible ("it suffices to show" is fine; "this is equivalent to" needs both directions).

Side note
Where it goes wrong

Choosing an extremum that may not exist (a maximum over an infinite set) — say why it exists (finiteness, compactness, well-ordering). And in Vieta jumping, forgetting to prove the new root is non-negative and an integer.

Try it
Try it: extremal

Positive reals a1,…,ana_1, \ldots, a_n satisfy ai=ai−1+ai+12a_i = \frac{a_{i-1} + a_{i+1}}{2} for all ii (indices mod nn). Show all aia_i are equal.

Show the answer

Let M=max⁡ai=ajM = \max a_i = a_j. Then aj−1+aj+1=2Ma_{j-1} + a_{j+1} = 2M with both terms ≤M\le M, so both equal MM. Repeat around the cycle: every ai=Ma_i = M.

The Extremal Principle, Worked

Tip
Choose the extreme, then read off an inequality

Take the object that is largest or smallest in some measure — a minimum label, a closest pair, a point nearest a line. Extremality says every competitor is at least as large; apply the problem's condition AT the extreme object and compare.

The condition of a problem usually relates an object to its neighbours: an average, a distance, a count. At an ordinary object this relation says little, but at an extreme one it collides with extremality — a minimum that equals an average of values at least as large forces equality everywhere nearby, and a nearest configuration that produces a nearer one is a contradiction. The one obligation is existence: the extreme object must exist, which is automatic in a finite set or among positive integers and must be argued anywhere else.

Example
Worked: labels that are averages (folklore)

Every point of the integer lattice Z2\mathbb Z^2 is labelled with a positive integer, and each label is the average of the labels of its four neighbours. Show that all labels are equal.

Step 1 — the labels are positive integers, so a smallest label mm exists (well-ordering), attained at some point pp.

Step 2 — at pp: m=14(a+b+c+d)m = \tfrac14(a + b + c + d) with each neighbour label ≥m\ge m. If any were >m> m the average would exceed mm. So all four neighbours have label mm.

Step 3 — each of those neighbours is again a minimum, so the argument repeats from them. Every lattice point is reached from pp by a finite chain of neighbour steps, so every label is mm. ■\blacksquare

How to find it. "Equal to the average of its neighbours" means "never strictly below all neighbours", which is only useful at a point below all of them — a minimum. Positivity and integrality are there to make the minimum exist.

Example
Worked: a line through exactly two points (Sylvester–Gallai)
PABCQℓ
Kelly’s proof: if ℓ held three points, two of them (B, C) would lie on one side of the foot Q, and B is closer to line PC than P is to ℓ.

Finitely many points in the plane are not all on one line. Show that some line passes through exactly two of them.

Step 1 — consider all pairs (P,ℓ)(P, \ell) where ℓ\ell is a line through at least two of the points and PP is one of the points not on ℓ\ell. There are finitely many such pairs, and at least one (the points are not collinear). Choose the pair with the SMALLEST distance from PP to ℓ\ell.

Step 2 — suppose ℓ\ell contains three or more of the points. Let QQ be the foot of the perpendicular from PP to ℓ\ell. Two of the points on ℓ\ell lie on the same side of QQ (counting QQ itself as either side); call them BB and CC with BB between QQ and CC (possibly B=QB = Q).

Step 3 — the line PCPC passes through two of the points and does not contain BB. The distance from BB to line PCPC is less than the distance from QQ to line PCPC (because BB lies on segment QCQC), which is less than PQPQ (a leg of the right triangle PQCPQC is longer than the altitude from QQ — or, with B=QB = Q, directly). So (B,PC)(B, PC) is a closer pair: contradiction.

Step 4 — therefore ℓ\ell contains exactly two of the points. ■\blacksquare

How to find it. Sylvester's question waited 40 years for a proof; Kelly's is the extremal principle applied to the right set — not points or lines alone but point–line PAIRS, measured by distance. When the natural objects give nothing, extremize over pairs of them.

Example
Worked: water pistols (folklore)

An odd number of people stand in a field, all pairwise distances distinct. At a signal each person shoots the nearest other person. Show that someone stays dry.

Step 1 — induct on the odd number n=2k+1n = 2k + 1, starting at n=3n = 3 (n=1n = 1 is vacuous).

Step 2 — take the CLOSEST pair A,BA, B. Each is the other's nearest person, so they shoot each other.

Step 3 — if anyone else also shoots AA or BB, then AA and BB absorb at least 33 of the nn shots, and the other n−2=2k−1n - 2 = 2k - 1 people receive at most n−3=2k−2n - 3 = 2k - 2 shots: someone among them is dry.

Step 4 — otherwise nobody else shoots at AA or BB, and A,BA, B shoot only each other; so the other 2k−12k - 1 people shoot only among themselves, exactly as if AA and BB were absent (each one's nearest person is not AA or BB). By the induction hypothesis someone among them is dry. For n=3n = 3, Step 4 cannot happen, since the third person must shoot AA or BB. ■\blacksquare (For an even number of people it fails: pair everyone up in far-apart couples.)

How to find it. Shooting the nearest person is a local minimum condition; the global minimum — the closest pair — is the one configuration whose behaviour is completely determined. Removing it leaves a smaller instance of the same problem.

Side note
Where it goes wrong

Allow arbitrary real labels in the averaging problem and rerun the proof: "let mm be the smallest label." The labelling f(x,y)=xf(x, y) = x satisfies the condition, since 14((x−1)+(x+1)+x+x)=x\tfrac14\left((x - 1) + (x + 1) + x + x\right) = x, and it is not constant. The broken step is Step 1: this labelling has no smallest value. Positivity alone would not rescue the proof either, because positive reals can approach their infimum without attaining it. (For positive real labels the conclusion is still true — a discrete Liouville theorem — but it needs a different argument.) Before using "the smallest", say why it exists.

Try it
Try it: untangling segments

nn red and nn blue points lie in the plane, no three collinear. Show that they can be joined in nn red–blue pairs by segments no two of which cross.

Show the answer

There are finitely many ways (n!n!) to pair the reds with the blues; take one with the smallest total segment length. Suppose segments R1B1R_1B_1 and R2B2R_2B_2 cross at XX. Replace them by R1B2R_1B_2 and R2B1R_2B_1. By the triangle inequality, R1B2<R1X+XB2R_1B_2 < R_1X + XB_2 and R2B1<R2X+XB1R_2B_1 < R_2X + XB_1 (strict, since no three points are collinear), and adding gives R1B2+R2B1<R1B1+R2B2R_1B_2 + R_2B_1 < R_1B_1 + R_2B_2. The new pairing is shorter: contradiction. So the shortest pairing has no crossings.

Vieta Jumping, Worked

Tip
Jump to the other root

For an equation that is quadratic in each variable, fix all but one variable, say xx; if x=ax = a is a root of the quadratic x2−px+q=0x^2 - px + q = 0, so is a′=p−a=qaa' = p - a = \tfrac qa. Starting from a solution with the smallest sum of variables, the jump produces a smaller solution unless a base case is reached.

Vieta's formulas give the second root in two forms, and each form carries information: a′=p−aa' = p - a shows a′a' is an integer when pp and aa are, and a′=qaa' = \tfrac qa controls its sign and size. Replacing aa by a′a' keeps every equation of the problem true, so solutions come in chains, and the chain moves downward when aa is the larger root. A minimal solution therefore has no smaller neighbour, which pins it to a small base case — and every solution descends to one of the base cases. The two checks that make it rigorous: a′a' is a positive integer (or the case a′≤0a' \le 0 is handled), and a′<aa' < a.

Example
Worked: the famous one (IMO 1988/6)

Positive integers a,ba, b are such that k=a2+b2ab+1k = \dfrac{a^2 + b^2}{ab + 1} is an integer. Show that kk is a perfect square.

Step 1 — fix kk and suppose it is not a square. Among all pairs of positive integers with a2+b2=k(ab+1)a^2 + b^2 = k(ab + 1), take one with a+ba + b minimal and a≥ba \ge b.

Step 2 — as a quadratic in XX, X2−kbX+(b2−k)=0X^2 - kbX + (b^2 - k) = 0 has the root aa; the other root is a′=kb−a=b2−kaa' = kb - a = \tfrac{b^2 - k}{a}, an integer by the first form.

Step 3 — a′≠0a' \ne 0, since a′=0a' = 0 would mean k=b2k = b^2. And a′>0a' > 0: if a′<0a' < 0, then a′b+1≤0a'b + 1 \le 0 and a′2+b2=k(a′b+1)≤0a'^2 + b^2 = k(a'b + 1) \le 0, impossible.

Step 4 — a′=b2−ka<b2a≤aa' = \tfrac{b^2 - k}{a} < \tfrac{b^2}{a} \le a (using b≤ab \le a). So (a′,b)(a', b) is a solution in positive integers with a′+b<a+ba' + b < a + b: contradiction. Hence kk is a square. ■\blacksquare Example: (a,b)=(8,2)(a, b) = (8, 2) gives 6817=4\tfrac{68}{17} = 4, and the chain (8,2)→(2,0)(8, 2) \to (2, 0) ends exactly at a′=0a' = 0, k=b2k = b^2.

How to find it. The expression is symmetric and quadratic in each variable, and the claim is about kk alone — so fix kk and study the solution set as a whole. Vieta produces a new solution from any old one; the only way the descent can stop is at a′=0a' = 0, and a′=0a' = 0 is precisely k=b2k = b^2.

Example
Worked: which kk occur? (folklore)
xy510510(13, 5)(5, 13)(2, 5)(5, 2)(1, 1)
The solutions of x² + y² + 1 = 3xy on the hyperbola: horizontal and vertical Vieta jumps climb from (1, 1) along two mirror-image chains.

Find all positive integers kk for which x2+y2+1=kxyx^2 + y^2 + 1 = kxy has a solution in positive integers.

Step 1 — take a solution with x+yx + y minimal and x≥yx \ge y.

Step 2 — if x=yx = y: 2x2+1=kx22x^2 + 1 = kx^2, so x2(k−2)=1x^2(k - 2) = 1, forcing x=1x = 1 and k=3k = 3.

Step 3 — if x>yx > y: the other root of X2−kyX+(y2+1)=0X^2 - kyX + (y^2 + 1) = 0 is x′=ky−x=y2+1xx' = ky - x = \tfrac{y^2 + 1}{x}, a positive integer. Since x≥y+1x \ge y + 1, x′≤y2+1y+1≤yx' \le \tfrac{y^2 + 1}{y + 1} \le y (the last step is y2+1≤y2+yy^2 + 1 \le y^2 + y). Then (x′,y)(x', y) is a positive solution with x′+y≤2y<x+yx' + y \le 2y < x + y: contradiction with minimality.

Step 4 — so every kk that occurs has a minimal solution with x=y=1x = y = 1, and then k=3k = 3. Conversely k=3k = 3 works: 1+1+1=31 + 1 + 1 = 3. Answer: k=3k = 3 only.

How to find it. Try small kk by computer or by hand: k=3k = 3 has (1,1),(2,1),(5,2),…(1, 1), (2, 1), (5, 2), \ldots and nothing else appears. The descent explains why: every solution falls to the diagonal, and the diagonal forces k=3k = 3.

Side note
Where it goes wrong

A common broken version of the IMO 1988/6 proof: "the other root a′=kb−aa' = kb - a is smaller than aa, so we descend forever, which is impossible; hence there are no solutions unless…" The descent does not run forever — it stops the moment a′a' is no longer a positive integer. For (a,b)=(30,8)(a, b) = (30, 8), k=964241=4k = \tfrac{964}{241} = 4, the chain is (30,8)→(8,2)→(2,0)(30, 8) \to (8, 2) \to (2, 0): the last jump lands on 00. The step that must be checked is the SIGN of a′a': ignoring the case a′=0a' = 0 loses exactly the solutions the problem is about, and ignoring a′<0a' < 0 leaves a gap.

Try it
Try it: climbing the chain

Show that x2+y2+1=3xyx^2 + y^2 + 1 = 3xy has infinitely many solutions in positive integers.

Show the answer

Jump upward. If (x,y)(x, y) is a solution with x≥yx \ge y, then (x,3x−y)(x, 3x - y) is also one: 3x−y3x - y is the other root of Y2−3xY+(x2+1)=0Y^2 - 3xY + (x^2 + 1) = 0. And 3x−y≥2x>x3x - y \ge 2x > x, so the new solution is strictly larger. Starting from (1,1)(1, 1): (1,2)(1, 2), (5,2)(5, 2), (5,13)(5, 13), (34,13)(34, 13), (34,89)(34, 89), … — the Fibonacci numbers F1,F3,F5,…F_1, F_3, F_5, \ldots in consecutive pairs. Each check is one line, e.g. 342+132+1=1326=3⋅34⋅1334^2 + 13^2 + 1 = 1326 = 3\cdot34\cdot13.

Working Backwards, Worked

Tip
Classify states from the end

When a process or game ends in known states, classify every state by working backwards from them: in a game, a position is a loss for the player to move (a P-position) iff every move leads to a win for the opponent (an N-position), and a win iff SOME move leads to a P-position. For a process, ask which state could have come immediately before the one in hand.

Backward induction is ordinary strong induction on the distance to the end: terminal positions are classified by the rules, and each other position is classified from positions nearer the end, which are already known. Its power is that it replaces a search over whole sequences of moves by a local rule. When the backward step is FORCED — only one predecessor is possible — the process can be run in reverse, and questions about reachability become questions about where the reverse run ends, as in Euclid's algorithm.

Example
Worked: take 11, 33 or 44 (folklore)
0123456789101112131415161718192021shaded: P (the player to move loses)
Positions 0 to 21: working up from 0, the losing positions for the player to move are n ≡ 0 or 2 (mod 7).

A pile has nn coins. Players alternately remove 11, 33 or 44 coins; whoever takes the last coin wins. For which nn does the second player win?

Step 1 — work up from 00. Position 00 is P (the player to move has lost). 11, 33, 44 are N (take everything). 22 is P (the only move goes to 11). 55 and 66 are N (move to 22). 77 is P: its moves reach 66, 44, 33, all N. 88 is N (move to 77), 99 is P: its moves reach 88, 66, 55, all N.

Step 2 — the pattern repeats with period 77: P exactly when n≡0n \equiv 0 or 2(mod7)2 \pmod 7.

Step 3 — proof by strong induction: from n≡0n \equiv 0 the moves reach residues 6,4,36, 4, 3, and from n≡2n \equiv 2 they reach 1,6,51, 6, 5 — never 00 or 22. From every other residue some move reaches 00 or 22: 1→01 \to 0 (take 11), 3→23 \to 2 (take 11) or 00 (take 33), 4→04 \to 0 (take 44), 5→25 \to 2 (take 33), 6→26 \to 2 (take 44). So the second player wins exactly when n≡0n \equiv 0 or 2(mod7)2 \pmod 7.

How to find it. Nothing about n=100n = 100 can be seen directly; everything about n=0,1,2,…n = 0, 1, 2, \ldots can. Compute until the pattern repeats, then prove the pattern by checking one period.

Example
Worked: which pairs can be reached? (folklore)
1,12,11,23,12,33,21,34,13,45,32,55,23,54,31,4
The first four levels of reachable pairs: every pair is coprime and none appears twice.

Start from the pair (1,1)(1, 1). A move replaces (a,b)(a, b) by (a+b,b)(a + b, b) or by (a,a+b)(a, a + b). Which pairs of positive integers can be reached, and in how many ways?

Step 1 — forwards is a branching search; backwards is forced. If (a,b)(a, b) with a>ba > b was reached by a move, the move must have been (a−b,b)→(a,b)(a - b, b) \to (a, b), because the other option would have come from (a,b−a)(a, b - a) with a nonpositive entry. Likewise for a<ba < b. A pair (a,a)(a, a) other than (1,1)(1, 1) has no predecessor at all.

Step 2 — so from any (a,b)(a, b) there is exactly one backward path: subtract the smaller entry from the larger — the subtractive Euclidean algorithm. It ends at (g,g)(g, g) with g=gcd⁡(a,b)g = \gcd(a, b), because subtraction preserves the gcd.

Step 3 — the path reaches (1,1)(1, 1) iff gcd⁡(a,b)=1\gcd(a, b) = 1. So the reachable pairs are exactly the coprime pairs, each reached in exactly one way. Example: (5,3)←(2,3)←(2,1)←(1,1)(5, 3) \leftarrow (2, 3) \leftarrow (2, 1) \leftarrow (1, 1).

How to find it. Two forward choices per step make an exponentially branching tree; one backward choice per step makes a path. When the forward direction branches, check whether the backward direction is forced.

Example
Worked: Nim (Bouton, 1901)

Several heaps of coins; a move removes any positive number of coins from one heap; whoever takes the last coin wins. With heaps 3,5,73, 5, 7, find all winning first moves, and prove the rule behind them.

Step 1 — write heap sizes in binary and let ss be their XOR (add the binary digits without carrying). Claim: the player to move loses iff s=0s = 0.

Step 2 — the empty position has s=0s = 0 and is a loss for the player to move, matching the claim. From s=0s = 0, any move changes one heap, hence changes ss: every move goes to s≠0s \ne 0. From s≠0s \ne 0, let dd be the highest binary digit of ss; some heap hh has a 11 in position dd, and h⊕s<hh \oplus s < h (the digit dd turns off, higher digits are unchanged). Reducing hh to h⊕sh \oplus s is a legal move and makes the new XOR s⊕s=0s \oplus s = 0.

Step 3 — by backward induction on the total number of coins, s=0s = 0 positions are losses and s≠0s \ne 0 positions are wins.

Step 4 — heaps 3=01123 = 011_2, 5=10125 = 101_2, 7=11127 = 111_2: s=0012=1s = 001_2 = 1. Every heap has its last digit 11, so there are three winning moves: 3→23 \to 2, 5→45 \to 4, 7→67 \to 6 (each takes one coin), and each leaves XOR 00: 2⊕5⊕7=02 \oplus 5 \oplus 7 = 0, 3⊕4⊕7=03 \oplus 4 \oplus 7 = 0, 3⊕5⊕6=03 \oplus 5 \oplus 6 = 0.

How to find it. Classify small positions backwards: one heap is a win, two equal heaps are a loss (copy the opponent), (1,2,3)(1, 2, 3) is a loss. The losses are exactly the positions whose heaps "cancel" in binary — and XOR is the operation that expresses cancelling.

Side note
Where it goes wrong

Working backwards finds candidates; it does not prove them unless every backward step is reversible. Solve x+3=x−3\sqrt{x + 3} = x - 3: "squaring gives x+3=x2−6x+9x + 3 = x^2 - 6x + 9, so x2−7x+6=0x^2 - 7x + 6 = 0 and x=1x = 1 or x=6x = 6." But x=1x = 1 gives 4=2≠−2\sqrt4 = 2 \ne -2. Squaring is not reversible — u=vu = v implies u2=v2u^2 = v^2, not conversely — so the backward chain of implications only shows that any solution is among 11 and 66. The written solution must check them, and only x=6x = 6 survives.

Try it
Try it: race to 100

Two players alternately add a whole number from 11 to 1010 to a running total that starts at 00. The player who makes the total exactly 100100 wins. What should the first player say first?

Show the answer

Work backwards. Whoever reaches 8989 wins, because from 8989 the opponent must say 9090 to 9999 and the next move can reach 100100. By the same reasoning, reaching 7878 wins, then 67,56,…67, 56, \ldots — every number ≡1(mod11)\equiv 1 \pmod{11}. The first player says 11, and after the opponent adds kk she adds 11−k11 - k, landing on 12,23,…,89,10012, 23, \ldots, 89, 100.