<p align="justify">
The <b>probability distribution</b> for a random variable describes how the probabilities are distributed over the values of the random variable.<br>

For a <i><b>discrete random variable</b></i>, <b>x</b>, the probability distribution is defined by a probability mass function, denoted by <b>f(x)</b>. This function provides the probability for each value of the random variable.<br>
For a <i><b>continuous random variable </b></i>, since there is an infinite number of values in any interval, the probability that a continuous random variable will lie within a given interval is considered. So here, the probability distribution is defined by probability density function, also denoted by <b>f(x)</b>.

The output of a probability mass function is a probability whereas the area under the curve produced by a probability density function represents a probability.

Both probability functions must satisfy two requirements:: 
<ol>
    <li>f(x) must be non-negative for each value of the random variable, and </li>
<li>The sum of the probabilities for each value (or integral over all values) of the random variable must equal one.</li>
</ol>
</p>

<p align="justify">
<b>Common Data Types</b>
Before we jump on to the explanation of distributions, let’s see what kind of data can we encounter. The data can be discrete or continuous.

<b>Discrete Data</b>, as the name suggests, can take only specified values. For example, when you roll a die, the possible outcomes are 1, 2, 3, 4, 5 or 6 and not 1.5 or 2.45.

<b>Continuous Data</b> can take any value within a given range. The range may be finite or infinite. For example, A girl’s weight or height, the length of the road. The weight of a girl can be any value from 54 kgs, or 54.5 kgs, or 54.5436kgs.
</p>

<b>Types of Distributions</b>

<b>1. Bernoulli Distribution</b><br>
All you cricket junkies out there! At the beginning of any cricket match, how do you decide who is going to bat or ball? A toss! It all depends on whether you win or lose the toss, right? Let’s say if the toss results in a head, you win. Else, you lose. There’s no midway.

A Bernoulli distribution has only two possible outcomes, namely 1 (success) and 0 (failure), and a single trial. So the random variable X which has a Bernoulli distribution can take value 1 with the probability of success, say p, and the value 0 with the probability of failure, say q or 1-p.

Here, the occurrence of a head denotes success, and the occurrence of a tail denotes failure.
Probability of getting a head = 0.5 = Probability of getting a tail since there are only two possible outcomes.

The probability mass function is given by:<br> 
\begin{equation}
p^{x}(1-p)^{1-x} \quad where\;x\in (0, 1)
\end{equation}
<br>
The probabilities of success and failure need not be equally likely, like the result of a fight between me and Undertaker. He is pretty much certain to win. So in this case probability of my success is 0.15 while my failure is 0.85

Here, the probability of success(p) is not same as the probability of failure. <br>
Here, the probability of success = 0.15 and probability of failure = 0.85. The expected value is exactly what it sounds. If I punch you, I may expect you to punch me back. Basically expected value of any distribution is the mean of the distribution. The expected value of a random variable X from a Bernoulli distribution is found as follows:<br>

\[E(X) = 1*p + 0*(1-p) = p\]
<br>
The variance of a random variable from a bernoulli distribution is:<br>

\[V(X) = E(X²) – [E(X)]² = p – p² = p(1-p)\]<br>

There are many examples of Bernoulli distribution such as whether it’s going to rain tomorrow or not where rain denotes success and no rain denotes failure and Winning (success) or losing (failure) the game.<br><br>
<b>2. Uniform Distribution</b><br>
When you roll a fair die, the outcomes are 1 to 6. The probabilities of getting these outcomes are equally likely and that is the basis of a uniform distribution. Unlike Bernoulli Distribution, all the n number of possible outcomes of a uniform distribution are equally likely.

A variable X is said to be uniformly distributed if the density function is:<br>
\begin {equation}
f(x) = \frac{1}{b-a} \quad for -\infty<a\leq x\leq b<\infty
\end {equation}

You can see that the shape of the Uniform distribution curve is rectangular, the reason why Uniform distribution is called rectangular distribution.

For a Uniform Distribution, a and b are the parameters. 

The number of bouquets sold daily at a flower shop is uniformly distributed with a maximum of 40 and a minimum of 10.

Let’s try calculating the probability that the daily sales will fall between 15 and 30.

The probability that daily sales will fall between 15 and 30 is (30-15)*(1/(40-10)) = 0.5

Similarly, the probability that daily sales are greater than 20 is  = 0.667

