The Erdős–Szekeres happy ending problem
Prove that any 2^{n−2}+1 points in general position in the plane contain a convex n-gon; open from n = 7 on.

Update from the catalog #2
Merged
+1 −1 README.md View file
| @@ -14,7 +14,7 @@ Erdős offered \$500 for a proof (and \$100 for a disproof); Graham later offere | ||
| 14 | 14 | |
| 15 | 15 | ## Background |
| 16 | 16 | |
| 17 | -Esther Klein observed in 1931 that $f(4)=5$, and Turán and Makai showed $f(5)=9$. Erdős and Szekeres proved in 1935 that $f(n)$ exists, with $f(n)\le\binom{2n-4}{n-2}+1$, and in 1960 they constructed sets of $2^{n-2}$ points with no convex $n$-gon, giving $f(n)\ge 2^{n-2}+1$. Szekeres and Peters (2006) settled $f(6)=17$ by a computer search. For a long time all improvements of the upper bound were of the form $4^{(1+o(1))n}$. | |
| 17 | +Esther Klein observed in 1933 that $f(4)=5$, and Turán and Makai showed $f(5)=9$. Erdős and Szekeres proved in 1935 that $f(n)$ exists, with $f(n)\le\binom{2n-4}{n-2}+1$, and in 1960 they constructed sets of $2^{n-2}$ points with no convex $n$-gon, giving $f(n)\ge 2^{n-2}+1$. Szekeres and Peters (2006) settled $f(6)=17$ by a computer search. For a long time all improvements of the upper bound were of the form $4^{(1+o(1))n}$. | |
| 18 | 18 | |
| 19 | 19 | ## What is known |
| 20 | 20 | |
+1 −0 cover.svg added View file
| @@ -0,0 +1 @@ | ||
| 1 | +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 304" role="img"><title>8 points, no convex pentagon · a 9th makes one</title><style>svg{--ink:#1f1f1f;--ink2:#3c4043;--faint:#9aa0a6;--line:#dadce0;--sand:#b8862c;--bg:#ffffff;--muted:#5f6368;--f:#4f6bed}@media (prefers-color-scheme: dark){svg{--ink:#e8eaed;--ink2:#c4c7c5;--faint:#6f7479;--line:#3c4043;--sand:#d9b26a;--bg:#1f2023;--muted:#9aa0a6;--f:#93a6ff}}.ink{fill:var(--ink)}.ink-s{stroke:var(--ink);fill:none}.ink2-s{stroke:var(--ink2);fill:none}.f{fill:var(--f)}.f-s{stroke:var(--f);fill:none}.f-soft{fill:var(--f);fill-opacity:.14}.sand{fill:var(--sand)}.sand-s{stroke:var(--sand);fill:none}.faint{fill:var(--faint)}.faint-s{stroke:var(--faint);fill:none}.ring{stroke:var(--bg);stroke-width:3}.bg{fill:var(--bg)}.soft{fill-opacity:.16}.lbl{fill:var(--muted);font:400 19px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}line,path,polyline{stroke-linecap:round;stroke-linejoin:round}</style><polygon class="f-soft" points="109.8,209.1 510.7,193.2 583.8,67.3 238.8,20.3 41.6,97.2"/><polygon class="f-s" points="109.8,209.1 510.7,193.2 583.8,67.3 238.8,20.3 41.6,97.2" stroke-width="3"/><circle class="ink ring" cx="238.8" cy="20.3" r="9"/><circle class="ink ring" cx="263.5" cy="118.8" r="9"/><circle class="ink ring" cx="461.8" cy="111.3" r="9"/><circle class="ink ring" cx="583.8" cy="67.3" r="9"/><circle class="ink ring" cx="510.7" cy="193.2" r="9"/><circle class="ink ring" cx="109.8" cy="209.1" r="9"/><circle class="ink ring" cx="422.1" cy="153" r="9"/><circle class="ink ring" cx="219.9" cy="168.5" r="9"/><circle class="sand ring" cx="41.6" cy="97.2" r="11"/><text class="lbl" x="320" y="288" text-anchor="middle">8 points, no convex pentagon · a 9th makes one</text></svg> | |
+100 −0 figure.py added View file
| @@ -0,0 +1,100 @@ | ||
| 1 | +"""f(5) = 9, happening: eight points in general position with no convex pentagon (ink), and a ninth (sand) that makes | |
| 2 | +one. The eight are found by a seeded random search, then spread out by hill climbing on the smallest triangle and the | |
| 3 | +closest pair, so that no three look collinear; checked here: no five of them are in convex position. The ninth is the | |
| 4 | +point of a grid over the box that keeps the nine and their pentagon clearest. Any nine points in general position | |
| 5 | +contain a convex pentagon, so it completes one; the code draws the one with the least flat corner, and checks that | |
| 6 | +every convex pentagon among the nine uses the new point.""" | |
| 7 | +import itertools | |
| 8 | +import math | |
| 9 | +import random | |
| 10 | +from pathlib import Path | |
| 11 | + | |
| 12 | +import kit | |
| 13 | + | |
| 14 | +AX, AY = 2.4, 1.0 # the box the points live in, drawn at 640 x 304 less the label | |
| 15 | + | |
| 16 | + | |
| 17 | +def cross(o, a, b): | |
| 18 | + return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]) | |
| 19 | + | |
| 20 | + | |
| 21 | +def convex_position(pts): | |
| 22 | + """Every point is a corner of the hull: none lies inside a triangle of the others.""" | |
| 23 | + for p in pts: | |
| 24 | + for a, b, c in itertools.combinations([q for q in pts if q is not p], 3): | |
| 25 | + if (cross(a, b, p) > 0) == (cross(b, c, p) > 0) == (cross(c, a, p) > 0): | |
| 26 | + return False | |
| 27 | + return True | |
| 28 | + | |
| 29 | + | |
| 30 | +def no_pentagon(pts): | |
| 31 | + return not any(convex_position(s) for s in itertools.combinations(pts, 5)) | |
| 32 | + | |
| 33 | + | |
| 34 | +def smallest_triangle(pts): | |
| 35 | + return min(abs(cross(a, b, c)) / 2 for a, b, c in itertools.combinations(pts, 3)) | |
| 36 | + | |
| 37 | + | |
| 38 | +def clarity(pts): # the smallest triangle and the closest pair, both as large as possible | |
| 39 | + return min(smallest_triangle(pts) / 0.05, min(math.dist(p, q) for p, q in itertools.combinations(pts, 2)) / 0.4) | |
| 40 | + | |
| 41 | + | |
| 42 | +rng = random.Random(5) | |
| 43 | +while True: | |
| 44 | + pts = [(rng.random() * AX, rng.random() * AY) for _ in range(8)] | |
| 45 | + if no_pentagon(pts): | |
| 46 | + break | |
| 47 | +for _ in range(6000): # move one point a little; keep the move when the set stays pentagon-free and gets clearer | |
| 48 | + i, s = rng.randrange(8), 0.08 | |
| 49 | + q = list(pts) | |
| 50 | + q[i] = (min(AX, max(0, q[i][0] + rng.uniform(-s, s))), min(AY, max(0, q[i][1] + rng.uniform(-s, s)))) | |
| 51 | + if clarity(q) > clarity(pts) and no_pentagon(q): | |
| 52 | + pts = q | |
| 53 | + | |
| 54 | +assert len(pts) == 8 and smallest_triangle(pts) > 0.01 and no_pentagon(pts) | |
| 55 | + | |
| 56 | + | |
| 57 | +def around(c): # the points of a convex set in order around their centre | |
| 58 | + mx, my = sum(p[0] for p in c) / len(c), sum(p[1] for p in c) / len(c) | |
| 59 | + return sorted(c, key=lambda p: math.atan2(p[1] - my, p[0] - mx)) | |
| 60 | + | |
| 61 | + | |
| 62 | +def area(c): | |
| 63 | + h = around(c) | |
| 64 | + return abs(sum(cross((0, 0), h[k], h[(k + 1) % len(h)]) for k in range(len(h)))) / 2 | |
| 65 | + | |
| 66 | + | |
| 67 | +def corners(c): # how sharp the flattest corner of a convex polygon is: the triangle it makes with its neighbours | |
| 68 | + h = around(c) | |
| 69 | + return min(abs(cross(h[k - 1], h[k], h[(k + 1) % len(h)])) / 2 for k in range(len(h))) | |
| 70 | + | |
| 71 | + | |
| 72 | +def pentagons_with(p): | |
| 73 | + return [c for c in itertools.combinations(pts + [p], 5) if convex_position(c)] | |
| 74 | + | |
| 75 | + | |
| 76 | +def score(p): # the nine stay clear, and the clearest pentagon through p has no flat corner | |
| 77 | + sharp = corners(max(pentagons_with(p), key=corners)) | |
| 78 | + return round(min(clarity(pts + [p]), sharp / 0.08), 6), round(sharp, 6), p | |
| 79 | + | |
| 80 | + | |
| 81 | +grid = [(AX * i / 48, AY * j / 20) for i in range(49) for j in range(21)] | |
| 82 | +new = max((p for p in grid if p not in pts), key=score) | |
| 83 | +nine = pts + [new] | |
| 84 | +assert smallest_triangle(nine) > 0.01 | |
| 85 | +pentagons = pentagons_with(new) | |
| 86 | +assert pentagons and all(new in c for c in pentagons) | |
| 87 | +pentagon = around(max(pentagons, key=corners)) | |
| 88 | + | |
| 89 | +sx = sy = 232 / AY | |
| 90 | +x0, y0 = (kit.W - AX * sx) / 2, 16 | |
| 91 | + | |
| 92 | + | |
| 93 | +def at(p): | |
| 94 | + return x0 + p[0] * sx, y0 + (AY - p[1]) * sy | |
| 95 | + | |
| 96 | + | |
| 97 | +shape = [at(p) for p in pentagon] | |
| 98 | +body = [kit.polygon(shape, 'f-soft'), kit.polygon(shape, 'f-s', ' stroke-width="3"')] | |
| 99 | +body += [kit.dot(*at(p), 9) for p in pts] + [kit.dot(*at(new), 11, 'sand')] | |
| 100 | +kit.write(__file__, 'mathematics', ''.join(body), label='8 points, no convex pentagon · a 9th makes one') | |
+124 −0 kit.py added View file
| @@ -0,0 +1,124 @@ | ||
| 1 | +"""The drawing kit for problem cards: one canvas, one palette, light and dark built in. | |
| 2 | + | |
| 3 | +It lives here only: tools/cards/kit.py in the catalog, which each problem folder links as kit.py. The Shoal site | |
| 4 | +serves no copy of it: a card's cover is the problem's poster (tools/cards/posters.py), and what this kit draws is kept | |
| 5 | +for the problem's own page. | |
| 6 | + | |
| 7 | +A figure.py at a problem's root, with this file beside it, imports it, draws the problem's object and writes cover.svg | |
| 8 | +next to itself (docs/cards.md says what a figure must be): | |
| 9 | + | |
| 10 | + import kit | |
| 11 | + body = kit.circle(320, 152, 40, 'f') | |
| 12 | + kit.write(__file__, 'mathematics', body, label='what is drawn') | |
| 13 | + | |
| 14 | +Classes (each colour means one thing on a figure; pick the meaning, then the class): | |
| 15 | + ink, ink-s the object itself (fill / stroke) | |
| 16 | + ink2-s secondary structure (edges, outlines) | |
| 17 | + f, f-s, f-soft the field's colour: the part the question is about (fill / stroke / pale fill) | |
| 18 | + sand, sand-s the one accent: a second colour class, an open or contested part | |
| 19 | + faint, faint-s context: grids, axes, ghosts | |
| 20 | + ring a halo in the page's colour, so dots read on top of lines | |
| 21 | + bg a fill in the page's colour, to hide what lies behind (front faces, occluding balls) | |
| 22 | + soft a pale fill of any class's colour: add it next to f, sand or ink (class="sand soft") | |
| 23 | + lbl the one label line | |
| 24 | +""" | |
| 25 | +import math | |
| 26 | +from pathlib import Path | |
| 27 | + | |
| 28 | +W, H = 640, 304 # shown at 320 x 152 on a card, larger on a featured card | |
| 29 | + | |
| 30 | +# the site's field colours (public/app.css, --f-*), light and dark | |
| 31 | +FIELD = { | |
| 32 | + 'mathematics': ('#4f6bed', '#93a6ff'), 'computer-science': ('#9b59d0', '#c9a2f3'), | |
| 33 | + 'physics-astronomy': ('#129d96', '#5fd0c8'), 'chemistry-materials': ('#d08a17', '#f2c063'), | |
| 34 | + 'life-health': ('#5a9e2c', '#a3d47a'), 'earth-environment': ('#2a8ccf', '#7cc4f2'), | |
| 35 | + 'engineering-energy': ('#d4533f', '#f29484'), 'social-economics': ('#c2448f', '#f09ac8'), | |
| 36 | +} | |
| 37 | +LIGHT = dict(ink='#1f1f1f', ink2='#3c4043', faint='#9aa0a6', line='#dadce0', sand='#b8862c', bg='#ffffff', muted='#5f6368') | |
| 38 | +DARK = dict(ink='#e8eaed', ink2='#c4c7c5', faint='#6f7479', line='#3c4043', sand='#d9b26a', bg='#1f2023', muted='#9aa0a6') | |
| 39 | + | |
| 40 | + | |
| 41 | +def _vars(c, f): | |
| 42 | + return (f'--ink:{c["ink"]};--ink2:{c["ink2"]};--faint:{c["faint"]};--line:{c["line"]};--sand:{c["sand"]};' | |
| 43 | + f'--bg:{c["bg"]};--muted:{c["muted"]};--f:{f}') | |
| 44 | + | |
| 45 | + | |
| 46 | +def style(field): | |
| 47 | + light, dark = FIELD[field] | |
| 48 | + return (f'<style>svg{{{_vars(LIGHT, light)}}}@media (prefers-color-scheme: dark){{svg{{{_vars(DARK, dark)}}}}}' | |
| 49 | + '.ink{fill:var(--ink)}.ink-s{stroke:var(--ink);fill:none}.ink2-s{stroke:var(--ink2);fill:none}' | |
| 50 | + '.f{fill:var(--f)}.f-s{stroke:var(--f);fill:none}.f-soft{fill:var(--f);fill-opacity:.14}' | |
| 51 | + '.sand{fill:var(--sand)}.sand-s{stroke:var(--sand);fill:none}.faint{fill:var(--faint)}.faint-s{stroke:var(--faint);fill:none}' | |
| 52 | + '.ring{stroke:var(--bg);stroke-width:3}.bg{fill:var(--bg)}.soft{fill-opacity:.16}' | |
| 53 | + '.lbl{fill:var(--muted);font:400 19px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}' | |
| 54 | + 'line,path,polyline{stroke-linecap:round;stroke-linejoin:round}</style>') | |
| 55 | + | |
| 56 | + | |
| 57 | +def f1(n): | |
| 58 | + return f'{round(n, 1):g}' | |
| 59 | + | |
| 60 | + | |
| 61 | +def circle(x, y, r, cls, extra=''): | |
| 62 | + return f'<circle class="{cls}" cx="{f1(x)}" cy="{f1(y)}" r="{f1(r)}"{extra}/>' | |
| 63 | + | |
| 64 | + | |
| 65 | +def dot(x, y, r=6, cls='ink'): | |
| 66 | + """A point that stays readable on top of lines: filled, with a halo in the page's colour.""" | |
| 67 | + return circle(x, y, r, f'{cls} ring') | |
| 68 | + | |
| 69 | + | |
| 70 | +def line(x1, y1, x2, y2, cls='ink2-s', w=2, extra=''): | |
| 71 | + return f'<line class="{cls}" x1="{f1(x1)}" y1="{f1(y1)}" x2="{f1(x2)}" y2="{f1(y2)}" stroke-width="{w}"{extra}/>' | |
| 72 | + | |
| 73 | + | |
| 74 | +def path(d, cls='ink2-s', w=2, extra=''): | |
| 75 | + return f'<path class="{cls}" d="{d}" stroke-width="{w}"{extra}/>' | |
| 76 | + | |
| 77 | + | |
| 78 | +def polygon(pts, cls='f-soft', extra=''): | |
| 79 | + return f'<polygon class="{cls}" points="{" ".join(f"{f1(x)},{f1(y)}" for x, y in pts)}"{extra}/>' | |
| 80 | + | |
| 81 | + | |
| 82 | +def polyline(pts, cls='ink2-s', w=2, extra=''): | |
| 83 | + return f'<polyline class="{cls}" points="{" ".join(f"{f1(x)},{f1(y)}" for x, y in pts)}" stroke-width="{w}"{extra}/>' | |
| 84 | + | |
| 85 | + | |
| 86 | +DASH = ' stroke-dasharray="7 6"' # pass as `extra` for a dashed stroke | |
| 87 | + | |
| 88 | + | |
| 89 | +def polypath(pts, cls='ink2-s', w=2, closed=False, extra=''): | |
| 90 | + """Many points as one relative path: the same line as polyline, a fraction of the bytes.""" | |
| 91 | + (x0, y0), d, px, py = pts[0], [], pts[0][0], pts[0][1] | |
| 92 | + for x, y in pts[1:]: | |
| 93 | + d.append(f'{f1(x - px)} {f1(y - py)}'); px, py = x, y | |
| 94 | + return path(f'M{f1(x0)} {f1(y0)}l' + ' '.join(d) + ('z' if closed else ''), cls, w, extra) | |
| 95 | + | |
| 96 | + | |
| 97 | +def arrow(x1, y1, x2, y2, cls='ink2-s', w=2, head=10): | |
| 98 | + """A line ending in an open arrowhead at (x2, y2).""" | |
| 99 | + a = math.atan2(y2 - y1, x2 - x1) | |
| 100 | + tips = [(x2 - head * math.cos(a - s), y2 - head * math.sin(a - s)) for s in (0.45, -0.45)] | |
| 101 | + return line(x1, y1, x2, y2, cls, w) + polyline([tips[0], (x2, y2), tips[1]], cls, w) | |
| 102 | + | |
| 103 | + | |
| 104 | +def text(x, y, s, cls='lbl', anchor='middle'): | |
| 105 | + s = s.replace('&', '&').replace('<', '<').replace('>', '>') | |
| 106 | + return f'<text class="{cls}" x="{f1(x)}" y="{f1(y)}" text-anchor="{anchor}">{s}</text>' | |
| 107 | + | |
| 108 | + | |
| 109 | +def svg(field, body, label=None, title=''): | |
| 110 | + """The whole figure. `label` is the one line naming what is drawn, at the bottom; leave room for it (y < 262).""" | |
| 111 | + if field not in FIELD: | |
| 112 | + raise ValueError(f'unknown field {field!r}') | |
| 113 | + if label and len(label) > 50: | |
| 114 | + raise ValueError(f'label over 50 characters (more does not fit at card size): {label!r}') | |
| 115 | + t = f'<title>{title or label or ""}</title>' | |
| 116 | + tail = text(W / 2, H - 16, label) if label else '' | |
| 117 | + return f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {W} {H}" role="img">{t}{style(field)}{body}{tail}</svg>\n' | |
| 118 | + | |
| 119 | + | |
| 120 | +def write(figure_py, field, body, label=None, title=''): | |
| 121 | + """Writes cover.svg next to the figure.py that calls it.""" | |
| 122 | + out = Path(figure_py).resolve().parent / 'cover.svg' | |
| 123 | + out.write_text(svg(field, body, label, title)) | |
| 124 | + return out | |
+0 −0 poster.webp added View file
+6 −0 posters.json added View file
| @@ -0,0 +1,6 @@ | ||
| 1 | +{ | |
| 2 | + "poster.webp": { | |
| 3 | + "style": "poster", | |
| 4 | + "idea": "A cobalt-blue tabletop with brass point pins and crimson thread tracing a convex polygon from a larger scatter." | |
| 5 | + } | |
| 6 | +} | |
+33 −3 scienceslack.json View file
| @@ -9,8 +9,7 @@ | ||
| 9 | 9 | "proof" |
| 10 | 10 | ], |
| 11 | 11 | "cover": { |
| 12 | - "motif": "points", | |
| 13 | - "n": 9 | |
| 12 | + "file": "poster.webp" | |
| 14 | 13 | }, |
| 15 | 14 | "source": { |
| 16 | 15 | "key": "erdos", |
| @@ -25,5 +24,36 @@ | ||
| 25 | 24 | "catalog": "0521c19bbd38" |
| 26 | 25 | }, |
| 27 | 26 | "review": true, |
| 28 | - "approval": "first-time" | |
| 27 | + "approval": "first-time", | |
| 28 | + "card": { | |
| 29 | + "question": "How many points, no three on a line, must you scatter on a page to be sure that n of them are the corners of a convex polygon?", | |
| 30 | + "stake": "Named for the marriage it led to, of Esther Klein and George Szekeres; the hexagon case took a computer search in 2006.", | |
| 31 | + "frontier": { | |
| 32 | + "shape": "cases", | |
| 33 | + "items": [ | |
| 34 | + { | |
| 35 | + "label": "f(4) = 5", | |
| 36 | + "state": "solved", | |
| 37 | + "year": 1933, | |
| 38 | + "by": "Esther Klein" | |
| 39 | + }, | |
| 40 | + { | |
| 41 | + "label": "f(5) = 9", | |
| 42 | + "state": "solved", | |
| 43 | + "by": "Turán and Makai" | |
| 44 | + }, | |
| 45 | + { | |
| 46 | + "label": "f(6) = 17", | |
| 47 | + "state": "solved", | |
| 48 | + "year": 2006, | |
| 49 | + "by": "Szekeres and Peters" | |
| 50 | + }, | |
| 51 | + { | |
| 52 | + "label": "f(7) = 33?", | |
| 53 | + "state": "open" | |
| 54 | + } | |
| 55 | + ] | |
| 56 | + }, | |
| 57 | + "first": "Settle whether 33 points always contain a convex heptagon" | |
| 58 | + } | |
| 29 | 59 | } |