Tuesday, November 1, 2022

Minimum of an Exponential random variable - First arrival times

Let $T$ be an exponential random variable with parameter $\lambda$. In this post, we are going to find the expected value of $\text{min}(T,1)$ with four different method each of which is beautiful in its own way.

Direct integration
We know that the density function of $T$ is $\lambda e^{-\lambda t}$. Therefore,

$\begin{align}\displaystyle\mathbb{E}(\text{min}(T,1)) &= \int_0^\infty \text{min}(t,1)\lambda e^{-\lambda t}\,dt \\ &= \int_0^1 t\cdot\lambda e^{-\lambda t}\,dt+\int_1^\infty 1\cdot\lambda e^{-\lambda t}\,dt \\ &= \frac{1-(1+\lambda)e^{-\lambda}}{\lambda}+e^{-\lambda}\\ &= \frac{1-e^{-\lambda}}{\lambda}\end{align}$

Conditional expectation
Here we condition based on the value of the random variable and use the fact that $\mathbb{P}(T>t)=e^{-\lambda t}$ and $\mathbb{E}(T)=1/\lambda$. By the law of total expectation,

$\begin{align}\displaystyle\mathbb{E}(\text{min}(T,1))&=\mathbb{P}(T<1)\mathbb{E}(\text{min}(T,1)|T<1)+\mathbb{P}(T>1)\mathbb{E}(\text{min}(T,1)|T>1) \\ &=\mathbb{P}(T<1)\mathbb{E}(T|T<1)+\mathbb{P}(T>1) \end{align}$

But we can get the first term by conditioning on $T$. We know that

$\displaystyle \mathbb{E}(T)=\mathbb{P}(T<1)\mathbb{E}(T|T<1)+\mathbb{P}(T>1)\mathbb{E}(T|T>1)$

Using the memoryless property, we know that $\mathbb{E}(T|T>1)=1+\mathbb{E}(T)$. Therefore,

$\begin{align}\mathbb{P}(T<1)\mathbb{E}(T|T<1)&=\mathbb{E}(T)-\mathbb{P}(T>1)\mathbb{E}(T|T>1)\\&=\mathbb{E}(T)-\mathbb{P}(T>1)(1+\mathbb{E}(T))\\&=\mathbb{P}(T<1)\mathbb{E}(T)-\mathbb{P}(T>1)\\ \end{align}$

Using this, we get,

$\mathbb{E}(\text{min}(T,1))=\mathbb{P}(T<1)\mathbb{E}(T)=\displaystyle\frac{1-e^{-\lambda}}{\lambda}$

Story proof
Let's say the arrival rate of customers to a store follows a Poisson process with parameter $\lambda$. On a given day, the store owners decides to wait the next customer for maximum one hour and shut shop thereafter.

Using this story, we can see that the waiting time of the store owner is $\text{min}(T,1)$ where $T\sim \text{Exp}(\lambda)$.

If the store owner does not have a time limit of one hour, then he would wait for $\mathbb{E}(T)=1/\lambda$ hours for the first customer.

However, if no customer arrive during the first hour, which happens with probability $e^{-\lambda}$, then he would have to wait, on average, for another $1/\lambda$ units time for the first customer by the memoryless property. Therefore, because of his time limit, he saves, on average, $e^{-\lambda}/\lambda$ units of time.

This shows the average waiting time is $1/\lambda-e^{-\lambda}/\lambda$

Using the Poisson distribution
The approaches so far have used the memoryless property one way or the other. Here we do away without that.

Using the story above, let $X$ denote the number of customers that arrive during the first hour. It should be intuitively obvious that the average time of first arrival is $1/(X+1)$. For example, if three customers arrive, we would expect their arrival times, on average, to be the 15th, 30th and the 45th minute mark.

Obviously $X\sim\text{Poisson}(\lambda)$. Therefore,

$\displaystyle\mathbb{E}\left(\frac{1}{X+1}\right)=\sum_{k=0}^\infty \frac{1}{k+1}\cdot\frac{e^{-\lambda}\lambda^k}{k!}=\frac{1}{\lambda}\sum_{k=1}^\infty \frac{e^{-\lambda}\lambda^k}{k!}=\frac{1-e^{-\lambda}}{\lambda}$

There we have it! Four different proofs for this expectation. I'll detail why this expectation is kinda important in a later post.

Before I forget, please allow me to credit reddit users lukewarmtoasteroven and blungbat for the second and third proofs respectively in my reddit question on the same topic.

Until then
Yours Aye
Me