{
  "aliases": [
    "tail-sum-formula",
    "layer-cake-formula-for-expectation"
  ],
  "backlinks": [
    {
      "field": "uses",
      "target": "0DB0R4N5XX"
    }
  ],
  "body": "\n## Statement\n\nLet $X$ be a random variable with values in $[0, \\infty)$. Then\n$$E[X] = \\int_0^\\infty P(X \u003e t) \\, dt,$$\nwith both sides in $[0, \\infty]$.\nIf $X$ takes values in $\\{0, 1, 2, \\dots\\}$, then\n$$E[X] = \\sum_{n=1}^{\\infty} P(X \\ge n).$$\n\n## Remarks\n\nThe proof writes $X = \\int_0^\\infty 1_{\\{X \u003e t\\}} \\, dt$ and exchanges expectation and integral by Tonelli's theorem.\nIn terms of the [[cumulative distribution function|0MXMS3AE13]] $F$, the first formula reads $E[X] = \\int_0^\\infty (1 - F(t)) \\, dt$.\nFor $X \\sim \\operatorname{Exp}(\\lambda)$, the formula gives $E[X] = \\int_0^\\infty e^{-\\lambda t} \\, dt = 1/\\lambda$.\n\n## Explanations\n\n### L1 human\n\nYou can compute an average by adding the chances that $X$ passes each level.\nFor a count $X$, each $n \\le X$ adds $1$ to $X$, and it does so with probability $P(X \\ge n)$.\n",
  "commit": "6ac761d40018146541484a9e8b9eafd6ecc303dc",
  "front": {
    "aliases": [
      "tail-sum-formula",
      "layer-cake-formula-for-expectation"
    ],
    "kind": "statement",
    "msc": [
      "60A05"
    ],
    "name": "Tail sum formula for expectation",
    "role": "proposition",
    "sources": [
      {
        "locator": "Tail-sum formula",
        "url": "https://en.wikipedia.org/wiki/Expected_value"
      }
    ],
    "tag": "0Y6QNF1J49",
    "uses": [
      "0DCT0QZVQ1",
      "0MXMS3AE13"
    ]
  },
  "kind": "statement",
  "link": "https://math2.tamnd.com/node/0Y6QNF1J49/",
  "links": [
    {
      "field": "uses",
      "target": "0DCT0QZVQ1"
    },
    {
      "field": "uses",
      "target": "0MXMS3AE13"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/0Y6QNF1J49.md",
  "msc": [
    "60A05"
  ],
  "name": "Tail sum formula for expectation",
  "prov": null,
  "role": "proposition",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/0Y6/0Y6QNF1J49.md",
  "status": null,
  "tag": "0Y6QNF1J49",
  "uri": "m2://0Y6QNF1J49",
  "url": "https://math2.tamnd.com/wiki/tail-sum-formula-for-expectation/",
  "writing": {
    "tag": "0Y6QNF1J49",
    "kind": "statement",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      }
    ]
  }
}
