# Bernoulli Distribution

A r.v. $X$ has a Bernoulli distribution with parameter $p\in\left[0,1\right]$ if $X$ is discrete with p.m.f.

$f_{X}\left(x\right)=\begin{cases} p, & if\,x=1\\ 1-p, & if\,x=0\\ 0 & otherwise \end{cases}$

The Bernoulli distribution captures the outcome of a binary experiment. For example, one could toss a biased coin, with probability of Heads equal to $p$.

## Mean

$E\left(X\right)=\sum_{x\in S}xf_{X}\left(\left.x\right|p\right)=0.f_{X}\left(\left.0\right|p\right)+1.f_{X}\left(\left.1\right|p\right)=p,\,$ where $S=\left\{ x:f_{X}\left(\left.x\right|p\right)\gt 0\right\}$ is the support of $X$.

## Variance

$Var\left(X\right)=E\left[\left(X-E\left(X\right)\right)^{2}\right]=E\left(X^{2}\right)-E\left(X\right)^{2}=\underset{0^{2}.f_{X}\left(\left.0\right|p\right)+1^{2}.f_{X}\left(\left.1\right|p\right)}{\underbrace{p}-p^{2}}=p\left(1-p\right)$

## MGF

\begin{aligned} M_{X}\left(t\right) & =E\left(\exp\left(Xt\right)\right)=\sum_{x\in S}\exp\left(tx\right)f_{X}\left(\left.x\right|p\right)\\ & =\exp\left(t.0\right)f_{X}\left(\left.0\right|p\right)+\exp\left(t.1\right)f_{X}\left(\left.1\right|p\right)\\ & =1-p+\exp\left(t\right)p\end{aligned}