Skip to main content

Bernoulli trials: definition, parameters, mean and variance

Syllabus dot point

“Define a Bernoulli random variable, compute its mean and variance, and recognise scenarios that fit the model”

HSCMaths Extension 1Statistical Analysis (ME-S1)10 min read

Quick answer

A Bernoulli trial is a single experiment with success probability pp and failure probability 1−p1 - p; the random variable XX that is 11 on success and 00 on failure has mean E(X)=pE(X) = p and variance Var(X)=p(1−p)\text{Var}(X) = p (1 - p), and the binomial distribution counts successes over nn independent Bernoulli trials.

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Exam-style questions

What this dot point is asking

NESA wants you to recognise a Bernoulli trial (a single experiment with two outcomes), state its probability mass function, compute its mean and variance, and see it as the unit of a sequence used to build the binomial distribution.

The answer

Definition

A Bernoulli trial is a random experiment with exactly two possible outcomes, conventionally labelled "success" (value 11) and "failure" (value 00), where success occurs with probability pp and failure with probability q=1−pq = 1 - p.

If XX is a Bernoulli random variable with parameter pp (written X∼B(p)X \sim B(p) or Bern(p)\text{Bern}(p)):

P(X=1)=p,P(X=0)=1−p.P(X = 1) = p, \qquad P(X = 0) = 1 - p.

The whole distribution is just two bars: a bar of height q=1−pq = 1 - p at x=0x = 0 and a bar of height pp at x=1x = 1. Because something must happen, the two heights add to 11, which is the only consistency check a Bernoulli variable needs.

The Bernoulli probability distributionA two bar probability distribution for a Bernoulli variable with success probability 0.7. The bar at 0 (failure) has height 0.3 and the bar at 1 (success) has height 0.7; the two heights add to 1.xP(X = x)0.510 (failure)q = 0.31 (success)p = 0.7A single trial: P(X = 0) = q and P(X = 1) = p, with p + q = 1.

Mean (expected value)

E(X)=1⋅p+0⋅(1−p)=p.E(X) = 1 \cdot p + 0 \cdot (1 - p) = p.

The expected value of a single Bernoulli trial is its success probability.

Variance

E(X2)=12⋅p+02⋅(1−p)=p.E(X^2) = 1^2 \cdot p + 0^2 \cdot (1 - p) = p.

Var(X)=E(X2)−[E(X)]2=p−p2=p(1−p).\text{Var}(X) = E(X^2) - [E(X)]^2 = p - p^2 = p(1 - p).

Equivalently, σ=p(1−p)\sigma = \sqrt{p (1 - p)}.

Key fact

A Bernoulli random variable XX takes the value 11 with probability pp and 00 with probability q=1−pq = 1 - p. Its mean is E(X)=pE(X) = p and its variance is Var(X)=p(1−p)=pq\text{Var}(X) = p(1 - p) = pq. Stacking nn independent copies gives the binomial B(n,p)B(n, p), whose mean npnp and variance np(1−p)np(1 - p) are simply nn times these, so there is nothing extra to memorise.

Standard examples

  • Flipping a fair coin with X=1X = 1 if heads: p=12p = \tfrac{1}{2}.
  • Rolling a die and checking for a 66: p=16p = \tfrac{1}{6}.
  • Asking a random voter if they support a policy with pp unknown.
  • A medical test giving a positive result on someone with the condition (sensitivity).

Why this matters

A Bernoulli trial is the simplest non-trivial random variable. The binomial distribution counts the number of successes in a fixed number of independent Bernoulli trials.

A sequence of nn independent identically distributed Bernoulli trials, where Xi=1X_i = 1 if the ii-th trial is a success and 00 otherwise, has total S=X1+X2+⋯+Xn∼B(n,p)S = X_1 + X_2 + \dots + X_n \sim B(n, p).

By linearity of expectation, E(S)=npE(S) = n p. By independence and the variance addition rule, Var(S)=np(1−p)\text{Var}(S) = n p (1 - p).