The mean and variance of X following a uniform distribution is:<br>
Mean $E(X) = \frac{a+b}{2}$
<br>
Variance $V(X) = \frac {(b-a)^2}{12}$
<br>
The standard uniform density has parameters a = 0 and b = 1.<br>

<b>3. Binomial Distribution</b>
Suppose that you won the toss today and this indicates a successful event. You toss again but you lost this time. If you win a toss today, this does not necessitate that you will win the toss tomorrow. Let’s assign a random variable, say X, to the number of times you won the toss. What can be the possible value of X? It can be any number depending on the number of times you tossed a coin.

There are only two possible outcomes. Head denoting success and tail denoting failure. Therefore, probability of getting a head = 0.5 and the probability of failure can be easily computed as: q = 1- p = 0.5.

A distribution where only two outcomes are possible, such as success or failure, gain or loss, win or lose and where the probability of success and failure is same for all the trials is called a Binomial Distribution.

The outcomes need not be equally likely. Remember the example of a fight between me and Undertaker? So, if the probability of success in an experiment is 0.2 then the probability of failure can be easily computed as q = 1 – 0.2 = 0.8.

Each trial is independent since the outcome of the previous toss doesn’t determine or affect the outcome of the current toss. An experiment with only two possible outcomes repeated n number of times is called binomial. The parameters of a binomial distribution are n and p where n is the total number of trials and p is the probability of success in each trial.

On the basis of the above explanation, the properties of a Binomial Distribution are
<ol>
<li>Each trial is independent.</li>
<li>There are only two possible outcomes in a trial- either a success or a failure.</li>
<li>A total number of n identical trials are conducted.</li>
<li>The probability of success and failure is same for all trials. (Trials are identical.)</li>
</ol> 
The mathematical representation of binomial distribution is given by:
\[P(x) = \frac {n!}{(n-x)! x!} p^x q^(n-x) \]

A binomial distribution graph where the probability of success does not equal the probability of failure looks like

Now, when probability of success = probability of failure, in such a situation the graph of binomial distribution looks like

The mean and variance of a binomial distribution are given by:

Mean $ µ = n*p$

Variance $Var (X) = n*p*q$
<br>
<b>4.Normal Distribution</b><br>
Normal distribution represents the behavior of most of the situations in the universe. The large sum of (small) random variables often turns out to be normally distributed, contributing to its widespread application. Any distribution is known as Normal distribution if it has the following characteristics:
<ol>
    <li>The mean, median and mode of the distribution coincide.</li>
    <li>The curve of the distribution is bell-shaped and symmetrical about the line x=μ.</li>
    <li>The total area under the curve is 1.</li>
    <li>Exactly half of the values are to the left of the center and the other half to the right.</li>
</ol>
A normal distribution is highly different from Binomial Distribution. However, if the number of trials approaches infinity then the shapes will be quite similar.

The PDF of a random variable X following a normal distribution is given by:
\[ f(x)=\frac {1}{\sqrt{(2\pi)}\sigma}e^{-\frac {(x-\mu)^2}{2\sigma}}\]

The mean and variance of a random variable X which is said to be normally distributed is given by:

Mean $ E(X) = \mu$

Variance $ Var(X) = (\sigma)^2$

Here, µ (mean) and σ (standard deviation) are the parameters.

A standard normal distribution is defined as the distribution with mean 0 and standard deviation. For such a case, the PDF becomes: 
\[ f(x) = \frac {1}{\sqrt{2\pi}} e^{-\frac{x^2}{2}} \]

<b>5. Poisson Distribution</b><br>
Suppose you work at a call center, approximately how many calls do you get in a day? It can be any number. Now, the entire number of calls at a call center in a day is modeled by Poisson distribution. Some more examples are

The number of emergency calls recorded at a hospital in a day.
The number of thefts reported in an area on a day.
The number of customers arriving at a salon in an hour.
The number of suicides reported in a particular city.
The number of printing errors at each page of the book.
You can now think of many examples following the same course. Poisson Distribution is applicable in situations where events occur at random points of time and space wherein our interest lies only in the number of occurrences of the event.

A distribution is called Poisson distribution when the following assumptions are valid:
<ol>
    <li>Any successful event should not influence the outcome of another successful event.</li>
    <li>The probability of success over a short interval must equal the probability of success over a longer interval.</li>
    <li>The probability of success in an interval approaches zero as the interval becomes smaller.</li>
</ol><br>
Now, if any distribution validates the above assumptions then it is a Poisson distribution. Some notations used in Poisson distribution are:

