{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $a \u003c b$ and let $f \\colon [a, b] \\to \\R$ be continuous.\nThe *trapezoidal rule* is the [[quadrature rule|ADSVMCY77A]]\n$$T(f) = \\frac{b - a}{2} \\big( f(a) + f(b) \\big).$$\nFor an integer $N \\ge 1$, let $h = (b - a)/N$ and $x_i = a + i h$ for $i = 0, \\dots, N$.\nThe *composite trapezoidal rule* with $N$ subintervals is\n$$T_N(f) = h \\left( \\frac{f(x_0)}{2} + f(x_1) + \\cdots + f(x_{N-1}) + \\frac{f(x_N)}{2} \\right),$$\nthe sum of $T$ over the subintervals $[x_{i-1}, x_i]$.\n\n## Remarks\n\n$T$ is the closed [[Newton–Cotes formula|BQPQAY1FDJ]] with $n = 1$, and its [[degree of exactness|ZYT1JNT1Y0]] is $1$.\nExample: for $f(x) = x^2$ on $[0, 1]$ and $N = 2$, $T_2(f) = \\tfrac{1}{2}\\big(0 + \\tfrac{1}{4} + \\tfrac{1}{2}\\big) = \\tfrac{3}{8}$, while $\\int_0^1 x^2\\, dx = \\tfrac{1}{3}$.\nNon-example: the left Riemann sum $h \\big( f(x_0) + \\cdots + f(x_{N-1}) \\big)$ is not the composite trapezoidal rule.\nIt gives full weight to $f(x_0)$ and none to $f(x_N)$; for $f(x) = x$ on $[0, 1]$ and $N = 1$ it gives $0$ instead of $1/2$.\nThe composite rule is the average of the left and right Riemann sums.\nFor a continuous function of period $b - a$, $T_N(f) = h \\sum_{i=0}^{N-1} f(x_i)$, and for smooth periodic $f$ the error decreases faster than any power of $h$.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "FH0538XCZR",
    "kind": "definition",
    "msc": [
      "65D32",
      "41A55",
      "65D30"
    ],
    "name": "Trapezoidal rule",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Trapezoidal_rule"
      }
    ],
    "tag": "7R0F4956PX",
    "uses": [
      "ADSVMCY77A",
      "BQPQAY1FDJ",
      "ZYT1JNT1Y0"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/7R0F4956PX/",
  "links": [
    {
      "field": "defines",
      "target": "FH0538XCZR"
    },
    {
      "field": "uses",
      "target": "ADSVMCY77A"
    },
    {
      "field": "uses",
      "target": "BQPQAY1FDJ"
    },
    {
      "field": "uses",
      "target": "ZYT1JNT1Y0"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/7R0F4956PX.md",
  "msc": [
    "65D32",
    "41A55",
    "65D30"
  ],
  "name": "Trapezoidal rule",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/7R0/7R0F4956PX.md",
  "status": null,
  "tag": "7R0F4956PX",
  "uri": "m2://7R0F4956PX",
  "url": "https://tamnd.github.io/math2/wiki/trapezoidal-rule-definition/",
  "writing": {
    "tag": "7R0F4956PX",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
