finding Expected Value for a system with N events all having exponential distribution

We have a system in which events happen one after each other. The time interval between each two events shown by random variable $t_i$. So, the time interval between the first and the second events is shown by $t_1$, the time interval between the second and the third events is shown by $t_2$, and so on.
We suppose the system keeps working as long as the time interval between each two successive events is smaller than $\tau$. In other words, the system stops as soon as the time interval between two successive events is larger than $\tau$.

Assuming the time interval between $n-1^{th}$ and $n^{th}$ is larger than $\tau$, we can show all time intervals between events as follows:

$t_1,t_2,t_3,\dots t_n$

all $t_i,\ 1\le i \le n$, have i.d.d exponential distribution with expected value $\frac{1}{\lambda}$. So:

($E[t_1]=E[t_2]=\dots\ E[t_n]=\frac{1}{\lambda}$).

Assuming PDF for $t=\sum_{i=1}^{n-1}t_i + t_n$ indicated by $f(t|n)$,
We can define PDF $f(t)$ for the interval time between start and end of the system over $t=\sum_{i=1}^{n-1}t_i + t_n$ as follows:

$f(t)=\sum_{n=1}^{\infty}f(t|n)P(n)$

in which $P(n) = (1-e^{-\lambda \tau})^{n-1}e^{-\lambda \tau}$

Now, Wee need to calculate the Expected value for $t$. How?

Afterwards, I need to consider a different story. We have the same system in which events happen one after each other. The time interval between each two events shown by random variable $t_i$.we can show all time intervals between events as follows:

$t_1,t_2,t_3,\dots t_n$

all $t_i,\ 1\le i \le n$, have i.d.d exponential distribution with expected value $\frac{1}{\lambda}$. So:

($E[t_1]=E[t_2]=\dots\ E[t_n]=\frac{1}{\lambda}$).

The system HOWEVER keeps running as long as the time interval between the $i-1^{th}$ event and $i+1^{th}$ event is less than $\tau$. In other words, the system keeps running as long as $t_1+t_2 < \tau, t_2+t_3 < \tau, t_3+t_4 < \tau$ and so on. The system stops as soon as $t_{n-1}+t_n > \tau$.

Now, how can I find the Expected Value for $t=\sum_{i=1}^{n-2}t_i + t_{n-1} + t_n$ conditional on $n$.

Solutions Collecting From Web of "finding Expected Value for a system with N events all having exponential distribution"

For the first example, all you need to do is to work out the truncated exponential distribution.

$$ \begin{align}
&~ E\left[\sum_{i=1}^n T_i~\middle|~
\bigcap_{i=1}^{n-1}\{T_i \leq \tau\} \cap \{T_n > \tau\}\right] \\
=&~ \sum_{i=1}^n E\left[T_i~\middle|~
\bigcap_{i=1}^{n-1}\{T_i \leq \tau\} \cap \{T_n > \tau\}\right] \\
=&~ \sum_{i=1}^{n-1} E\left[T_i \mid T_i \leq \tau \right] + E[T_n \mid T_n > \tau]\\
\end{align}$$

Here is the nice part of exponential distribution: Consider the conditional CDF of $T_n \mid T_n > \tau$, for $t > \tau$:
$$ \Pr\{T_n \leq t \mid T_n > \tau\}
= \frac {\Pr\{T_n \leq t, T_n > \tau\}} {\Pr\{T_n > \tau\}} = \frac {e^{-\lambda\tau}-e^{-\lambda t}} {e^{-\lambda\tau}} = 1 – e^{-\lambda(t – \tau)}$$

which shows that $T_n \mid T_n > \tau$ has the same distribution as $T_n + \tau$ (the shifted exponential), and this is the memoryless property.

Next you may use a similar trick to workout the conditional CDF of $T_1 \mid T_1 \leq \tau$, and obtain the expectation. Or you may consider this:

$$ \begin{align}
&& E[T_1] &= E[T_1 \mid T_1 \leq \tau]\Pr\{T_1 \leq \tau\}
+ E[T_1 \mid T_1 > \tau]\Pr\{T_1 > \tau\} \\
&\Rightarrow & \frac {1} {\lambda} &= E[T_1 \mid T_1 \leq \tau] (1 – e^{-\lambda \tau}) + \left(\frac {1} {\lambda} + \tau\right)e^{-\lambda \tau} \\
&\Rightarrow & E[T_1 \mid T_1 \leq \tau] &=
\frac {1} {\lambda} – \frac {\tau e^{-\lambda\tau}} {1 – e^{-\lambda\tau}}
\end{align}$$

