{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Proof\n\nWe write $X$ as a series of indicators and use monotone convergence. For the integral we compare with sums over a fine dyadic grid.\n\n1. Let $X$ be a [[random variable|0DKRR22AEQ]] on $(\\Omega, \\mathcal{F}, P)$ with values in $[0, \\infty)$. For $t \\ge 0$ the set $(t, \\infty)$ is open, hence a [[Borel set|0BVHZXWKCD]]. The set $[t, \\infty)$ is the complement of the open set $(-\\infty, t)$, so it is Borel too. So $\\set{X \u003e t}$ and $\\set{X \\ge t}$ are events.\n2. We first prove a lemma. Let $A_1, A_2, \\dots$ be events, let $c_1, c_2, \\dots \\ge 0$, and let $Z(\\omega) = \\sum_{n=1}^{\\infty} c_n \\mathbf{1}_{A_n}(\\omega) \\in [0, \\infty]$. We claim $E[Z] = \\sum_{n=1}^{\\infty} c_n P(A_n)$.\n3. An [[indicator|0VSB0XF4G7]] $\\mathbf{1}_A$ is a simple function. By the [[integral of a non-negative function|GEA8H3228S]], $E[\\mathbf{1}_A] = P(A) \\le 1$, so $\\mathbf{1}_A$ is integrable.\n4. Let $S_N = \\sum_{n=1}^{N} c_n \\mathbf{1}_{A_n}$. By [[linearity of expectation|0P7PTC8DDE]] and induction on $N$, $S_N$ is integrable and $E[S_N] = \\sum_{n=1}^{N} c_n P(A_n)$.\n5. The functions $S_N$ are nonnegative and nondecreasing in $N$, with limit $Z$. By the [[monotone convergence theorem|G2S6H789RG]], $Z$ is measurable and $E[Z] = \\lim_N E[S_N] = \\sum_{n} c_n P(A_n)$.\n6. Integer case. Let $X$ take values in $\\set{0, 1, 2, \\dots}$. For each $\\omega$, the indices $n \\ge 1$ with $X(\\omega) \\ge n$ are $1, \\dots, X(\\omega)$. So $\\sum_{n \\ge 1} \\mathbf{1}_{\\set{X \\ge n}}(\\omega) = X(\\omega)$.\n7. The lemma with $c_n = 1$ and $A_n = \\set{X \\ge n}$ gives $E[X] = \\sum_{n=1}^{\\infty} P(X \\ge n)$.\n8. General case. Let $G(t) = P(X \u003e t)$ for $t \\ge 0$. If $s \\le t$, then $\\set{X \u003e t} \\subseteq \\set{X \u003e s}$. By [[monotonicity of probability|0464Z0JP2E]], $G$ is nonincreasing, with values in $[0, 1]$.\n9. By [[monotone functions are Riemann integrable|04YKAYDQPW]], $G$ is integrable on each $[0, T]$. We read $\\int_0^\\infty G(t) \\, dt$ as $I = \\lim_{T \\to \\infty} \\int_0^T G(t) \\, dt$.\n10. This limit exists in $[0, \\infty]$. By the [[additivity over intervals|05RCDKHZM6]] and the [[monotonicity of the integral|0MBWQKM8QR]], $\\int_0^{T'} G = \\int_0^T G + \\int_T^{T'} G \\ge \\int_0^T G$ for $T \u003c T'$.\n11. Fix $m \\ge 1$ and let $h = 2^{-m}$. Let $Z_m = \\sum_{n=1}^{\\infty} h \\mathbf{1}_{\\set{X \u003e nh}}$. Then $Z_m(\\omega) = h N_m(\\omega)$, where $N_m(\\omega)$ is the number of integers $n \\ge 1$ with $nh \u003c X(\\omega)$.\n12. We have $X - h \\le Z_m \\le X$. Let $N = N_m(\\omega)$. Then $(N + 1) h \\ge X(\\omega)$, and $Nh \u003c X(\\omega)$ if $N \\ge 1$, while $Z_m(\\omega) = 0 \\le X(\\omega)$ if $N = 0$.\n13. The sequence $Z_m$ is nondecreasing in $m$. If $nh \u003c X(\\omega)$, then $2n$ and $2n - 1$ satisfy $k \\cdot h/2 \u003c X(\\omega)$. So $N_{m+1} \\ge 2 N_m$, and $Z_{m+1} = (h/2) N_{m+1} \\ge h N_m = Z_m$.\n14. By steps 12 and 13, $Z_m$ increases to $X$. By the monotone convergence theorem, $E[Z_m] \\to E[X]$ in $[0, \\infty]$.\n15. By the lemma of step 2, $E[Z_m] = \\sum_{n=1}^{\\infty} h \\, G(nh)$.\n16. Let $I_n = \\int_{(n-1)h}^{nh} G(t) \\, dt$. On $[(n-1)h, nh]$ we have $G(nh) \\le G(t) \\le G((n-1)h)$, by step 8.\n17. By the monotonicity of the integral, comparing with constant functions, $h \\, G(nh) \\le I_n \\le h \\, G((n-1)h)$.\n18. By additivity over intervals, $\\int_0^{Nh} G = \\sum_{n=1}^{N} I_n$. By step 10, letting $N \\to \\infty$ gives $I = \\sum_{n=1}^{\\infty} I_n$.\n19. By steps 15, 17 and 18, $E[Z_m] = \\sum_{n \\ge 1} h \\, G(nh) \\le \\sum_{n \\ge 1} I_n = I$.\n20. Also $I = \\sum_{n \\ge 1} I_n \\le \\sum_{n \\ge 1} h \\, G((n-1)h) = h \\, G(0) + \\sum_{n \\ge 1} h \\, G(nh) \\le h + E[Z_m]$.\n21. So $E[Z_m] \\le I \\le E[Z_m] + 2^{-m}$ for every $m \\ge 1$.\n22. If $E[X] = \\infty$, then $E[Z_m] \\to \\infty$ by step 14, and step 21 gives $I = \\infty = E[X]$.\n23. If $E[X] \u003c \\infty$, let $m \\to \\infty$ in step 21. Both bounds tend to $E[X]$, so $I = E[X]$. Thus $E[X] = \\int_0^\\infty P(X \u003e t) \\, dt$ in all cases.\n\n## Idea\n\nA nonnegative integer $k$ equals the number of $n \\ge 1$ with $k \\ge n$, so $X = \\sum_n \\mathbf{1}_{\\set{X \\ge n}}$. Taking expectations term by term turns this into the tail sum. For a general $X$, the same count on the grid $2^{-m} \\Z$ gives a staircase below $X$, and its expectation is a Riemann sum of $t \\mapsto P(X \u003e t)$. Refining the grid squeezes both sides together.\n",
  "commit": "4a3290d299c8b2cd6493fce2296920ba7f82d942",
  "front": {
    "kind": "proof",
    "msc": [
      "60A05"
    ],
    "name": "Proof of the tail sum formula for expectation by dyadic approximation",
    "proves": "0Y6QNF1J49",
    "sources": [
      {
        "locator": "Tail-sum formula",
        "url": "https://en.wikipedia.org/wiki/Expected_value"
      }
    ],
    "tag": "2A71TR7AV7",
    "uses": [
      "0DCT0QZVQ1",
      "0DKRR22AEQ",
      "0BVHZXWKCD",
      "0464Z0JP2E",
      "0VSB0XF4G7",
      "GEA8H3228S",
      "0P7PTC8DDE",
      "G2S6H789RG",
      "04YKAYDQPW",
      "05RCDKHZM6",
      "0MBWQKM8QR"
    ]
  },
  "kind": "proof",
  "link": "https://math2.tamnd.com/node/2A71TR7AV7/",
  "links": [
    {
      "field": "proves",
      "target": "0Y6QNF1J49"
    },
    {
      "field": "uses",
      "target": "0DCT0QZVQ1"
    },
    {
      "field": "uses",
      "target": "0DKRR22AEQ"
    },
    {
      "field": "uses",
      "target": "0BVHZXWKCD"
    },
    {
      "field": "uses",
      "target": "0464Z0JP2E"
    },
    {
      "field": "uses",
      "target": "0VSB0XF4G7"
    },
    {
      "field": "uses",
      "target": "GEA8H3228S"
    },
    {
      "field": "uses",
      "target": "0P7PTC8DDE"
    },
    {
      "field": "uses",
      "target": "G2S6H789RG"
    },
    {
      "field": "uses",
      "target": "04YKAYDQPW"
    },
    {
      "field": "uses",
      "target": "05RCDKHZM6"
    },
    {
      "field": "uses",
      "target": "0MBWQKM8QR"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/2A71TR7AV7.md",
  "msc": [
    "60A05"
  ],
  "name": "Proof of the tail sum formula for expectation by dyadic approximation",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/2A7/2A71TR7AV7.md",
  "status": null,
  "tag": "2A71TR7AV7",
  "uri": "m2://2A71TR7AV7",
  "url": "https://math2.tamnd.com/wiki/proof-of-the-tail-sum-formula-for-expectation-by-dyadic-approximation/",
  "writing": {
    "tag": "2A71TR7AV7",
    "kind": "proof",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      }
    ]
  }
}
