3.7 Bernoulli distribution

Bernoulli random variable

  • Toss a coin
    • It lands on a heads with probability of \(p\)
    • It lands on a tails with probability of \(1-p\).

The Bernoulli random variable \(X\):

\[p_X(x) = \begin{cases} p, & \text{if $x = 1$,} \\ 1-p, & \text{if $x = 0$,} \\ 0, & \text{otherwise.} \\ \end{cases} \]

We refer to \(X\) as a Bernoulli RV with parameter \(p\).

Or simply

\[ X \sim \text{Bernoulli}(p) \]

Tossing a fair coin

\[ X \sim \text{Bernoulli}(0.5) \]

Interactive visualization

Expected value

\[ X \sim \text{Bernoulli}(p) \]

\[ p_X(x) = \begin{cases} p, & \text{if $x = 1$,} \\ 1-p, & \text{if $x = 0$,} \\ 0, & \text{otherwise.} \\ \end{cases} \]


\[ \text{E}[X]=1 \cdot p + 0 \cdot (1-p)=p \]

Variance

\[ \begin{aligned} \text{var}(X)&=\text{E}[X^2]-\big(\text{E}[X]\big)^2 \\ \\ \text{E}[X^2]&=1^2 \cdot p + 0^2 \cdot (1-p)=p \\ \\ \text{var}(X)&=p-p^2=p(1-p) \end{aligned} \]