Unit content
Bernoulli and binomial distributions
A Bernoulli trial has two outcomes, often called success and failure. If success has probability $p$, then failure has probability $1-p$.
A Bernoulli random variable $X$ can be defined by
$$X=\begin{cases} 1,&\text{success},\ 0,&\text{failure}. \end{cases}$$
Then
$$P(X=1)=p,\qquad P(X=0)=1-p.$$
Repeated Bernoulli trials
Suppose the same trial is repeated $n$ times, independently, with the same success probability $p$. Let $X$ count the number of successes.
Then $X$ has a binomial distribution:
$$X\sim\operatorname{Bin}(n,p).$$
To obtain exactly $k$ successes, one particular ordering has probability
$$p^k(1-p)^{n-k},$$
and there are $\binom nk$ ways to choose the positions of those successes. Therefore
$$P(X=k)=\binom nk p^k(1-p)^{n-k}.$$
Example
If a fair coin is flipped $4$ times, the probability of exactly $3$ heads is
$$\binom43\left(\frac12\right)^3\left(\frac12\right)=\frac14.$$
When the model applies
The binomial model requires a fixed number of trials, two outcomes per trial, independent trials and the same success probability on every trial.
If sampling is performed without replacement from a small finite population, for example, the trials are not exactly independent and a binomial model may be inappropriate.