{
  "id": "bernoulli-distribution",
  "title": "Bernoulli Distribution",
  "lang": "en",
  "source_lang": "en",
  "summary": "A discrete probability distribution describing a single binary outcome, with probability p of taking the value 1 and probability 1 − p of taking the value 0.",
  "category": "mathematics",
  "subcategory": "probability-statistics",
  "type": "concept",
  "aliases": [
    "Bernoulli law",
    "Bernoulli probability distribution"
  ],
  "generated_at": "2026-10-03",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/bernoulli-distribution/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/bernoulli-distribution/",
      "json": "https://aiwiki.page/zh/bernoulli-distribution.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "The Bernoulli distribution is a discrete probability distribution for a random variable that takes only the values 0 and 1. Its single parameter, \\(p\\), is the probability of observing 1; the probability of observing 0 is \\(1-p\\). It describes one binary observation, such as whether a coin lands heads or whether a component passes inspection. The labels “success” and “failure” conventionally denote 1 and 0 without implying that either outcome is desirable. (online.stat.psu.edu)"
    },
    {
      "heading": "Definition and representation",
      "text": "Writing \\(X\\sim\\operatorname{Bernoulli}(p)\\), with \\(0\\leq p\\leq1\\), the probability mass function is\n\n\\[\\Pr(X=x)= \\begin{cases} 1-p,&x=0,\\\\ p,&x=1,\\\\ 0,&\\text{otherwise}. \\end{cases}\\]\n\nFor \\(0<p<1\\), this can be expressed compactly as\n\n\\[\\Pr(X=x)=p^x(1-p)^{1-x}, \\qquad x\\in\\{0,1\\}.\\]\n\nAt \\(p=0\\), the variable equals 0 with certainty; at \\(p=1\\), it equals 1 with certainty. These are degenerate cases of the same family. (online.stat.psu.edu)\n\nA Bernoulli variable can also represent the occurrence of an event \\(A\\). Its indicator random variable, \\(\\mathbf{1}_A\\), equals 1 when \\(A\\) occurs and 0 otherwise, and therefore has parameter \\(p=\\Pr(A)\\). The underlying experiment need not have only two elementary outcomes: rolling a die and recording whether the result is six produces a Bernoulli variable, even though the die itself has six possible results. (probabilitycourse.com)"
    },
    {
      "heading": "Mean, variance, and uncertainty",
      "text": "The expected value and variance are\n\n\\[\\mathbb E[X]=p, \\qquad \\operatorname{Var}(X)=p(1-p).\\]\n\nBecause \\(X^2=X\\), the second moment is also \\(p\\), giving the variance immediately as \\(p-p^2\\). Consequently, the standard deviation is \\(\\sqrt{p(1-p)}\\). The variance is greatest at \\(p=1/2\\), where it equals \\(1/4\\), and vanishes at the two endpoints. Unlike many distribution families, its mean and variance cannot be selected independently. These properties follow directly from its mass function. (online.stat.psu.edu)\n\nIn information theory, its entropy, measured in bits, is\n\n\\[H(X)=-p\\log_2p-(1-p)\\log_2(1-p),\\]\n\nwhere \\(0\\log_2 0\\) is interpreted as 0 by continuity. Entropy is zero for a certain outcome and reaches one bit when both outcomes are equally probable. It measures uncertainty about the observation, rather than uncertainty about an estimated parameter. (web.stanford.edu)"
    },
    {
      "heading": "Repeated observations and the binomial distribution",
      "text": "If \\(X_1,\\ldots,X_n\\) are independent Bernoulli variables sharing the same parameter \\(p\\), their sum\n\n\\[S=\\sum_{i=1}^{n}X_i\\]\n\nhas the binomial distribution with parameters \\(n\\) and \\(p\\). Thus, a Bernoulli distribution is the special case of a binomial distribution with one trial. The distinction is between recording a single outcome and counting successes across several trials. (online.stat.psu.edu)\n\nBoth statistical independence and a common success probability matter for this result. Binary observations can individually be Bernoulli without their sum having the stated binomial distribution: observations may depend on one another, or their success probabilities may differ. A Bernoulli marginal distribution alone does not specify how observations are related. (online.stat.psu.edu)\n\nFor independent observations with common parameter \\(p\\), the sample proportion \\(\\bar X=S/n\\) has mean \\(p\\) and variance \\(p(1-p)/n\\). The central limit theorem explains why its sampling distribution approaches a normal distribution as the sample size increases, provided \\(0<p<1\\). This concerns an aggregate, not the distribution of an individual binary observation. (online.stat.psu.edu)"
    },
    {
      "heading": "Parameter estimation",
      "text": "In statistics, suppose \\(n\\) independent observations contain \\(s\\) successes. The likelihood function for the observed sequence is\n\n\\[L(p)=p^s(1-p)^{n-s}.\\]\n\nIts logarithm is\n\n\\[\\ell(p)=s\\log p+(n-s)\\log(1-p).\\]\n\nMaximum likelihood estimation gives\n\n\\[\\hat p=\\frac{s}{n},\\]\n\nthe observed fraction of successes. When both outcomes occur, this follows by differentiating the log-likelihood and solving for its maximum. If every observation is 0 or every observation is 1, the maximum lies at the corresponding endpoint. (stat135.berkeley.edu)\n\nIn Bayesian inference, a beta distribution is a conjugate prior for \\(p\\). With prior distribution \\(\\operatorname{Beta}(\\alpha,\\beta)\\), observing \\(s\\) successes and \\(n-s\\) failures gives the posterior distribution\n\n\\[p\\mid\\text{data}\\sim \\operatorname{Beta}(\\alpha+s,\\beta+n-s).\\]\n\nHere the Bernoulli distribution describes observations conditional on \\(p\\), whereas the beta distribution describes uncertainty about \\(p\\) itself. (bayesball.github.io)"
    },
    {
      "heading": "Binary prediction models",
      "text": "In machine learning, logistic regression models a binary response conditionally on explanatory variables:\n\n\\[Y\\mid\\mathbf{x}\\sim\\operatorname{Bernoulli}(p(\\mathbf{x})), \\qquad p(\\mathbf{x})= \\frac{1}{1+\\exp(-\\mathbf{x}^{T}\\boldsymbol{\\beta})}.\\]\n\nThe probability can therefore vary between observations while each conditional response remains Bernoulli. This is a binary-response generalized linear model. (web.stanford.edu)\n\nFor an observed label \\(y\\) and predicted probability \\(\\hat p\\), the negative log-likelihood is\n\n\\[-\\bigl[y\\log\\hat p+(1-y)\\log(1-\\hat p)\\bigr].\\]\n\nThis is binary cross-entropy, used as a loss function. It evaluates probability predictions rather than only whether a thresholded classification is correct: assigning very low probability to the outcome that actually occurs produces a large loss. (cs229.stanford.edu)"
    }
  ],
  "links": [
    "probability-distribution",
    "random-variable",
    "probability",
    "probability-mass-function",
    "indicator-function",
    "expected-value",
    "variance",
    "standard-deviation",
    "information-theory",
    "information-entropy",
    "bit",
    "binomial-distribution",
    "statistical-independence",
    "central-limit-theorem",
    "normal-distribution",
    "statistics",
    "likelihood-function",
    "maximum-likelihood-estimation",
    "bayesian-inference",
    "beta-distribution",
    "conjugate-prior",
    "prior-distribution",
    "posterior-distribution",
    "machine-learning",
    "logistic-regression",
    "generalized-linear-model",
    "cross-entropy",
    "loss-function"
  ],
  "sources": [
    {
      "title": "online.stat.psu.edu/stat504/Lesson01",
      "url": "https://online.stat.psu.edu/stat504/Lesson01"
    },
    {
      "title": "probabilitycourse.com/chapter3/3_1_5_special_discrete_distr.php",
      "url": "https://www.probabilitycourse.com/chapter3/3_1_5_special_discrete_distr.php"
    },
    {
      "title": "web.stanford.edu/~montanar/RESEARCH/BOOK/partA.pdf",
      "url": "https://web.stanford.edu/~montanar/RESEARCH/BOOK/partA.pdf"
    },
    {
      "title": "online.stat.psu.edu/stat500/Lesson04",
      "url": "https://online.stat.psu.edu/stat500/Lesson04"
    },
    {
      "title": "stat135.berkeley.edu/spring-2026/lectures/lecture-10.html",
      "url": "https://stat135.berkeley.edu/spring-2026/lectures/lecture-10.html"
    },
    {
      "title": "bayesball.github.io/BOOK/proportion",
      "url": "https://bayesball.github.io/BOOK/proportion"
    },
    {
      "title": "web.stanford.edu/class/stats305b/notes/Logistic_I.html",
      "url": "https://web.stanford.edu/class/stats305b/notes/Logistic_I.html"
    },
    {
      "title": "cs229.stanford.edu/lectures-spring2022/main_notes.pdf",
      "url": "https://cs229.stanford.edu/lectures-spring2022/main_notes.pdf"
    }
  ],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}