## Bernoulli Trials

A Bernoulli trial is basically a single coin toss or a dice roll. It generates an experimental value for a discrete random variable $X$.

**Example:** The PMF for a coin toss is

\begin{equation}

P_X(x)=

\begin{cases}

&1-P_0, \qquad \mathrm{x=0}\\

&P_0, \quad \mathrm{x=1}\\

&0, \qquad \mathrm{Otherwise}\\

\end{cases}

\end{equation}

Note that if $P_0=0.5$ the coin is unbiased.

**Example:** The PMF for a dice roll is **not** a bernoulli trial, as there are six, not two, possible answers. Assuming that the dice is unloaded, the pmf is

\begin{equation}

P_X(x)=

\begin{cases}

&\frac{1}{6}, \qquad \mathrm{x=1}\\

&\frac{1}{6}, \qquad \mathrm{x=2}\\

&\frac{1}{6}, \qquad \mathrm{x=3}\\

&\frac{1}{6}, \qquad \mathrm{x=4}\\

&\frac{1}{6}, \qquad \mathrm{x=5}\\

&\frac{1}{6}, \qquad \mathrm{x=6}\\

&0, \qquad \mathrm{otherwise}

\end{cases}

\end{equation}

## Moment generating function of a Bernoulli trial

\begin{equation}

M_X(z)= 1-P_0 + P_0 e^{t}

\end{equation}

From here we can find that $E(X)=P_0$, $E(X^2)=P_0$, $\sigma_X^2=P_0-P_0^2$

## Moment generating function of an unloaded dice

\begin{eqnarray}

M_X(z)=\frac{1}{6}e^{t}+\frac{1}{6}e^{2t}+\frac{1}{6}e^{3t}+\frac{1}{6}e^{4t}+\frac{1}{6}e^{5t}+\frac{1}{6}e^{6t}

\end{eqnarray}

**Problem**: Compute the mean and the variance.

## Bernoulli Processes

A bernoulli process is a sequence of iid bernoulli trials.

Example: Suppose we toss a coin $n$ times, where the outcome of the $i$th trial is defined as the discrete random variable $X_i$. Then the sequence of iid random variables

\begin{eqnarray}

X_1, X_2, X_3, \ldots, X_n

\end{eqnarray}

is a bernoulli process.

## Binomial Distribution

A random variable $Y$ is said to be binomially distributed if it is the sum of a bernoulli process:

\begin{eqnarray}

Y=X_1+X_2+\ldots+X_n

\end{eqnarray}

and, as $X_i$ are iid

\begin{eqnarray}

M_Y(z)=(1-P+e^{t}P)^n = \sum_{i=0}^n \binom{n}{i} P^i (1-P)^{(n-i)}e^{it}

\end{eqnarray}

This gives

\begin{eqnarray}

p_Y(i)=\binom{n}{i} P^i (1-P)^{(n-i)}

\end{eqnarray}

which is the definition of the Binomial distribution

It is possible to compute the expectation and the variance of the binomial

distribution from its moment generating function. But an easier way to go is to remember that the expectation of the sum of random variables is the sum of the expectations, and the variance of the sum of (uncorrelated) random variables is the sum of variances. As $Y$ is the sum of iid random variables, $E(Y)=nP$ and $\sigma_Y^2=nP(1-P)$.

**Exercise:** Let us roll an unbiased dice 10 times and sum the result. What is the distribution? What is the mean and variance?

Note: This is **not** a Binomial distribution!! Such distributions are called “multinomial”.

## Interarrival times for Bernoulli processes: Geometic and Pascal Distributions

In the coin tossing exprtiment, let us name a head (ie, a 1) a “success” and a tail (ie, a 0) a “failure”. And let us name the successes as “arrivals”

### Geometric Distribution

Let the random variable $L_1$ denote the “how many tosses it takes for the first arrival”. This is also known as the

“the first intrarrival time“. It can take on the experimental values 1, 2, 3, etc, up to infinity. Its PMF is:

\begin{eqnarray}

p_{L_1}(l)=(1-P)^{(l-1)}P

\end{eqnarray}

Its z-transform is

\begin{eqnarray}

M_{L_1}(t)=\sum_{l=1}^{\infty}(1-P)^{(l-1)}Pe^{tl}=\frac{e^{t}P}{1-e^{t}(1-P)}

\end{eqnarray}

The calculation of $E(L_1)$ and $\sigma^2_{L_1}$ by direct methods involve difficult sums. Hence we use the moment-generating property of z transforms:

\begin{eqnarray}

E(L_1)&=&\left[ \frac{d}{dt}M_{L_1}(t)\right]_{t=0} = \frac{1}{P}\nonumber\\

\sigma^2_{L_1} &=& \left[ \frac{d^2}{dt^2}M_{L_1}(t) –

\left( \frac{d}{dt}M_{L_1}(t) \right)^2 \right]_{t=0} = \frac{1-P}{P^2}\nonumber

\end{eqnarray}

### No-memory property of the Geometric Distribution and Gambler’s Fallacy

Assume we started tossing coins and got no success in the first $m$ trials. The PMF for the success at $n$’th trial given the failure of the

first $m$ trials, $m<n$, is the geometric PMF for $k=n-m$

\begin{eqnarray}

p_{L_1}(k | \mathrm{First.} m \mathrm{.trials. are. failures}) = p_{L_1}(k-m)

\end{eqnarray}

This is called no-memory property, as the future results are completely independent from the past results. We can not predict the future by

looking at the past, as there is no connection between them..\\

Sometimes, this is expressed as the “Gambler’s Paradox”. A gambler thinks that in coin tossing a long series of failures will increase

