{
  "aliases": [
    "fermat-christmas-theorem"
  ],
  "backlinks": [
    {
      "field": "uses",
      "target": "04NPWJMA6H"
    },
    {
      "field": "uses",
      "target": "0WMJSEFYFE"
    }
  ],
  "body": "\n## Statement\n\nLet $p$ be an odd [[prime number|0SN0MAEKYX]].\nThen there are integers $x$ and $y$ with $p = x^2 + y^2$ if and only if $p \\equiv 1 \\pmod 4$.\n\n## Remarks\n\nThe prime $2 = 1^2 + 1^2$ is also a sum of two squares. So a prime $p$ is a sum of two squares if and only if $p \\not\\equiv 3 \\pmod 4$.\nFor example, $5 = 1 + 4$, $13 = 4 + 9$ and $29 = 4 + 25$. For $p \\equiv 1 \\pmod 4$, the representation is unique up to order and signs.\nThe \"only if\" part is easy: a square is $0$ or $1$ modulo $4$, so $x^2 + y^2 \\not\\equiv 3 \\pmod 4$.\nOne proof of the other part starts from a [[square root of $-1$ modulo $p$|00DW862T78]] and uses [[Gaussian integers|0B268GVX95]] or [[Minkowski's theorem|0K387S2PKQ]].\n\n## History\n\nAlbert Girard stated the result in a book published in 1625.\nFermat stated it in a letter to Mersenne of 25 December 1640, so it is also called Fermat's Christmas theorem.\nEuler gave the first proof, by infinite descent, in 1749.\n\n## Explanations\n\n### L1 human\n\nThe primes $5, 13, 17, 29$ leave remainder $1$ on division by $4$, and each of them is a sum of two squares.\nThe primes $3, 7, 11, 19$ leave remainder $3$, and none of them is a sum of two squares.\n",
  "commit": "6ac761d40018146541484a9e8b9eafd6ecc303dc",
  "front": {
    "aliases": [
      "fermat-christmas-theorem"
    ],
    "kind": "statement",
    "msc": [
      "11E25"
    ],
    "name": "Fermat's theorem on sums of two squares",
    "role": "theorem",
    "same_as": {
      "wikidata": "Q914517",
      "wikipedia": "Fermat's theorem on sums of two squares"
    },
    "sources": [
      {
        "locator": "History",
        "url": "https://en.wikipedia.org/wiki/Fermat%27s_theorem_on_sums_of_two_squares"
      },
      {
        "locator": "Euler's proof by infinite descent",
        "url": "https://en.wikipedia.org/wiki/Fermat%27s_theorem_on_sums_of_two_squares"
      }
    ],
    "tag": "043B3ENSTY",
    "uses": [
      "0SN0MAEKYX",
      "00DW862T78"
    ]
  },
  "kind": "statement",
  "link": "https://math2.tamnd.com/node/043B3ENSTY/",
  "links": [
    {
      "field": "uses",
      "target": "0SN0MAEKYX"
    },
    {
      "field": "uses",
      "target": "00DW862T78"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/043B3ENSTY.md",
  "msc": [
    "11E25"
  ],
  "name": "Fermat's theorem on sums of two squares",
  "prov": null,
  "role": "theorem",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/043/043B3ENSTY.md",
  "status": null,
  "tag": "043B3ENSTY",
  "uri": "m2://043B3ENSTY",
  "url": "https://math2.tamnd.com/wiki/fermats-theorem-on-sums-of-two-squares/",
  "writing": {
    "tag": "043B3ENSTY",
    "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
      }
    ]
  }
}
