# 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$.

• When you say "shown by $f(t\mid n)$", do you mean "expressed in terms of $f(t\mid n)$", as you did in the first case, $f(t)=\sum_{n=1}^\infty f(t\mid n)P(n)$? (By the way, note that the spacing came out right because I used \mid instead of |.) – joriki Jun 7 '16 at 17:15
• Your expression for $f(t\mid n)$ is wrong. What you wrote is $f(t)$ if you add $n$ independent exponential random variables. But $f(t\mid n)$ is something quite different from that; it contains the condition that $n-1$ of the variables are less than $\tau$ and one is greater, and you didn't take that into account. – joriki Jun 7 '16 at 17:18
• As you stated, the sum of i.i.d. exponential random variables has a gamma (Erlang) distribution, and this is well known. The question is, are $t_i$ unconditionally i.i.d. exponential? And in the sum, are you conditional on the event that $t_i < \tau, i = 1, 2, \ldots, n-1$ and $t_n > \tau$? If yes then you do not have such a nice result. Or you need to clarify, anyway. – BGM Jun 7 '16 at 17:24
• Rule #1 in probability: Never try to find the probability distribution if you only need the expected value. In most cases, the expected value is far easier to compute without taking the detour through the distribution. – joriki Jun 7 '16 at 17:45
• @AlirezaMontazeriGh: And you want the unconditional expected value of the sum of the steps up to and including $t_n$? – joriki Aug 10 '16 at 18:11

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.

• @AlirezaMontazeriGh: Why $\infty$? The factor $(1-\mathrm e^{-\lambda\tau})^{n-1}$ provides exponential decay, so the series converges (as it must). If you're interested in the unconditional expected value of $E[t]$, it can be calculated much more directly by one-step analysis: $$E[t]=\frac1\lambda+\left(1-\mathrm e^{-\lambda\tau}\right)E[t]\;,$$ and thus $$E[t]=\frac{\mathrm e^{\lambda\tau}}\lambda\;.$$ – joriki Jun 13 '16 at 20:00
• @AlirezaMontazeriGh: Looks good (except the $q$ in the denominator in the first sum should be a $\lambda$). – joriki Jun 13 '16 at 21:17
• @AlirezaMontazeriGh: I'm not sure what you mean by "my solution in the page". I applied one-step analysis, as in my first comment above, but more involved because it needs to be conditionalised on the previous interval. I didn't condition on $n$, as you requested and as BGM did in this post. To get $E[t]$ from $E[t|n]$, you'd need $P(n)$, which seems about as hard to determine as $E[t]$ itself. – joriki Jun 13 '16 at 22:01
• @AlirezaMontazeriGh: Yes. This shows why you should always provide the context of your original problem, rather than just the approach that you're currently using to approach it. Your question was phrased to ask for the expectation conditional on $n$, and now it seems to turn out that you were interested in the unconditional expectation after all and were merely taking the approach of obtaining it through the conditional expectation because you thought that this would be the easiest way to obtain it. That wasn't apparent from the question. – joriki Jun 14 '16 at 5:59
• @AlirezaMontazeriGh: And the same had already happened previously when you wrote that you were looking for the entire distribution, and it turned out that in fact you weren't and this was just your current approach in trying to obtain the expected value. – joriki Jun 14 '16 at 6:01