Recognising a Bernoulli model

The examinable judgement is whether a described situation fits the Bernoulli model at all. Three conditions must hold: there is a single trial (or you are looking at one trial in a sequence), there are exactly two outcomes, and a fixed probability pp is attached to success. If the experiment has three or more outcomes, or a continuous range of outcomes, it is not Bernoulli. Where an outcome with many categories is reframed as "the event of interest happened, or it did not", a Bernoulli model is recovered. This reframing (success versus everything-else) is how almost every binomial question is built.

From one trial to many

The reason this small model matters is that it is the atom from which the binomial distribution is built. Each of nn independent, identically distributed Bernoulli trials contributes its mean pp and variance p(1−p)p(1 - p), and because expectation is linear and variance adds for independent variables, the totals are npnp and np(1−p)np(1 - p). Understanding that the binomial mean and variance are just nn copies of the Bernoulli mean and variance removes any need to memorise them as separate facts.

Where the variance is largest, stage by stage

A favourite short proof question asks you to show that Var(X)=p(1−p)\text{Var}(X) = p(1 - p) is greatest at p=12p = \tfrac{1}{2}. The variance is a function of pp, and seeing its shape makes the result obvious before you differentiate anything. The three panels build that picture up.

Stage 1, pin down the certain cases. At p=0p = 0 failure is guaranteed and at p=1p = 1 success is guaranteed; either way the outcome is certain, so there is no spread and Var(X)=0(1−0)=0\text{Var}(X) = 0(1 - 0) = 0 and 1(1−1)=01(1 - 1) = 0. The variance curve must therefore touch zero at both ends of the interval [0,1][0, 1].

Bernoulli variance p(1 minus p)The variance of a Bernoulli trial plotted against p. It is a downward parabola that is zero at p equals 0 and p equals 1 and peaks at one quarter when p equals one half.Var(X) = p(1 - p)00.51p0.25V(0) = 0V(1) = 0Stage 1At p = 0 and p = 1 the outcome is certain, so the variance is 0.

Stage 2, fill in the shape between the ends. Because Var(X)=p−p2\text{Var}(X) = p - p^2 is a quadratic with a negative leading coefficient, it is a downward parabola. Pinned to 00 at each end and opening downward, it must bulge up in the middle: uncertainty is small near the certain ends and grows as the two outcomes become more evenly matched.

Bernoulli variance p(1 minus p)The variance of a Bernoulli trial plotted against p. It is a downward parabola that is zero at p equals 0 and p equals 1 and peaks at one quarter when p equals one half.Var(X) = p(1 - p)00.51p0.25Stage 2Between the ends the variance rises and falls: a downward parabola.

Stage 3, locate the peak. By symmetry of a parabola the maximum sits exactly halfway between the roots, at p=12p = \tfrac{1}{2}. Differentiating confirms it: ddp(p−p2)=1−2p=0\frac{d}{dp}(p - p^2) = 1 - 2p = 0 gives p=12p = \tfrac{1}{2}, and the second derivative −2<0-2 < 0 makes it a maximum. The peak value is 12⋅12=14\tfrac{1}{2}\cdot\tfrac{1}{2} = \tfrac{1}{4}, so a fair trial (p=12p = \tfrac{1}{2}) is the most uncertain Bernoulli trial of all.

Bernoulli variance p(1 minus p)The variance of a Bernoulli trial plotted against p. It is a downward parabola that is zero at p equals 0 and p equals 1 and peaks at one quarter when p equals one half.Var(X) = p(1 - p)00.51p0.25max = 1/4 at p = 1/2Stage 3The peak is at p = 1/2, where Var(X) = 1/4: a fair trial is most uncertain.

How exam questions ask about Bernoulli trials

