Why the Two Possible Values Are Enough
A Bernoulli variable records whether one event occurs. Its simplicity is useful: the variable can take only the values zero and one, so its mean and variance can be derived by listing those two possibilities and their probabilities. These formulas are used repeatedly when an event is represented by an indicator, such as whether a claim meets a specified condition or whether an inspection detects a defect.
The mean of a Bernoulli variable is its success probability. Its variance, however, is not that probability: it is the product of the success and failure probabilities. Deriving both quantities from the distribution makes the distinction clear and helps prevent errors in later calculations.
For any random variable with a finite distribution, its first raw moment is \(E[X]\), its second raw moment is \(E[X^2]\), and its variance is \(E[(X-E[X])^2]\). A raw moment is calculated using powers of the variable itself, rather than deviations from its mean. In the Bernoulli case, only two terms are needed for each expectation.
Deriving the Mean and Second Raw Moment
Use the two possible values of \(X\) and multiply each value by its probability. For the mean, the value 0 contributes nothing, while the value 1 contributes \(p\). For the second raw moment, the squared values are \(0^2=0\) and \(1^2=1\), so the same contribution results.
Thus, for a Bernoulli variable, the first and second raw moments happen to have the same numerical value. This occurs because squaring either possible value leaves it unchanged: \(0^2=0\) and \(1^2=1\). It does not mean that \(E[X^2]\) equals \((E[X])^2\). In fact, those quantities are \(p\) and \(p^2\), respectively.
Worked Example: A Hypothetical Eligibility Indicator
In a hypothetical screening process, an application is eligible for a particular review stage with probability \(0.12\). Define \(X=1\) if a randomly selected application is eligible and \(X=0\) otherwise. Find the distribution, mean, second raw moment, variance, and standard deviation of \(X\). No interest rate or mortality assumption is involved; the model is \(X\sim\operatorname{Bernoulli}(p)\) with \(p=0.12\).
Step 1: State the two probabilities. By the definition of the variable, \(P(X=1)=0.12\) and \(P(X=0)=1-0.12=0.88\).
Step 2: Calculate the mean and second raw moment. $$ E[X]=0(0.88)+1(0.12)=0.12, \qquad E[X^2]=0^2(0.88)+1^2(0.12)=0.12. $$
Step 3: Calculate the variance and standard deviation. The Bernoulli variance formula derived below gives $$ \operatorname{Var}(X)=0.12(1-0.12)=0.12(0.88)=0.1056. $$ Therefore the standard deviation is \(\sqrt{0.1056}\approx 0.3250\), rounded to four decimal places.
Check. The probabilities sum to \(0.88+0.12=1\), and the calculated variance is positive. The mean, \(0.12\), is the probability of eligibility; it is not the variance. A common mistake would be to report \(0.12^2=0.0144\) as the variance by squaring the mean.
Deriving the Variance
Variance measures the expected squared distance from the mean. Since the mean of \(X\) is \(p\), the deviation is \(0-p=-p\) when \(X=0\), and \(1-p\) when \(X=1\). Weight the squared deviations by their respective probabilities:
The last step uses \(p+(1-p)=1\). This direct derivation shows why both outcomes matter: variation comes from the squared distance associated with each outcome, weighted by the probability of that outcome.
The same result can be checked using the computational variance formula \(\operatorname{Var}(X)=E[X^2]-(E[X])^2\). Substituting the Bernoulli moments gives \(p-p^2=p(1-p)\), in agreement with the direct calculation. This check also highlights a frequent source of error: the second raw moment is \(p\), whereas the squared mean is \(p^2\).
Interpreting the Formula
Because \(X\) is an indicator, its expected value equals the probability that the represented event occurs. For example, if \(X=1\) means that a hypothetical test flags an item, then \(E[X]\) is the probability an item is flagged. The variance describes the spread of the zero-one values around that mean; it is not itself a probability of either outcome.
The formula \(p(1-p)\) is unchanged when \(p\) is replaced by \(1-p\). Accordingly, a success probability of \(0.3\) and a success probability of \(0.7\) produce the same variance, even though their means differ. The variance is zero at either endpoint, \(p=0\) or \(p=1\), because the outcome is then certain. It is largest at \(p=0.5\), where both possible values are equally likely.
To verify the maximum, complete the square:
Equality holds only when \(p=\frac12\). This bound is a useful check: a proposed Bernoulli variance greater than \(0.25\) cannot be correct.
Worked Example: Calculating Variance in Two Ways
A hypothetical quality-control flag is set to 1 when an inspected item has a specified flaw and to 0 otherwise. The flaw probability is \(p=0.35\), so \(X\sim\operatorname{Bernoulli}(0.35)\). Calculate \(E[X]\), \(E[X^2]\), and \(\operatorname{Var}(X)\), first from the two central deviations and then using the computational formula. No interest rate or mortality assumption is part of this probability model.
Step 1: Record the distribution and moments. \(P(X=1)=0.35\) and \(P(X=0)=1-0.35=0.65\). Therefore $$ E[X]=0(0.65)+1(0.35)=0.35, \qquad E[X^2]=0^2(0.65)+1^2(0.35)=0.35. $$
Step 2: Calculate variance from the central deviations. The mean is \(0.35\). At \(X=0\), the squared deviation is \((0-0.35)^2=0.1225\); at \(X=1\), it is \((1-0.35)^2=0.4225\). Weight each by its probability: $$ \begin{aligned} \operatorname{Var}(X) &=0.1225(0.65)+0.4225(0.35)\\ &=0.079625+0.147875\\ &=0.2275. \end{aligned} $$
Step 3: Check with the computational formula. $$ \operatorname{Var}(X)=E[X^2]-(E[X])^2 =0.35-(0.35)^2 =0.35-0.1225 =0.2275. $$ The two calculations agree, and the result also equals \(0.35(0.65)=0.2275\).
Common mistake avoided. Using \(0.35^2=0.1225\) as the variance confuses the squared mean with the variance. The correction is to subtract that squared mean from the second raw moment: \(0.35-0.1225=0.2275\).
What Variance Can and Cannot Tell You
If \(p\) is known, the Bernoulli variance is determined immediately. The reverse is not always true. Given a variance \(v\), one must solve \(p(1-p)=v\); when \(0<v<0.25\), there are generally two possible probabilities, one below \(0.5\) and the other above \(0.5\). Additional information about the event may distinguish them.
Worked Example: Recovering a Probability From Variance
For a hypothetical binary alert, let \(X=1\) indicate that an alert is issued and \(X=0\) otherwise. The model is \(X\sim\operatorname{Bernoulli}(p)\), and its variance is known to be \(0.21\). A separate condition states that the alert probability exceeds \(0.5\). Find \(p\), \(E[X]\), and \(E[X^2]\). No interest rate or mortality assumption is involved.
Step 1: Use the Bernoulli variance formula. $$ p(1-p)=0.21 \quad\Longrightarrow\quad p-p^2=0.21 \quad\Longrightarrow\quad p^2-p+0.21=0. $$
Step 2: Solve the quadratic. Its discriminant is \(1-4(0.21)=1-0.84=0.16\), whose square root is \(0.4\). Thus $$ p=\frac{1\pm 0.4}{2}, $$ so the two algebraic possibilities are \(p=0.7\) and \(p=0.3\).
Step 3: Apply the condition and calculate the moments. Since the stated probability exceeds \(0.5\), choose \(p=0.7\), not \(0.3\). Hence $$ E[X]=0.7,\qquad E[X^2]=0.7. $$
Check. The selected value gives \(\operatorname{Var}(X)=0.7(0.3)=0.21\), as required. Without the condition \(p>0.5\), the variance alone would not distinguish between \(0.3\) and \(0.7\).
Common Mistakes and a Reliable Check
- Squaring the mean and calling it the variance. For a Bernoulli variable, \((E[X])^2=p^2\), while \(E[X^2]=p\). The variance is their difference, \(p-p^2\).
- Forgetting the failure probability. The variance is \(p(1-p)\), not just \(p\). Both outcomes contribute to variability.
- Changing what success means midway through a calculation. First define which event corresponds to \(X=1\), then use its probability consistently as \(p\).
- Assuming a variance identifies \(p\) uniquely. Except at special boundary or maximum values, \(p\) and \(1-p\) give the same variance. Use any additional condition to choose between them.
A useful final check is to confirm that \(0\leq p\leq1\), that \(E[X]=E[X^2]=p\), and that \(0\leq\operatorname{Var}(X)\leq0.25\). If the result fails one of these checks, revisit the outcome probabilities or the distinction between a raw moment and a squared mean.
Check Your Understanding
For each hypothetical setting, define the Bernoulli parameter from the event description and use the two possible values to check the requested moments.
- A randomly selected application passes a specified screen with probability \(0.08\). Let \(X=1\) for a pass and \(X=0\) otherwise. Find \(E[X]\), \(E[X^2]\), and \(\operatorname{Var}(X)\). (Answer: \(E[X]=0.08,\ E[X^2]=0.08,\ \operatorname{Var}(X)=0.0736\).)
- A hypothetical sensor issues a warning with probability \(0.62\). For its zero-one warning indicator \(W\), calculate the mean and variance by first listing the two outcome probabilities, then verify the variance using \(E[W^2]-(E[W])^2\). (Answer: \(P(W=0)=0.38,\ P(W=1)=0.62,\ E[W]=E[W^2]=0.62,\ \operatorname{Var}(W)=0.2356\).)
- A hypothetical review variable is \(R=1\) when an application is rejected and \(R=0\) when it is accepted. Acceptance probability is \(0.91\). Find the parameter \(p\) for \(R\), then calculate its mean, second raw moment, and variance. (Answer: \(p=0.09,\ E[R]=E[R^2]=0.09,\ \operatorname{Var}(R)=0.0819\).)
- A zero-one indicator has variance \(0.16\), and its success probability is known to be less than \(0.5\). Solve for the probability and then state the mean and second raw moment. (Answer: \(p=0.2,\ E[X]=E[X^2]=0.2\); the other quadratic root is \(0.8\), excluded by the condition.)
- A hypothetical binary event indicator has second raw moment \(0.4\). Use its two possible values to infer its success probability, then calculate its mean and variance and check that the variance does not exceed \(0.25\). (Answer: \(p=0.4,\ E[X]=0.4,\ \operatorname{Var}(X)=0.24\), which is at most \(0.25\).)