So the above expectation becomes
$$ (n – 1)\left(\frac {1} {\lambda} – \frac {\tau e^{-\lambda\tau}} {1 – e^{-\lambda\tau}}\right) + \frac {1} {\lambda} + \tau = \frac {n} {\lambda}
– \frac {(n-1)\tau e^{-\lambda\tau}} {1 – e^{-\lambda\tau}} + \tau$$

We can employ the similar strategy for the second part:
$$ \begin{align}
&~ E\left[\sum_{i=1}^n T_i~\middle|~
\bigcap_{i=1}^{n-2}\{T_i + T_{i+1} \leq \tau\} \cap
\{T_{n-1} + T_n > \tau\}\right] \\
=&~ \sum_{i=1}^n E\left[T_i~\middle|~
\bigcap_{i=1}^{n-2}\{T_i + T_{i+1} \leq \tau\} \cap
\{T_{n-1} + T_n > \tau\}\right] \\
=&~ E\left[T_1 \mid T_1 + T_2 \leq \tau \right]
+ \sum_{i=2}^{n-2} E\left[T_i \mid T_{i-1} + T_i \leq \tau, T_i + T_{i+1} \leq \tau \right] \\
&~ + E[T_{n-1} \mid T_{n-2} + T_{n-1} < \tau, T_{n-1} + T_n > \tau]
+ E[T_n \mid T_{n-1} + T_n > \tau]\\
\end{align}$$

So we compute the conditional CDFs one by one: First for $T_1 \mid T_1 + T_2 \leq \tau $, and $0 < t < \tau$,
$$ \Pr\{T_1 \leq t \mid T_1 + T_2 \leq \tau\}
= \frac {\Pr\{T_1 \leq t, T_1 + T_2 \leq \tau\}} {\Pr\{T_1 + T_2 \leq \tau\}} $$
The numerator is given by
$$ \begin{align}
\int_0^t \Pr\{T_2 \leq \tau – u\} \lambda e^{-\lambda u}du
&= \int_0^t (1 – e^{-\lambda(\tau – u)}) \lambda e^{-\lambda u}du \\
&= 1 – e^{-\lambda t} – \int_0^t \lambda e^{-\lambda\tau}du \\
&= 1 – e^{-\lambda t} – \lambda t e^{-\lambda\tau}
\end{align}$$
The denominator is similar, we just replace the upper integral limit $t$ by $\tau$, and obtain $1 – e^{-\lambda\tau} – \lambda \tau e^{-\lambda\tau}$ (or directly look up the CDF of Erlang). So the resulting CDF is
$$ \frac {1 – e^{-\lambda t} – \lambda t e^{-\lambda\tau}}
{1 – e^{-\lambda\tau} – \lambda \tau e^{-\lambda\tau}}, 0 < t < \tau$$

and thus the expected value is
$$ \begin{align}
&~ \int_0^{\tau} 1 – \frac {1 – e^{-\lambda t} – \lambda t e^{-\lambda\tau}}
{1 – e^{-\lambda\tau} – \lambda \tau e^{-\lambda\tau}} dt \\
=&~ \frac {1} {1 – e^{-\lambda\tau} – \lambda \tau e^{-\lambda\tau}}
\int_0^{\tau} e^{-\lambda t} + \lambda t e^{-\lambda\tau} – e^{-\lambda\tau} – \lambda \tau e^{-\lambda\tau} dt \\
=&~ \frac {1} {1 – e^{-\lambda\tau} – \lambda \tau e^{-\lambda\tau}}
\left( 1 – \frac {1} {\lambda} e^{-\lambda \tau}
+ \frac {\lambda} {2} \tau^2 e^{-\lambda\tau}
– \tau e^{-\lambda\tau}
– \lambda \tau^2 e^{-\lambda\tau} \right) \\
=&~ \frac {1} {1 – e^{-\lambda\tau} – \lambda \tau e^{-\lambda\tau}}
\left( 1 – \frac {1} {\lambda} e^{-\lambda \tau}
– \frac {\lambda} {2} \tau^2 e^{-\lambda\tau}
– \tau e^{-\lambda\tau} \right)
\end{align}$$
So it looks tedious but manageable. The remaining terms are left to you as you have got all the tools to work them out from this example.