Bernoulli rarely gets a question to itself; it is usually the setup line of a binomial question, or a short part that tests whether you know the parameters and formulas. The wordings to recognise:

  • "A Bernoulli random variable has P(X=1)=…P(X = 1) = \ldots" or "a single trial succeeds with probability pp": state E(X)=pE(X) = p and Var(X)=p(1−p)\text{Var}(X) = p(1 - p) and substitute. These are usually 1 to 2 mark recall parts.
  • "Show that the variance is greatest / maximised when p=12p = \tfrac{1}{2}": differentiate V(p)=p−p2V(p) = p - p^2, set V′(p)=0V'(p) = 0, and confirm a maximum with V′′(p)=−2<0V''(p) = -2 < 0 before stating V(12)=14V(\tfrac{1}{2}) = \tfrac{1}{4}.
  • "Does this situation fit a Bernoulli model?" or "explain why X is (not) a Bernoulli variable": check the three conditions out loud, that there is one trial, exactly two outcomes, and a fixed pp. Continuous quantities (a time, a height) and three-or-more-outcome experiments are not Bernoulli unless reframed as "event happened or it did not".
  • "XX counts successes in nn trials": this is the cue that you have left a single Bernoulli trial and entered the binomial; the mean becomes npnp and the variance np(1−p)np(1 - p).
Exam technique

Write the two formulas E(X)=pE(X) = p and Var(X)=p(1−p)\text{Var}(X) = p(1 - p) before substituting; markers reward the formula even if the arithmetic slips. Keep E(X)E(X) and Var(X)\text{Var}(X) distinct: the mean is pp, the variance carries the extra (1−p)(1 - p) factor. For a "show the maximum" part, the full-mark route is the calculus one (derivative zero, second-derivative sign), not just "by symmetry". For a "does it fit" part, name each of the three conditions explicitly rather than giving a one-word yes or no. Finally, if asked for the standard deviation, take the square root of the variance and keep it to the accuracy the question asks for.

Worked example

Find the mean and variance of a single Bernoulli trial

A biased coin lands heads with probability p=0.3p = 0.3. Let XX be 11 if heads, 00 if tails. For any Bernoulli variable, E(X)=pE(X) = p and Var(X)=p(1−p)\text{Var}(X) = p(1 - p).

E(X)=0.3,Var(X)=0.3×0.7=0.21,σ=0.21≈0.458.E(X) = 0.3, \qquad \text{Var}(X) = 0.3 \times 0.7 = 0.21, \qquad \sigma = \sqrt{0.21} \approx 0.458.

Final answer: E(X)=0.3E(X) = 0.3, Var(X)=0.21\text{Var}(X) = 0.21.


Show the variance is greatest at p=12p = \tfrac{1}{2}

Recognise that the variance is a quadratic function of pp: The variance Var(X)=p(1−p)=p−p2\text{Var}(X) = p(1 - p) = p - p^2 is a downward-opening parabola in pp. Its maximum occurs at the vertex, where ddp(p−p2)=1−2p=0\frac{d}{dp}(p - p^2) = 1 - 2p = 0, giving p=12p = \frac{1}{2}.

Evaluate the maximum variance:

Var(X)∣p=1/2=12⋅12=14.\text{Var}(X)\bigg|_{p = 1/2} = \tfrac{1}{2} \cdot \tfrac{1}{2} = \tfrac{1}{4}.

A fair coin flip has the highest possible variance among all Bernoulli trials.

Final answer: variance is maximised at p=12p = \dfrac{1}{2}, with maximum variance 14\dfrac{1}{4}.


Find the mean and variance of a sum of identical Bernoulli trials

Three independent fair coin flips each have p=12p = \frac{1}{2}. The total S=X1+X2+X3S = X_1 + X_2 + X_3 counts the number of successes in three independent identical Bernoulli trials, so S∼B(3,12)S \sim B(3, \tfrac{1}{2}). By linearity of expectation and the variance-addition rule for independent variables:

