{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Proof\n\nWe prove the two directions separately.\n\n1. Let $A$ be a nonempty set, let $B$ be a set, and let $f \\colon A \\to B$ be a [[function|0XHDTE5YMZ]].\n2. First suppose that $f$ has a [[left inverse|02486SD328]] $g \\colon B \\to A$. So $g(f(a)) = a$ for each $a \\in A$.\n3. Let $a, a' \\in A$ with $f(a) = f(a')$. Applying $g$ gives $g(f(a)) = g(f(a'))$. By step 2, this says $a = a'$.\n4. By step 3, $f$ is [[injective|0PVG1CRAJN]].\n5. Now suppose that $f$ is injective. Since $A$ is nonempty, fix an element $a_0 \\in A$. Let $f(A)$ be the [[image|0Q3F20XB0A]] of $A$ under $f$.\n6. Let $b \\in f(A)$. Then $f(a) = b$ for some $a \\in A$. If also $f(a') = b$, then $f(a) = f(a')$, so $a = a'$ by injectivity. So exactly one $a \\in A$ has $f(a) = b$.\n7. Define $g \\colon B \\to A$ as follows. For $b \\in f(A)$, let $g(b)$ be the unique $a \\in A$ with $f(a) = b$, given by step 6. For $b \\in B \\setminus f(A)$, let $g(b) = a_0$.\n8. Each $b \\in B$ lies in exactly one of $f(A)$ and $B \\setminus f(A)$. So step 7 gives exactly one value $g(b) \\in A$, and $g$ is a function from $B$ to $A$.\n9. Let $a \\in A$ and put $b = f(a)$. Then $b \\in f(A)$, and $a$ is the unique element with $f(a) = b$. By step 7, $g(f(a)) = g(b) = a$.\n10. By step 9, $g \\circ f = \\mathrm{id}_A$, where $\\mathrm{id}_A$ is the [[identity function|0FSNQ0GNCC]] and $\\circ$ is [[composition|07HF9YCWPP]]. So $g$ is a left inverse of $f$.\n11. By steps 4 and 10, $f$ is injective if and only if $f$ has a left inverse.\n\n## Idea\n\nOn the image of $f$, injectivity lets us undo $f$: each value comes from exactly one point. Off the image, $g$ may send everything to any fixed point of $A$. That is why $A$ must be nonempty. The converse holds because applying $g$ recovers the input.\n",
  "commit": "4a3290d299c8b2cd6493fce2296920ba7f82d942",
  "front": {
    "kind": "proof",
    "msc": [
      "03E20"
    ],
    "name": "Proof that a function with nonempty domain is injective iff it has a left inverse",
    "proves": "0HYFEEZAEM",
    "sources": [
      {
        "locator": "Proof 1",
        "url": "https://proofwiki.org/wiki/Injection_iff_Left_Inverse"
      }
    ],
    "tag": "VZMTMCSJRW",
    "uses": [
      "0PVG1CRAJN",
      "02486SD328",
      "0XHDTE5YMZ",
      "0Q3F20XB0A",
      "07HF9YCWPP",
      "0FSNQ0GNCC"
    ]
  },
  "kind": "proof",
  "link": "https://math2.tamnd.com/node/VZMTMCSJRW/",
  "links": [
    {
      "field": "proves",
      "target": "0HYFEEZAEM"
    },
    {
      "field": "uses",
      "target": "0PVG1CRAJN"
    },
    {
      "field": "uses",
      "target": "02486SD328"
    },
    {
      "field": "uses",
      "target": "0XHDTE5YMZ"
    },
    {
      "field": "uses",
      "target": "0Q3F20XB0A"
    },
    {
      "field": "uses",
      "target": "07HF9YCWPP"
    },
    {
      "field": "uses",
      "target": "0FSNQ0GNCC"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/VZMTMCSJRW.md",
  "msc": [
    "03E20"
  ],
  "name": "Proof that a function with nonempty domain is injective iff it has a left inverse",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/VZM/VZMTMCSJRW.md",
  "status": null,
  "tag": "VZMTMCSJRW",
  "uri": "m2://VZMTMCSJRW",
  "url": "https://math2.tamnd.com/wiki/proof-that-a-function-with-nonempty-domain-is-injective-iff-it-has-a-left-inverse/",
  "writing": {
    "tag": "VZMTMCSJRW",
    "kind": "proof",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      }
    ]
  }
}
