Why Bernoulli Moments Are Simple
A Bernoulli variable records one binary outcome: success or failure, event or non-event, response or no response. Its probability mass is concentrated at just two values, 0 and 1. That simplicity has a useful consequence: every positive integer power of the variable is the variable itself. Once this identity is connected to the definition of expectation, the raw moments follow without repeated summation.
Here we derive the mean and variance directly from the probability mass function, then use the indicator interpretation to obtain all positive-integer raw moments. The parameter \(p\) may be any probability, including 0 or 1.
Definition and Two-Point Probability Mass Function
The outcome coded 1 is called the success. The probability \(p\) is the chance of that coded outcome; the choice of which outcome receives the label 1 is part of the model. Since the support contains only two points, expectation is a finite sum:
for any function \(g\) for which the displayed values are defined. This formula is just the discrete expectation rule: multiply each function value by the probability of its corresponding outcome and add.
Worked Example: Computing the Mean from the PMF
Let \(X\sim\operatorname{Bernoulli}(0.3)\), where \(X=1\) means that a patient experiences a specified side effect. Compute \(E[X]\) directly.
The two possible contributions to the expectation are \(0\cdot P(X=0)\) and \(1\cdot P(X=1)\). Substitution gives $$ E[X]=0(0.7)+1(0.3)=0.3. $$
Thus the mean of the 0–1 indicator equals the event probability. The mean is not an additional probability calculation; it is the probability-weighted average of the variable's two values.
Mean and Variance
The expectation calculation gives the mean immediately. To obtain the variance, first calculate the second raw moment \(E[X^2]\), then apply the definition \(\operatorname{Var}(X)=E[(X-E[X])^2]\), equivalently \(E[X^2]-(E[X])^2\) when the second moment is finite. It is finite here because \(X\) is bounded.
Derivation. By the two-point expectation formula,
For the second raw moment, the same sum yields
Consequently,
The formula also holds at the endpoints. If \(p=0\), then \(X=0\) with probability one; if \(p=1\), then \(X=1\) with probability one. In either case the variable is constant and its variance is 0, as \(p(1-p)\) states.
Worked Example: Variance of an Adverse-Event Indicator
Suppose an adverse event occurs with probability \(p=0.08\), and let \(X=1\) if it occurs and \(X=0\) otherwise. Find the mean, variance, and standard deviation of \(X\).
The mean is $$ E[X]=p=0.08. $$
The variance is $$ \operatorname{Var}(X)=p(1-p)=0.08(0.92)=0.0736. $$
The standard deviation is the nonnegative square root of the variance: $$ \sqrt{\operatorname{Var}(X)}=\sqrt{0.0736}\approx 0.2713. $$
The standard deviation is on the scale of \(X\), whose values are 0 and 1. It is not itself the event probability; here it is about 0.2713, whereas the event probability and mean are both 0.08.
The Indicator Identity and Raw Moments
Every Bernoulli variable can be written as an indicator. If \(A\) is the event that the outcome is coded as success, the indicator \(I_A\) is 1 when \(A\) occurs and 0 otherwise. Thus \(X=I_A\) and \(P(A)=p\). At either possible value, raising \(X\) to a positive integer power does not change it: \(0^r=0\) and \(1^r=1\).
Proof. Since \(X\in\{0,1\}\), when \(X=0\) we have \(X^r=0=X\), and when \(X=1\) we have \(X^r=1=X\). Therefore \(X^r=X\) pointwise. Taking expectations of both sides gives
For \(r=0\), \(X^0=1\) under the stated convention, so \(E[X^0]=E[1]=1\). \(\square\)
A raw moment of order \(r\) is \(E[X^r]\); it is taken about zero. A central moment of order \(r\) is \(E[(X-E[X])^r]\); it is taken about the mean. They are not interchangeable: the first raw moment is the mean, while the second central moment is the variance. For Bernoulli variables, every positive-order raw moment is \(p\), but central moments generally depend on the order and are not all \(p\).
Worked Example: Third Raw Moment and a Central Moment
Let \(X\sim\operatorname{Bernoulli}(0.65)\). Find the first three raw moments and the second central moment.
For each positive integer \(r\), \(E[X^r]=p\). Therefore $$ E[X]=0.65,\qquad E[X^2]=0.65,\qquad E[X^3]=0.65. $$
The second central moment is the variance, not the second raw moment: $$ E[(X-E[X])^2]=E[X^2]-(E[X])^2=0.65-(0.65)^2 =0.65-0.4225=0.2275. $$
This agrees with \(p(1-p)=0.65(0.35)=0.2275\). The two second-order quantities differ: \(E[X^2]=0.65\), whereas \(E[(X-E[X])^2]=0.2275\).
Using the Indicator View in Calculations
The indicator identity is useful whenever a binary event is encoded numerically. It avoids expanding powers or listing the same two outcomes repeatedly. For example, if a study records whether a participant responds to treatment, \(X=I_A\) for the response event \(A\), so \(E[X]=P(A)\), \(E[X^2]=P(A)\), and \(E[X^r]=P(A)\) for every positive integer \(r\).
This statement concerns one Bernoulli variable. It does not require a collection of trials, independence, or a count of successes. Those are separate modeling questions. The moment calculation here depends only on the two possible values and their probabilities.
State which event corresponds to \(X=1\), so that \(p=P(X=1)\).
For a function \(g\), compute \(E[g(X)]=(1-p)g(0)+p\,g(1)\).
For a positive integer \(r\), use \(X^r=X\), and hence \(E[X^r]=p\).
Use \(\operatorname{Var}(X)=E[X^2]-(E[X])^2\), rather than confusing \(E[X^2]\) with the variance.
Worked Example: Checking a Boundary Case
Let \(X\sim\operatorname{Bernoulli}(1)\). Calculate its first three raw moments and variance, and check them against the general formulas.
Here \(P(X=1)=1\) and \(P(X=0)=0\), so \(X=1\) with probability one. Directly, \(E[X]=1\), \(E[X^2]=1\), and \(E[X^3]=1\). The indicator identity gives the same result because \(X^r=X\) for each positive integer \(r\).
The variance is $$ \operatorname{Var}(X)=E[X^2]-(E[X])^2=1-1^2=0. $$
The formulas give \(E[X^r]=p=1\) and \(\operatorname{Var}(X)=p(1-p)=1(0)=0\). The direct calculation and the general formulas agree.
Common Mistake: Confusing Raw Moments with Variance
A frequent error is to say that the variance is \(E[X^2]\), then report \(p\). This omits the centering by the mean. The correct calculation subtracts the square of the mean:
For \(p=0.3\), for instance, \(E[X^2]=0.3\), but \(\operatorname{Var}(X)=0.3(0.7)=0.21\). The raw second moment and variance answer different questions. Another potential slip is to apply \(X^r=X\) to non-integer or negative powers without checking definitions: the stated identity here is for positive integer \(r\), with the zeroth moment handled separately.
Check Your Understanding
Answer each question using the two-point pmf or the indicator identity.
- If \(X\sim\operatorname{Bernoulli}(0.4)\), calculate \(E[X]\), \(E[X^2]\), and \(\operatorname{Var}(X)\).
- Explain why \(X^5=X\) for every outcome of a Bernoulli variable.
- For a Bernoulli variable with \(p=0\), what are \(E[X^3]\) and \(\operatorname{Var}(X)\)? Verify the answers from its possible outcomes.
- What is the difference between the second raw moment and the second central moment?
- If \(X=I_A\), express \(E[X^r]\) in terms of \(P(A)\) for a positive integer \(r\), and state the identity that justifies your answer.