E(S)=np=3⋅12=32,Var(S)=np(1−p)=3⋅12⋅12=34.E(S) = np = 3 \cdot \tfrac{1}{2} = \tfrac{3}{2}, \qquad \text{Var}(S) = np(1 - p) = 3 \cdot \tfrac{1}{2} \cdot \tfrac{1}{2} = \tfrac{3}{4}.

Final answer: E(S)=32E(S) = \dfrac{3}{2}, Var(S)=34\text{Var}(S) = \dfrac{3}{4}.


Decide whether a situation fits the Bernoulli model

"The time until the next bus arrives" takes a continuous range of positive values, not just two outcomes. This is not a Bernoulli trial.

"Did the bus arrive on time?" has exactly two outcomes: on time or not on time. With a fixed probability pp of arriving on time, this is a Bernoulli trial.

Final answer: continuous-outcome scenarios are not Bernoulli; binary-outcome scenarios with fixed pp are.


Find the mean and variance of a sum of non-identical Bernoulli trials

Two independent Bernoulli trials with p1=0.4p_1 = 0.4 and p2=0.6p_2 = 0.6 are not identically distributed, so their sum S=X1+X2S = X_1 + X_2 is not a binomial. However, expectation is always linear and variances add for independent variables.

E(S)=E(X1)+E(X2)=0.4+0.6=1.0.E(S) = E(X_1) + E(X_2) = 0.4 + 0.6 = 1.0.

Var(S)=Var(X1)+Var(X2)=0.4×0.6+0.6×0.4=0.24+0.24=0.48.\text{Var}(S) = \text{Var}(X_1) + \text{Var}(X_2) = 0.4 \times 0.6 + 0.6 \times 0.4 = 0.24 + 0.24 = 0.48.

Final answer: E(S)=1.0E(S) = 1.0, Var(S)=0.48\text{Var}(S) = 0.48.

Common traps
Variance is p(1−p)p(1 - p), not pp
A common slip in HSC questions.
Mean is pp, not 1p\frac{1}{p}
1p\frac{1}{p} is the mean number of trials until the first success (geometric distribution), which is a different model.
Forgetting independence
Sum of two Bernoullis X1+X2X_1 + X_2 has variance equal to the sum of variances only if they are independent.
Confusing Bernoulli with binomial
A single Bernoulli trial has parameter pp alone; a binomial has parameters nn (count) and pp (success probability).
Range of pp
p∈[0,1]p \in [0, 1]. If a calculation gives p<0p < 0 or p>1p > 1, something is wrong.

Exam-style questions

Questions in the style of NESA exam questions on this dot point, each with a worked answer. They are written by ExamExplained unless tagged "Past paper"; the year shows the paper a question is modelled on.

HSC 2023-style2 marks
A Bernoulli random variable XX has P(X=1)=0.4P(X = 1) = 0.4. Find E(X)E(X) and Var(X)\text{Var}(X).
Show worked answer →

For a Bernoulli variable, E(X)=pE(X) = p and Var(X)=p(1−p)\text{Var}(X) = p(1 - p).

Here p=0.4p = 0.4, so E(X)=0.4E(X) = 0.4.

Var(X)=0.4×0.6=0.24\text{Var}(X) = 0.4 \times 0.6 = 0.24.

HSC 2020-style3 marks
A Bernoulli trial has success probability pp. Show that the variance is greatest when p=12p = \frac{1}{2}, and state the maximum variance.
Show worked answer →

The variance is V(p)=p(1−p)=p−p2V(p) = p(1 - p) = p - p^2, a downward parabola in pp.

Differentiate: V′(p)=1−2pV'(p) = 1 - 2 p. Setting V′(p)=0V'(p) = 0 gives p=12p = \frac{1}{2}.

Since V′′(p)=−2<0V''(p) = -2 < 0, this is a maximum.

Maximum variance: V ⁣(12)=12⋅12=14V\!\left( \tfrac{1}{2} \right) = \tfrac{1}{2} \cdot \tfrac{1}{2} = \tfrac{1}{4}.

Practise this

Sources & how we know this

ExamExplained