Bernoulli Distribution

Definition

A Bernoulli trial is an experiment that has two possible outcomes, a success and a failure. We denote the probability of success by $p$ and the probability of failure by $q$ where $q = 1-p$.

Let $X$ be a discrete random variable. $X \sim \mathrm{Bern}(p)$ means $X$ takes on a Bernoulli distribution where the probability of success is $p$.

We want to count the number of successes. For any Bernoulli Trial, the number of successes can either be $0$ or $1$. Let $k$ be the number of successes that we achieve. Then the probability mass function \[f(x)= \begin{cases} p & \text{if }k=1, \\[6pt] q & \text {if }k=0.\end{cases}\] This is an identical expression to \[f(x)= p^k q^{1-k} = p^k (1-p)^{1-k} .\] Note: 1= This is because $k$ can only be $0$ or $1$.

Mean and Variance

Recall that the mean $\mu$ of a random variable is equal to its expected value; \[\mu = \mathrm{E} [X] = \sum\limits_{x=0}^1 x \times \mathrm{P}[X=x] = \sum\limits_{x=0}^1 x \times p^x q^{1-x} = \left( 0\times p^0 q^1 \right) + \left( 1\times p^1 q^0 \right) = 0 + 1\times p = p \text{.}\] So we have that the mean is $p$, what about the variance? As [[Measures of Dispersion#Variance | $\mathrm{Var}[X]$]] $ = \mathrm{E}[X^2]-\mu$. We see that \[\mathrm{E}[X^2] = \sum\limits_{x=0}^1 x^2 \times p^x q^{1-x} = \left( 0^2\times p^0q^1 \right) + \left( 1^2\times p^1q^0 \right) = 0 + 1\times p = p\] so we obtain the variance \[\mathrm{Var}[X] = \mathrm{E}[X^2] - \mu^2 = p - p^2 = p(1-p)\text{.}\]

Worked Example

Worked Example

From one coin toss, what is the probability of obtaining heads:

a) $0$ times?
b) $1$ time?
Solution

Although this may be straightforward, we will go through the problem using formal notation. A success is achieving heads and a failure is not achieving heads so the probability of success, $p$, and the probability of failure, $q$, are both equal to $0.5$. Let $X$ be the discrete random variable which counts the number of heads. Then $X \sim \mathrm{Bern}(0.5)$ so from the probability mass function of the Bernoulli distribution, we calculate that the probability of getting 0 successes is \[\mathrm{P}[X=0] = 0.5^0 \times (1-0.5)^{1-0} = 1 \times 0.5 = 0.5\] and the probability of getting 1 success is \[\mathrm{P}[X=1] = 0.5^1 \times (1-0.5)^{1-1} = 0.5 \times 1 = 0.5.\]

See Also

Binomial Distribution