the probability of success in the next toss. But this is wrong. A long string of failures in the past will not change the probability of

success in the next toss.

### Pascal distribution

The random variable $L_r$, calledÂ “rth order intrarrival time”, denotes the number of trials up to and including $r$’th success. It is the sum of $r$ iid first order interarrival times, or $L_1$’s. The resulting z-transform is:

\begin{eqnarray}

M_{L_r}(t)= \left[\frac{e^t P}{1-e^t(1-P)} \right]^r

\end{eqnarray}

It is possible to invert the above equation to find the PMF, but it is much easier to go directly:

$p_{L_r}(l)$ = p(r-1 arrivals till time l-1)xP(exactly 1 arrival at time l given r-1 arrivals in time 1..l-1) \\\\

The first part is the binomial distribution for $r-1$ success in $l-1$ trials. The second term simply equals to $P$

because of the no-memory property. Substituting

\begin{eqnarray}

p_{L_r}(l) &=& \left[\binom{l-1}{r-1}P^{r-1}(1-P)^{l-1-(r-1)}\right]P\\

&=&\binom{l-1}{r-1}P^r (1-P)^{l-r}, \qquad l\geq r

\end{eqnarray}

This is known as the Pascal distribution. For $r=1$, we recover geometric distribution. \\

Since Pascal distribution results from the iid sums of geometric distributions, we have

\begin{eqnarray}

E(L_r)=\frac{r}{P}, \qquad \sigma_{L_r}^2=\frac{r(1-P)}{P^2}

\end{eqnarray}

## Poisson Processes

In a Bernoulli (and associated Geometric and Pascal) process, arrivals happen at discrete times. In a Poisson (and associated Exponential and Erlang)

process, arrivals happen at continuous times.

Let $X$ be a random variable that represent the number of cars passing through a point in an hour. We will assume that all of the hours are the same

(ie, there is no “special” hours like rush hours). Also, we will assume that arrival of cars are completely independent, ie, if a lot of cars passed

in an hour this will not lessen the number of cars that will pass in the next hour. \\

We will assume the expectation of the number of cars passing through in an hour is known,

\begin{eqnarray}

E(X)=\lambda

\end{eqnarray}

Now we can divide the hour into $n$ equal intervals and make the assumption that in an that interval only one car can pass, with probability $p$.

This will regard $X$ as the sum of $n$ independent bernoulli trials, ie, a binomial process. Recall that in a binomial process

\begin{eqnarray}

E(X)=\lambda=nP

\end{eqnarray}

and

\begin{eqnarray}

P(X=k)&=&\binom{nt}{k}P^k (1-P)^{tn-k} \\

&=&\binom{nt}{k}\left(\frac{\lambda}{n} \right)^k \left(1-\frac{\lambda}{nt}\right)^{nt-k} \\

&=&\frac{(nt)!}{k!(nt-k)!}\left(\frac{\lambda}{n} \right)^k \left(1-\frac{\lambda}{n}\right)^{nt-k}\\

&=&\frac{(nt)\ldots(nt-k+1)}{n^k}\frac{\lambda^k}{k!} \left(1-\frac{\lambda}{n}\right)^{nt}\left(1-\frac{\lambda}{n}\right)^{-k}

\end{eqnarray}

The problem with this model is that it limits the number of cars that can pass in any one time slices to 1, or number of cars that can pass

in an hour to $n$. The solution is to increase $n$. When we do this, the result is

\begin{eqnarray}

P(X=k)=\frac{(\lambda t)^k e^{-\lambda t}}{k!}

\end{eqnarray}

Which shows that poisson distribution is nothing but coin tossing, with all the associated memory properties.

### Exponential and Erlang Distribution

Let the random variable $T_r$ be defined as the time of $r$th arrival. Then $T_r$ will have a PDF, not a PMF (Note that Poisson distribution is a PMF). This means that $P(T_r=t)=0$, hence we cannot use the methodology we had used when calculating the PMF of Poisson distribution. Instead, we need to calculate $P(t<T_r<t+\Delta t) = f_R(t) \Delta t$ where $f_R(t)$ is the desired PDF. We can write that

$P(t<T_r<t+\Delta t) = f_{T_r}(t) \Delta t=$ ($r-1$ arrivals between $0$ and $t$) x (exactly one arrival between $t$ and $\Delta t$).

The first paranthesis is the $r-1$ th order poisson distribution. The second paranthesis is simply $\lambda \Delta t $. As we deal with a discretized bernoulli process the arrivals at the two intervals $(0,t)$ and $(t,t+\Delta t)$ are independent. Hence

\begin{eqnarray}

P(t<T_r<t+\Delta t) = f_{T_r}(t) \Delta t = \frac{(\lambda t)^{r-1} e^{-\lambda t}}{(r-1)!}\times \lambda \Delta t

\end{eqnarray}

or

\begin{eqnarray}

f_R(t)= \frac{ \lambda^r t^{r-1} e^{-\lambda t} } {(r-1)!}

\end{eqnarray}

This is known as the Erlang PDF. For $r=1$, we get a special case, which is known as the exponential distribution:

\begin{eqnarray}

f(t)=\lambda e^{-\lambda t}

\end{eqnarray}

\\\\

{\bf Problem:} Let $\lambda$= 6 arrivals per hour. If there is 10 arrivals between 9:00 and 12:00, what is the probability that there are 6 arrivals between 10:00 and 11:00?

\\\\

{\bf Problem:} Let $\lambda$= 6 arrivals per hour. If there is 10 arrivals between 9:00 and 12:00, what is the probability that there are 6 arrivals between 11:00 and 13:00?

\\\\

{\bf Problem:} Derive the pdf of Erlang distribution from the cdf of Pascal distribution.