{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Proof\n\nWe prove existence with the well-ordering principle, then uniqueness by a size argument.\n\n1. Let $a$ and $b$ be integers with $b \\neq 0$. Put $c = |b|$, so $c$ is a positive integer.\n2. Let $S$ be the set of integers $a - c t$ with $t \\in \\Z$ and $a - c t \\ge 0$. So $S$ is a set of natural numbers.\n3. The set $S$ is nonempty. For $t = -|a|$ we get $a - c t = a + c|a| \\ge a + |a| \\ge 0$, because $c \\ge 1$.\n4. By the [[well-ordering principle|01BX15HSRR]], $S$ has a least element $r$. Write $r = a - c t_0$ with $t_0 \\in \\Z$. Then $r \\ge 0$.\n5. We show $r \u003c c$. Suppose $r \\ge c$. Then $r - c = a - c(t_0 + 1) \\ge 0$, so $r - c \\in S$. But $r - c \u003c r$, which contradicts the choice of $r$.\n6. Put $q = t_0$ if $b \u003e 0$ and $q = -t_0$ if $b \u003c 0$. In both cases $b q = c t_0$. Hence $a = b q + r$ with $0 \\le r \u003c |b|$.\n7. For uniqueness, let $(q, r)$ and $(q', r')$ both satisfy $a = bq + r = bq' + r'$ and $0 \\le r, r' \u003c |b|$.\n8. Subtracting gives $b(q - q') = r' - r$. From the bounds on $r$ and $r'$, we get $|r' - r| \u003c |b|$.\n9. If $q \\neq q'$, then $|q - q'| \\ge 1$, so $|b(q - q')| \\ge |b|$. This contradicts step 8. Hence $q = q'$.\n10. Then $r' - r = b(q - q') = 0$, so $r = r'$.\n11. So there is exactly one pair $(q, r)$ with $a = bq + r$ and $0 \\le r \u003c |b|$.\n\n## Idea\n\nSubtract multiples of $|b|$ from $a$ for as long as the result stays nonnegative. The smallest nonnegative value reached is the remainder, and it must be less than $|b|$, or one more subtraction would be possible. Two different quotients would make the remainders differ by at least $|b|$, which is impossible.\n",
  "commit": "4a3290d299c8b2cd6493fce2296920ba7f82d942",
  "front": {
    "kind": "proof",
    "msc": [
      "11A05"
    ],
    "name": "Proof of the division algorithm",
    "proves": "0CHQKZFK5S",
    "sources": [
      {
        "locator": "Proof",
        "url": "https://en.wikipedia.org/wiki/Euclidean_division"
      }
    ],
    "tag": "R6AEMXE8W4",
    "uses": [
      "01BX15HSRR"
    ]
  },
  "kind": "proof",
  "link": "https://math2.tamnd.com/node/R6AEMXE8W4/",
  "links": [
    {
      "field": "proves",
      "target": "0CHQKZFK5S"
    },
    {
      "field": "uses",
      "target": "01BX15HSRR"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/R6AEMXE8W4.md",
  "msc": [
    "11A05"
  ],
  "name": "Proof of the division algorithm",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/R6A/R6AEMXE8W4.md",
  "status": null,
  "tag": "R6AEMXE8W4",
  "uri": "m2://R6AEMXE8W4",
  "url": "https://math2.tamnd.com/wiki/proof-of-the-division-algorithm/",
  "writing": {
    "tag": "R6AEMXE8W4",
    "kind": "proof",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      }
    ]
  }
}
