## Minimum of a set of Exponentially Distributed Random Variables

Let $\{X_i\}$ be a set of exponentially distributed random variables. Let $y=min\{X_i\}$ be the minimum value of that set. 

The cumulative distribution function that $y$ should be smaller or equal all of $\{X_i\}$ is given by:

\begin{equation}
p(y\leq\{X_i\}) = \prod_i p(X_i \geq y) = \lambda^n \exp-n\lambda y
\end{equation}

The cumulative probability depends on the probability that $y$ assumes a *specific* value: 

\begin{equation}
p(y\leq\{X_i\}) = \int_0^\infty p(y)
\end{equation}

So that $p(y)$ can be found by taking the derivative:

\begin{equation}
p(y) = n\lambda^n\exp-n\lambda y
\end{equation}



```python
import numpy as np
import matplotlib.pyplot as plt

scale = 1
n = 5
samples = 5000

X = np.random.exponential(scale=scale,size=[n,samples])
minX = np.min(X,axis=0)

def pdf_x(x):
    return (1/scale)*np.exp(-x/scale)

def pdf_min(y):
    return n*(1/scale)**n * np.exp(-n*y/scale)
```


```python
x = np.linspace(0,10,1000)

plt.figure(figsize=(12,8))

_ = plt.hist(X.flatten(),bins = x,density=True)
_ = plt.hist(minX,bins = x,density=True)

plt.plot(x,pdf_x(x),linewidth=4)
plt.plot(x,pdf_min(x),linewidth=4)
```

## Maximum of a set of Exponentially Distributed Random Variables

Similarly,

\begin{equation}
p(y\geq\{X_i\}) = \prod_i p(Y>X_i = (1-\lambda\exp-\lambda y)^n
\end{equation}

Implying:

\begin{equation}
p(y) = n\lambda(1-\exp-\lambda y)^{n-1} \exp-\lambda y
\end{equation}


```python
import numpy as np
import matplotlib.pyplot as plt

scale = 1
n = 5
samples = 5000

X = np.random.exponential(scale=scale,size=[n,samples])
maxX = np.max(X,axis=0)

def pdf_x(x):
    return (1/scale)*np.exp(-x/scale)

def pdf_max(y):
    return n * (1/scale) * (1-np.exp(-y/scale))**(n-1) * np.exp(-y/scale)
```


```python
x = np.linspace(0,10,1000)

plt.figure(figsize=(12,8))

_ = plt.hist(X.flatten(),bins = x,density=True)
_ = plt.hist(maxX,bins = x,density=True)

plt.plot(x,pdf_x(x),linewidth=4)
plt.plot(x,pdf_max(x),linewidth=4)
```

47d23bcd45862615507a2b0ecd01f22430fb0aa3
ipynb
Jupyter Notebook
Probability - Minimum and Maximum of Exponentially Distributed Random Variables.ipynb
jpbm/probabilism
a2f5c1595aed616236b2b889195604f365175899
MIT
Probability - Minimum and Maximum of Exponentially Distributed Random Variables.ipynb
jpbm/probabilism
a2f5c1595aed616236b2b889195604f365175899
MIT
Probability - Minimum and Maximum of Exponentially Distributed Random Variables.ipynb
jpbm/probabilism
a2f5c1595aed616236b2b889195604f365175899
MIT
Qwen/Qwen-72B
1. YES
2. YES