{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $X$ be a set and let $\\langle \\cdot, \\cdot, \\cdot \\rangle \\colon X \\times X \\times X \\to X$ be a ternary operation.\nThe pair $(X, \\langle \\cdot, \\cdot, \\cdot \\rangle)$ is a *median algebra* if for all $x, y, z, w \\in X$:\n\n1. $\\langle x, y, y \\rangle = y$;\n2. $\\langle x, y, z \\rangle = \\langle z, x, y \\rangle$;\n3. $\\langle x, y, z \\rangle = \\langle x, z, y \\rangle$;\n4. $\\langle \\langle x, w, y \\rangle, w, z \\rangle = \\langle x, w, \\langle y, w, z \\rangle \\rangle$.\n\n## Remarks\n\nClauses 2 and 3 together say that $\\langle x, y, z \\rangle$ does not change under any permutation of $x, y, z$.\nClause 4 says that for fixed $w$, the binary operation $(x, y) \\mapsto \\langle x, w, y \\rangle$ is associative.\n\nExample: $X = \\R$ with $\\langle x, y, z \\rangle$ the median of $x, y, z$, which equals $\\max(\\min(x, y), \\min(y, z), \\min(z, x))$.\nMore generally, every [[distributive lattice|0HM0HQCK6N]] is a median algebra with $\\langle x, y, z \\rangle = (x \\wedge y) \\vee (y \\wedge z) \\vee (z \\wedge x)$.\nFor clause 1, $(x \\wedge y) \\vee y \\vee (y \\wedge x) = y$.\n\nNon-example: a set $X$ with at least two elements and $\\langle x, y, z \\rangle = x$.\nClause 1 fails: for $x \\ne y$, $\\langle x, y, y \\rangle = x \\ne y$.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "DN7VSSDYPQ",
    "kind": "definition",
    "msc": [
      "06D99",
      "08A99",
      "05C12"
    ],
    "name": "Median algebra",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Median_algebra"
      }
    ],
    "tag": "114KYR2JGP",
    "uses": [
      "0HM0HQCK6N"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/114KYR2JGP/",
  "links": [
    {
      "field": "defines",
      "target": "DN7VSSDYPQ"
    },
    {
      "field": "uses",
      "target": "0HM0HQCK6N"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/114KYR2JGP.md",
  "msc": [
    "06D99",
    "08A99",
    "05C12"
  ],
  "name": "Median algebra",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/114/114KYR2JGP.md",
  "status": null,
  "tag": "114KYR2JGP",
  "uri": "m2://114KYR2JGP",
  "url": "https://tamnd.github.io/math2/wiki/median-algebra-definition/",
  "writing": {
    "tag": "114KYR2JGP",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
