{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Statement\n\nLet $n$ be a positive integer.\nThen $n = x^2 + y^2$ for some integers $x$ and $y$ if and only if $\\nu_p(n)$ is even for each prime $p \\equiv 3 \\pmod 4$.\nHere $\\nu_p$ is the [[p-adic valuation|04VCPS30ZE]].\n\n## Remarks\n\nFor example, $45 = 3^2 \\cdot 5 = 6^2 + 3^2$, but $21 = 3 \\cdot 7$ is not a sum of two squares.\nThe \"if\" part follows from [[Fermat's theorem on sums of two squares|043B3ENSTY]] and the [[Brahmagupta–Fibonacci identity|0K2DMACEZ4]].\nZero squares are allowed, so each square and each double of a square is a sum of two squares.\n\n## Explanations\n\n### L1 human\n\nTo decide whether $n$ is a sum of two squares, factor $n$ into primes.\nLook only at the primes that leave remainder $3$ on division by $4$. Each of them must appear an even number of times.\n",
  "commit": "6ac761d40018146541484a9e8b9eafd6ecc303dc",
  "front": {
    "kind": "statement",
    "msc": [
      "11E25"
    ],
    "name": "Sum of two squares theorem",
    "role": "theorem",
    "same_as": {
      "wikidata": "Q25303848",
      "wikipedia": "Sum of two squares theorem"
    },
    "sources": [
      {
        "locator": "lead section",
        "url": "https://en.wikipedia.org/wiki/Sum_of_two_squares_theorem"
      }
    ],
    "tag": "04NPWJMA6H",
    "uses": [
      "043B3ENSTY",
      "0K2DMACEZ4",
      "04VCPS30ZE"
    ]
  },
  "kind": "statement",
  "link": "https://math2.tamnd.com/node/04NPWJMA6H/",
  "links": [
    {
      "field": "uses",
      "target": "043B3ENSTY"
    },
    {
      "field": "uses",
      "target": "0K2DMACEZ4"
    },
    {
      "field": "uses",
      "target": "04VCPS30ZE"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/04NPWJMA6H.md",
  "msc": [
    "11E25"
  ],
  "name": "Sum of two squares theorem",
  "prov": null,
  "role": "theorem",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/04N/04NPWJMA6H.md",
  "status": null,
  "tag": "04NPWJMA6H",
  "uri": "m2://04NPWJMA6H",
  "url": "https://math2.tamnd.com/wiki/sum-of-two-squares-theorem/",
  "writing": {
    "tag": "04NPWJMA6H",
    "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
      }
    ]
  }
}