$\lambda$ is the rate at which an event occurs,
t is the length of a time interval,
And X is the number of events in that time interval.
Here, X is called a Poisson Random Variable and the probability distribution of X is called Poisson distribution.

Let $\mu$ denote the mean number of events in an interval of length t. Then, µ = λ*t.

The PMF of X following a Poisson distribution is given by:
\begin{equation} 
P(X=x)= e^{-\mu{\frac{\mu^x}{x!}}}
\end{equation}

The mean µ is the parameter of this distribution. µ is also defined as the λ times length of that interval. 
The mean and variance of X following a Poisson distribution:

Mean $E(X) = \mu$<br>
Variance $Var(X) = \mu$

<b>6. Exponential Distribution</b><br>
Let’s consider the call center example one more time. What about the interval of time between the calls ? Here, exponential distribution comes to our rescue. Exponential distribution models the interval of time between the calls.

Other examples are:
<ol>
    <li>Length of time beteeen metro arrivals.</li>
    <li>Length of time between arrivals at a gas station.</li>
    <li>The life of an Air Conditioner.</li>
</ol>
Exponential distribution is widely used for survival analysis. From the expected life of a machine to the expected life of a human, exponential distribution successfully delivers the result.

A random variable X is said to have an exponential distribution with PDF:
\begin{equation} 
f(x) =  \lambda e - \lambda x,  x \geq 0
\end{equation}


and parameter λ>0 which is also called the rate.

For survival analysis, λ is called the failure rate of a device at any time t, given that it has survived up to t.

Mean and Variance of a random variable X following an exponential distribution:

Mean $E(X) = \frac {1}{\lambda}$

Variance $Var(X) = \frac {1}{\lambda^2}$

Also, the greater the rate, the faster the curve drops and the lower the rate, flatter the curve. 
To ease the computation, there are some formulas given below.
$P(X\leq x) = 1 – e-\lambda x$, corresponds to the area under the density curve to the left of x.

$ P(X>x) = e^-\lambda x$, corresponds to the area under the density curve to the right of x.

$ P(x1<X\leq x2) = e^{-\lambda x1} – e^{-\lambda x2}$, corresponds to the area under the density curve between x1 and x2.
<br><br>
<b>Relations between the Distributions. </b>
<b>Relation between Bernoulli and Binomial Distribution.</b><br>
<ol>
    <li>Bernoulli Distribution is a special case of Binomial Distribution with a single trial.</li>
    <li>There are only two possible outcomes of a Bernoulli and Binomial distribution, namely success and failure.</li>
    <li>Both Bernoulli and Binomial Distributions have independent trails.</li>
</ol>
<br>
<br>
<b>Relation between Poisson and Binomial Distribution</b><br>
Poisson Distribution is a limiting case of binomial distribution under the following conditions:
<ol>
    <li>The number of trials is indefinitely large or n → ∞.</li>
    <li>The probability of success for each trial is same and indefinitely small or p →0.</li>
    <li>np = λ, is finite.</li>
</ol> 
<br>
<b>Relation between Normal and Binomial Distribution & Normal and Poisson Distribution:</b><br>
Normal distribution is another limiting form of binomial distribution under the following conditions:<br>
<ol>
    <li>The number of trials is indefinitely large, n → ∞.</li>
    <li>Both p and q are not indefinitely small.</li>
    <li>The normal distribution is also a limiting case of Poisson distribution with the parameter λ →∞.</li>
</ol>
<br>
<b>Relation between Exponential and Poisson Distribution:</b><br>
If the times between random events follow exponential distribution with rate λ, then the total number of events in a time period of length t follows the Poisson distribution with parameter λt.


```python

```

2566eba75994ffade277fedc8b841519e12af06b
ipynb
Jupyter Notebook
2. Probability Distributions.ipynb
rarpit1994/Probability-and-Statistics
1ae8b7428ec9a3072fce3089d7951b9f7bd06c26
Apache-2.0
2019-03-24T10:29:56.000Z
2019-03-24T10:29:56.000Z
2. Probability Distributions.ipynb
rarpit1994/Probability-and-Statistics
1ae8b7428ec9a3072fce3089d7951b9f7bd06c26
Apache-2.0
2. Probability Distributions.ipynb
rarpit1994/Probability-and-Statistics
1ae8b7428ec9a3072fce3089d7951b9f7bd06c26
Apache-2.0
Qwen/Qwen-72B
1. YES
2. YES