{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Statement\n\nLet $r$ and $s$ be positive integers.\nLet $a_1, a_2, \\dots, a_N$ be a sequence of $N = (r - 1)(s - 1) + 1$ distinct real numbers.\nThen the sequence has an increasing subsequence of length $r$ or a decreasing subsequence of length $s$.\n\n## Remarks\n\nThe bound is sharp: some sequence of $(r - 1)(s - 1)$ distinct numbers has neither type of subsequence.\nFor $r = s = 3$: each sequence of $5$ distinct numbers has a monotone subsequence of length $3$.\nA short proof labels each term with the lengths of the longest increasing and decreasing subsequences that end at it. The labels are distinct, and the [[pigeonhole principle|0HGVCWQGY3]] finishes the proof.\n\n## History\n\nPaul Erdős and George Szekeres proved the theorem in 1935.\n\n## Explanations\n\n### L1 human\n\nA long enough list of different numbers always contains a long subsequence that goes up or one that goes down. The terms need not be adjacent.\nFor example, $3, 1, 4, 5, 2$ has the increasing subsequence $3, 4, 5$.\n",
  "commit": "545acf83a9b75c8ddc375ef8b23d2ae101a4d7e4",
  "front": {
    "kind": "statement",
    "msc": [
      "05A05"
    ],
    "name": "Erdős–Szekeres theorem",
    "role": "theorem",
    "same_as": {
      "wikidata": "Q976607",
      "wikipedia": "Erdős–Szekeres theorem"
    },
    "sources": [
      {
        "locator": "lead section",
        "url": "https://en.wikipedia.org/wiki/Erdős–Szekeres_theorem"
      }
    ],
    "tag": "0SNJM8HSD3",
    "uses": [
      "0BY7GN3449"
    ]
  },
  "kind": "statement",
  "link": "https://math2.tamnd.com/node/0SNJM8HSD3/",
  "links": [
    {
      "field": "uses",
      "target": "0BY7GN3449"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/0SNJM8HSD3.md",
  "msc": [
    "05A05"
  ],
  "name": "Erdős–Szekeres theorem",
  "prov": null,
  "role": "theorem",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/0SN/0SNJM8HSD3.md",
  "status": null,
  "tag": "0SNJM8HSD3",
  "uri": "m2://0SNJM8HSD3",
  "url": "https://math2.tamnd.com/wiki/erdos-szekeres-theorem/",
  "writing": {
    "tag": "0SNJM8HSD3",
    "kind": "statement",
    "level": "W1",
    "next": [
      {
        "what": "edge about out",
        "note": "the concepts that the statement is about",
        "have": 0,
        "want": 1
      },
      {
        "what": "edge proves in",
        "note": "at least one proof node",
        "have": 0,
        "want": 1
      },
      {
        "what": "edge instance_of or illustrates in",
        "note": "one example that shows the statement at work",
        "have": 0,
        "want": 1
      },
      {
        "what": "explanation L2",
        "have": 0,
        "want": 1
      }
    ]
  }
}
