## Binomial Distribution

The binomial distribution is closely related to the Bernoulli distribution. In order to understand it better assume that $X_{1},X_{2},...,X_{n}$ are i.i.d (independent, identical distributed) variables following a Bernoulli distribution with $P(X_{i}=1)=\pi$ and $P(X_{i}=0)=1-\pi$.

For a better understanding think that $X_{1},X_{2},...,X_{n}$  are outcomes of a coin flip, where 1 means head and 0 means tail. In this case

$\textbf{X}= X_{1}+X_{2}+...+X_{n}=\sum_{i=1}^{n} X_{i}= Frequence\ of\ 1'' \sim B(n,\pi)$

The probability function of the Binomial distribution looks the following:

$f(x)=\left\{\begin{array}{ll} {n \choose x} \pi^{x}(1-\pi)^{1-x} & x\in \{0,1,..,n\} \\ 0 & otherwise\end{array}\right.$

Properties of Bernoulli Distribution

a) Probability-generating function

$G_{x}(t)=E(t^{x})$

$G_{x}(t)\textbf{\ =\ }E(t^{x})\textbf{\ =\ }\sum_{x=0}^{n}t^{x}{n \choose x} \pi^{x}(1-\pi)^{n-x}\textbf{\ =\ }\sum_{x=0}^{n}{n \choose x} (t\pi)^{x}(1-\pi)^{n-x}$

In order to compute the next transformation the binomial theorem which says:

$(z+y)^{n}\textbf{\ =\ }\sum_{x=0}^{n}t^{x}{n \choose x}z^{n-x}y^{x}$

Looking at this we see that in our expression above we already have $\sum_{x=0}^{n}t^{x}{n \choose x}$. Now we take $z^{n-x}$ for $(1-\pi)^{n-x}$ and for $y^{x}$ we take $\pi^{x}$. Given all these things we can proceed with the expression derived above and write:

$\sum_{x=0}^{n}{n \choose x} (t\pi)^{x}(1-\pi)^{n-x}\textbf{\ =\ }(t\pi+1-\pi)^{n}$

By this we have our probability generating function given through

$G_{x}(t)\textbf{\ =\ }E(t^{x})\textbf{\ =\ }(t\pi+1-\pi)^{n}$

b) Expected Value and Variance

For computing the expected value and the variance we can use the probability generating function. The expected value is the first derivation of the probability generating function for the value one. The variance is defined through the second derivation from the probability generating function for value one plus the first derivation of the probability generating function at value one minus the squared first derivation of the probability generating function at value one. Putting the description in words we get

$E(x)=G^{'}_{x}(1)$

$Var(x)=G^{''}_{x}(1)+G^{'}_{x}(1)-(G^{'}_{x}(1))^{2}$

As seen, the computation of the expected value and the variance needs the first and second derivation of the probability generating function:

$G^{'}_{x}(t)=\pi n(t\pi+1-\pi)^{n-1}$

$G^{''}_{x}(t)=\pi^{2}n(n-1)(t\pi+1-\pi)^{n-2}$

By plugging in 1 it follows that:

$E(X)=G^{'}_{x}(1)=n\pi$

$E(X)=n\pi$

$Var(X)=G^{''}_{x}(1)+G^{'}_{x}(1)-(G^{'}_{x}(1))^{2}$

$Var(X)=\pi^{2}n(n-1)+\pi n-(\pi n)^{2}$

$Var(X)=\pi n(\pi(n-1)+1-\pi n)$

$Var(X)=n\pi(1-\pi)$

c) Independency

Assume X and Y are independently distributed with

$X \sim B(n,\pi)$

$Y \sim B(m,\pi)$

Then the probability generating function is

$G_{X+Y}(t)=G_{x}(t)*G_{Y}(t)$

$G_{X+Y}(t)=(t\pi+1-\pi)^{n+m}$

Thereby is $G_{X+Y}(t)$ a probability generating function of a variable which is distributed as $B(n+m,\pi)$.