Sections:

Profiles:

Binomial Probabilities

Given $n$ independent binomial events. Each event can be $A$ or $B$, where $P(A) = p$ is the probability that the event $A$ ocurrs, while $P(B) = 1 - p$ is the probability that the event $B$ ocurrs.

Finding $P(k_A|n)$, i.e. the probability that the event $A$ happens $k$ times when $n$ trials are realized:

$$P(K = k|n) = \binom{n}{k} p^k (1 - p)^{(n - k)}$$

The binomial coefficient $\binom{n}{k}$ represents how many ways exist to obtain, in a particular order, $k$ events $A$ in $n$ trials.

Remember that:

$$\binom{n}{k} = \frac{n!}{k!(n - k)!}$$

The cumulative distribution is:

$$F(K \leq k|n) = \sum_k \binom{n}{k} p^k (1 - p)^{n - k}$$

The expected value is$:

$$E[K] = \sum_k k P(K=k)$$

Therefore:

$$E[K] = \sum_{k = 0}^{n} k \binom{n}{k} p^k (1 - p)^{n - k}$$

$$E[K] = \sum_{k = 0}^{n} n \binom{n - 1}{k - 1} p^k (1 - p)^{n - k}$$

$$E[K] = np \sum_{k = 0}^{n} \binom{n - 1}{k - 1} p^{k - 1} (1 - p)^{(n - 1) - (k - 1)}$$

Let $j = k - 1$:

$$E[K] = np \sum_{j = 0}^{n - 1} \binom{n - 1}{j} p^j (1 - p)^{(n - 1) - j}$$

Taking the binomial theorem:

$$(x + y)^m = \sum_{j = 0}^m \binom{m}{j} x^j y^{m - j}$$

Then:

$$E[K] = np (p + (1 - p ))^{n - 1}$$

$$E[K] = np (1)^{n - 1}$$

$$E[K] = np \quad \Box$$

The variance is:

$$\text{Var}(K) = E[K^2] - E[K]^2$$

$K^2$ can be expressed as:

$$K^2 = K(K - 1) + K \implies E[K^2] = E[K(K - 1)] + E[K]$$

Let's find $E[K(K - 1)]$, considering that $g(K) = K (K - 1)$:

$$E[g(K)] = \sum_k g(k)P(K = k)$$

$$E[K(K - 1)] = \sum_{k = 1}^n k(k - 1) \binom{n}{k} p^k (1 - p)^{n - k}$$

Using the combinatorial identity:

$$k(k - 1) \binom{n}{k} = n(n - 1) \binom{n - 2}{k - 2} \quad \text{for } k \geq 2$$

$$E[K(K - 1)] = n(n - 1) \sum_{k = 2}^n \binom{n - 2}{k - 2} p^k (1 - p)^{n - k}$$

Then, extracting the factor $p^2$ and replacing the index by $j = k - 2$:

$$E[K(K - 1)] = n(n - 1) p^2 \sum_{j = 0}^{n - 2} \binom{n - 2}{j} p^j (1 - p)^{(n - 2) - j}$$

We already know that:

$$\binom{n - 2}{j} p^j (1 - p)^{(n - 2) - j} = (p + (1 - p))^{n - 2} = 1$$

Therefore:

$$E[K(K - 1)] = n(n - 1)p^2$$

Now, the variance is:

$$\text{Var}(K) = E[K(K - 1)] + E[K] - E[K]^2$$

$$\text{Var}[K] = n(n - 1)p^2 + np - (np)^2$$

$$\text{Var}[K] = (np)^2 - np^2 + np - (np)^2$$

$$\text{Var}[K] = np(1 - p) \quad \Box$$