# Poisson Distribution

$$P(X =k) = \lim\_{n \rightarrow \infty}\binom{n}{k}(\frac{\lambda}{n})^k(1-\frac{\lambda}{n})^{n-k} \newline = \frac{\lambda ^k}{k!} e^{-\lambda}$$

$$\lambda \Longrightarrow \text{is just any given number}$$

### Poisson Random Variables

We've already learned that we can break many problems down into terms of $$n$$, $$x$$, and $$p$$ and use the following formula for binomial random variables:

$$p(x)=\binom{n}{x} \cdot p^x \cdot (1-p)^{n-x}$$

But what do we do when  cannot be calculated using that formula? Enter the *Poisson random variable*.&#x20;

### Poisson Experiment

A *Poisson experiment* is a statistical experiment that has the following properties:&#x20;

* The outcome of each trial is either *success* or *failure*.
* The average number of successes $$(\lambda)$$ that occurs in a specified region is known.
* The probability that a success will occur is proportional to the size of the region.
* The probability that a success will occur in an extremely small region is virtually zero.&#x20;

### [Poisson Distribution](https://en.wikipedia.org/wiki/Poisson_distribution)

A Poisson random variable is the number of successes that result from a Poisson experiment. The probability distribution of a Poisson random variable is called a Poisson distribution:

$$\huge P(k, \lambda) = \frac{\lambda^k e^{-\lambda}}{k!}$$

Here,

* $$e=2.71828$$
* $$\lambda$$ is the average number of successes that occur in a specified region.
* $$k$$ is the actual number of successes that occur in a specified region.
* $$P(k, \lambda)$$ is the Poisson probability, which is the probability of getting exactly $$k$$ successes when the average number of successes is $$\lambda$$.&#x20;

#### Example

Acme Realty company sells an average of $$2$$ homes per day. What is the probability that exactly $$3$$ homes will be sold tomorrow?&#x20;

Here, $$\lambda=2$$ and $$k=3$$, so $$P(k=3, \lambda =2)=\frac{\lambda^ke^{-\lambda}}{k!}=0.180$$&#x20;

#### Example

Suppose the average number of lions seen by tourists on a one-day safari is $$5$$. What is the probability that tourists will see fewer than  lions on the next one-day safari? \
$$P(k\leq3,\lambda=5)=\sum\_{r=0}^{3}\frac{\lambda^re^{-\lambda}}{r!}=0.2650$$

#### Special Case

Consider some Poisson random variable, $$X$$. Let $$E\[X]$$ be the expectation of $$X$$. Find the value of $$E\[X^2]$$.&#x20;

Let $$Var(X)$$ be the variance of $$X$$. Recall that if a random variable has a Poisson distribution, then:&#x20;

* $$E\[X] = \lambda$$
* $$Var(X) = \lambda$$&#x20;

Now, we'll use the following property of expectation and variance for any random variable, $$X$$:

$$Var(X)=E\[X^2]-(E\[X])^2 \Rightarrow E\[X^2] = Var(X) +(E\[X])^2$$

So, for any random variable $$X$$ having a Poisson distribution, the above result can be rewritten as:

$$\Rightarrow E\[X^2]=\lambda + \lambda^2$$

### Problem 1

A random variable, $$X$$, follows Poisson distribution with mean of $$2.5$$. Find the probability with which the random variable $$X$$ is equal to $$5$$.

```
def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n-1)

k = 5
l = 2.5
e = 2.71828

dist = factorial(k)
p = ((l**k)*(e**(l*-1)))/dist
print(round(p, 3))
```

### Problem 2

The manager of a industrial plant is planning to buy a machine of either type $$A$$ or type $$B$$. For each day’s operation:

* The number of repairs, $$X$$, that machine $$A$$ needs is a Poisson random variable with mean $$0.88$$. The daily cost of operating $$A$$ is $$C\_A = 160 + 40X^2$$.
* The number of repairs, $$Y$$, that machine $$B$$ needs is a Poisson random variable with mean $$1.55$$. The daily cost of operating $$B$$ is $$C\_B=128+40Y^2$$.

Assume that the repairs take a negligible amount of time and the machines are maintained nightly to ensure that they operate like new at the start of each day. Find and print the expected daily cost for each machine.

```
X = 0.88
Y = 1.55

print(round((160 + (40*(X + X**2))), 3))  # => 226.176
print(round((128 + (40*(Y + Y**2))), 3))  # => 286.1
```
