{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $n \\ge 0$ be an integer.\nA *Motzkin path* of length $n$ is a [[lattice path|040WY0TT2G]] $(p_0, p_1, \\ldots, p_n)$ in $\\Z^2$ with these properties:\n\n1. $p_0 = (0, 0)$ and $p_n = (n, 0)$;\n2. each step $p_i - p_{i-1}$ is one of $U = (1, 1)$, $D = (1, -1)$ and $H = (1, 0)$;\n3. each point $p_i$ has second coordinate at least $0$.\n\nThe *Motzkin number* $M_n$ is the number of Motzkin paths of length $n$.\n\n## Remarks\n\nExample: the Motzkin paths of length $3$ are $HHH$, $UDH$, $HUD$ and $UHD$, so $M_3 = 4$.\nNon-example: the path $HDU$ ends at $(3, 0)$ but fails clause 3, because after two steps it is at height $-1$.\n\nThe first values are $M_0, \\ldots, M_7 = 1, 1, 2, 4, 9, 21, 51, 127$.\nSplitting a path at its first step gives the recurrence\n$$M_{n+1} = M_n + \\sum_{k=0}^{n-1} M_k M_{n-1-k}.$$\nThe [[generating function|0PHAC833JF]] $M(z) = \\sum_n M_n z^n$ satisfies $M = 1 + z M + z^2 M^2$, hence\n$$M(z) = \\frac{1 - z - \\sqrt{1 - 2z - 3z^2}}{2 z^2}.$$\nChoosing the positions of the $H$ steps gives $M_n = \\sum_{k} \\binom{n}{2k} C_k$, where $C_k$ is the [[Catalan number|0YWZJEABB2]].\nThe Motzkin paths without $H$ steps are the [[Dyck words|0YTJ3RN3GE]].\n",
  "commit": "5fc425f97f1f6b11da5892c2948ef8c5d8805665",
  "front": {
    "defines": "PB0DSH9XCG",
    "kind": "definition",
    "msc": [
      "05A15",
      "11B83"
    ],
    "name": "Motzkin number",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Motzkin_number"
      }
    ],
    "tag": "PHA1S6GQGV",
    "uses": [
      "040WY0TT2G"
    ]
  },
  "kind": "definition",
  "link": "https://math2.tamnd.com/node/PHA1S6GQGV/",
  "links": [
    {
      "field": "defines",
      "target": "PB0DSH9XCG"
    },
    {
      "field": "uses",
      "target": "040WY0TT2G"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/PHA1S6GQGV.md",
  "msc": [
    "05A15",
    "11B83"
  ],
  "name": "Motzkin number",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/PHA/PHA1S6GQGV.md",
  "status": null,
  "tag": "PHA1S6GQGV",
  "uri": "m2://PHA1S6GQGV",
  "url": "https://math2.tamnd.com/wiki/motzkin-number-definition/",
  "writing": {
    "tag": "PHA1S6GQGV",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
