Bernoulli Distribution Calculator
The Bernoulli distribution describes a single trial with only two outcomes: success (X = 1) and failure (X = 0). The whole distribution is defined by one parameter, the success probability p. A coin toss, whether an advertisement is clicked, whether a patient responds to treatment, whether a manufactured part comes out defective — each is a Bernoulli trial. Despite its simplicity it is the most basic building block of probability theory: the binomial, geometric, and negative binomial distributions are all built by stacking Bernoulli trials.
From p alone, this calculator returns every summary measure of the Bernoulli distribution (mean, variance, standard deviation, skewness, excess kurtosis, mode, median, odds, and entropy). It then shows the Binomial(n; p) distribution that arises when the same trial is repeated n independent times: the total number of successes has mean n·p and variance n·p(1−p), and the probability of any given number of successes is computed directly. Two bar charts support the results.
Bernoulli Distribution Formulas
Mass function: P(X = x) = pˣ·(1 − p)^(1−x), x ∈ {0, 1}
Explicit form: P(X = 1) = p , P(X = 0) = 1 − p
Mean: E(X) = p
Variance: Var(X) = p·(1 − p)
Standard dev.: σ = √[p(1 − p)]
Skewness: γ₁ = (1 − 2p) / √[p(1 − p)]
Excess kurtosis: γ₂ = [1 − 6p(1 − p)] / [p(1 − p)]
Odds: odds = p / (1 − p)
Entropy: H = −p·log₂p − (1 − p)·log₂(1 − p) (bits)
Sum of n trials: X₁ + … + Xₙ ~ Binomial(n; p)
Binomial mass: P(X = k) = C(n, k)·p^k·(1 − p)^(n−k)
Binomial moments: E = n·p , Var = n·p(1 − p)The Bernoulli distribution has a single parameter: once p is known, the entire distribution is known. The relation Var = μ(1 − μ) between mean and variance is the basis of logistic regression and of the binomial variance function in generalized linear models.
How to Calculate
- Enter the success probability of a single trial (p); it must lie between 0 and 1 (divide a percentage by 100).
- State how many times the same trial is repeated independently (n).
- Write the number of successes (k) whose probability you are interested in within those n trials.
- Read the mean, variance, skewness, kurtosis, and entropy in the Bernoulli section; all of them depend on p alone.
- In the binomial section, verify that n·p and n·p(1−p) are exactly n times the Bernoulli measures.
- Compare the two bar charts: as the two-bar Bernoulli mass is repeated, it turns into the bell-shaped binomial mass.
Worked Examples
A 30% conversion rate with 10 visitors
If a page converts at 0.3, then for a single visitor the mean is 0.3, the variance 0.21, and the standard deviation 0.4583; with a skewness of 0.8729 the distribution is right-skewed. Across 10 independent visitors the expected number of conversions is 3 and the variance is 2.1. The probability of exactly 3 conversions is 0.266828 (26.68%), and the probability of at least one conversion is 0.971752.
P(X = 1) — success: 0.3000 · P(X = 0) — failure: 0.7000 · Mean (expected value): 0.3000
A fair coin: p = 0.5 and 20 tosses
At p = 0.5 the Bernoulli distribution is symmetric: the skewness is 0, the variance takes its largest possible value of 0.25, and the entropy is exactly 1 bit. Over 20 tosses the expected number of heads is 10, the variance is 5, and the standard deviation is 2.2361. The probability of exactly 10 heads is 0.176197 — the most likely outcome, and still below 20%.
P(X = 1) — success: 0.5000 · P(X = 0) — failure: 0.5000 · Mean (expected value): 0.5000
A rare event: p = 0.05 and 50 trials
On a production line with a defect rate of 0.05, a single part has a variance of only 0.0475 and a skewness of 4.1295 (strongly right-skewed). In a batch of 50 parts the expected number of defects is 2.5; the probability of exactly 2 defective parts is 0.261101, and the probability of at least one defect is 0.923055.
P(X = 1) — success: 0.0500 · P(X = 0) — failure: 0.9500 · Mean (expected value): 0.0500