# Calculating Density Function and Conditional Expectation of Independent Exponential Random Variables

I am currently studying probability and statistics and I came across a problem involving exponential random variables that I'm having trouble with. I have some understanding of exponential distributions and random variables, but this particular problem has left me stumped.

Here's the problem:

Let $$X$$ and $$Y$$ be independent exponential random variables with parameters $$\lambda_1$$ and $$\lambda_2$$ respectively, where $$0<\lambda_1<\lambda_2$$.

(i) Calculate the density function of $$X+Y$$ (ii) Calculate the conditional expectation of $$X$$ given that $$X+Y=a$$, where $$a>0$$

My Attempt:

For the first part, I know that the sum of two independent exponential random variables follows a gamma distribution. However, I'm unsure how to apply this knowledge to find the density function of $$X+Y$$.

For the second part, I understand that the conditional expectation $$E[X|X+Y=a]$$ is the expected value of $$X$$ given that the sum of $$X$$ and $$Y$$ is $$a$$. But I'm not sure how to proceed with the calculation.

Background:

I am familiar with the basics of probability, statistics, and exponential distributions. I have previously worked with problems involving exponential random variables, but this is the first time I've encountered a problem that involves the sum of two such variables and conditional expectation.

Any help or guidance would be greatly appreciated. Thank you in advance!

A note on how to "derive" the convolution formula (it is not the most general version). Let $$X,Y$$ be independent random variables with continuous densities $$f_X, f_Y$$. Using conditional expectation, we get $$\mathbb P(X+Y\leq t) =\int_{\mathbb R}\mathbb P(X\leq t-y)f_Y(y)\,dy =\int_{\mathbb R}F_X(t-y)f_Y(y)\,dy.$$ One can then use Leibniz's formula for derivation of integrals and we get $$f_{X+Y}(t) =\frac{d}{dt}\mathbb P(X+Y\leq t) =\frac{d}{dt}\int_{\mathbb R}F_X(t-y)f_Y(y)\,dy\\ =\int_{\mathbb R}\Big(\frac{\partial}{\partial t}F_X(t-y)\Big)f_Y(y)\,dy =\int_{\mathbb R}f_X(t-y)f_Y(y)\,dy.$$

Now, since for exponential distribution, the density is $$f(t)=\lambda \exp(-\lambda t)\mathbb 1_{t\geq0}$$, we have for $$t\in\mathbb R^+$$ \begin{align*} f_{X+Y}(t) &=\int_{\mathbb R}f_X(t-y)f_Y(y)\,dy =\lambda_1\lambda_2\int_{\mathbb R}e^{-\lambda_1(t-y)}e^{-\lambda_2y}\mathbb 1_{0\leq y\leq t}\,dy\\ &=\lambda_1\lambda_2e^{-\lambda_1 t}\int_{0}^te^{-(\lambda_2-\lambda_1)y}\,dy =\frac{\lambda_1\lambda_2}{\lambda_2-\lambda_1}\Big(e^{-\lambda_1t}-e^{-\lambda_2t}\Big)\\ &\xrightarrow{\lambda_1\rightarrow\lambda_2}\lambda^2 t\exp(-\lambda t). \end{align*}

Remember: The sum of two independent exponential random variables with the same parameter is Gamma-distributed. This is not the case here.

For the second exercise: You need an expression for $$f_{X|X+Y=a}(x)$$. But \begin{align*} f_{X|X+Y}(x|a) &=\frac{f_{X,X+Y}(x,a)}{f_{X+Y}(a)} =\frac{f_{X+Y,X}(a,x)}{f_X(x)}\frac{f_X(x)}{f_{X+Y}(a)}\\ &=f_{X+Y|X}(a|x)\frac{f_X(x)}{f_{X+Y}(a)} =f_{Y}(a-x)\frac{f_X(x)}{f_{X+Y}(a)}\\ &=\lambda_1\lambda_2\,\frac{e^{-\lambda_2(a-x)}\,e^{-\lambda_1 x}}{\frac{\lambda_1\lambda_2}{\lambda_2-\lambda_1}\Big(e^{-\lambda_1 a}-e^{-\lambda_2 a}\Big)}\\ &=(\lambda_2-\lambda_1)\frac{e^{-\lambda_2 a}}{e^{-\lambda_1 a}-e^{-\lambda_2 a}}e^{(\lambda_2-\lambda_1)x} \xrightarrow{\lambda_1\rightarrow\lambda_2}\frac{1}{a}. \end{align*} Taking the expected value is now easy (Note, that the conditional distribution is defined on the finite interval [0,a]). We thus get \begin{align*} \mathbb E(X\,|\,X+Y=a) &=\int_0^ax\,f_{X|X+Y}(x|a)\,dx\\ &=\frac{a\,e^{a\lambda_2}}{e^{a\lambda_2}-e^{a\lambda_1}}+\frac{1}{\lambda_1-\lambda_2} \xrightarrow{\lambda_1\rightarrow\lambda_2}\frac{a}{2} \end{align*}

Finally, the above is the general answer.

Sanity Check: For $$\lambda_1=\lambda_2$$, the sum is Erlang distributed, the conditional distribution ist the uniform distribution on [0,a], and the expectation thus a/2.

NOTE: I let you struggle with all integrals and the check whether the densities are actually densities. I did use wolfram alpha for most of the integration and checkup. After all, this problem is a lot more involved than i remembered...

• Is it natural that the $\lambda_1$ and $\lambda_2$ are not symmetric in the joint pdf? Also, did you consider that $\lambda_2>\lambda_1$ in your derivation? May 15 at 11:35
• Ah my bad, it is symmetric May 15 at 11:40
• If $\lambda_1>\lambda_2$, the density is not integrable. May 15 at 11:43
• So the choice of $f_X(t-y)$ and $f_Y(y)$ is actually unique here? May 15 at 11:46
• No, whether $f_X(t-y)f_Y(y)$ or $f_X(x)f_Y(t-x)$ is not important. The convolution is a symmetric operator. (note that i edited my previous comment!) May 15 at 11:48

(i) The sum of two independent exponential random variables follows a gamma distribution. If $$X$$ and $$Y$$ are independent exponential random variables with parameters $$\lambda_1$$ and $$\lambda_2$$ respectively, then the density function of $$X+Y$$ is given by:

$$f_{X+Y}(t) = \int_{0}^{t} f_X(x) f_Y(t-x) dx$$

where $$f_X(x)$$ and $$f_Y(y)$$ are the density functions of $$X$$ and $$Y$$ respectively. Substituting the density functions of the exponential distributions, we get:

$$f_{X+Y}(t) = \int_{0}^{t} \lambda_1 e^{-\lambda_1 x} \lambda_2 e^{-\lambda_2 (t-x)} dx$$

This integral can be solved to obtain the density function of $$X+Y$$.

(ii) The conditional expectation $$E[X|X+Y=a]$$ can be calculated using the formula:

$$E[X|X+Y=a] = \int_{0}^{a} x f_{X|X+Y=a}(x) dx$$

where $$f_{X|X+Y=a}(x)$$ is the conditional density function of $$X$$ given $$X+Y=a$$. This can be derived from the joint density function of $$X$$ and $$Y$$.

• You wrote " $$f_{X+Y}(t) = \int_{0}^{t} f_X(x) f_Y(t-x) dx$$ where $f_X(x)$ and $f_Y(y)$ are the density functions of $X$ and $Y$ respectively." Why? Did you use some theorem here? Sorry I am not familiar with it. May 15 at 9:31
• I think there should be infinity in the density function integral upper boundary for the convolution runs all over the positive $\mathbb{R}$. May 15 at 9:38
• @Egor Larionov You mean the first formula? May 15 at 10:01
• The first two, yes. May 15 at 10:04

For (b), The conditional expectation of X given that X + Y = a can be calculated using the memoryless property of the exponential distribution. The memoryless property states that the remaining time until an event occurs does not depend on how much time has already passed.

Therefore, the conditional expectation E[X | X + Y = a] is given by:

$$E[X | X + Y = a] = \frac{\lambda_1}{\lambda_1 + \lambda_2} a$$

• Sorry I am not familiar with the term memoryless and don't quite follow, how you derive such property? May 15 at 11:47
• The shortest way i know is via Bayes theorem for densities. May 15 at 11:52
• @Peter Strouvelle Do you mind to explain it a little bit more? May 15 at 11:54
• @prob1yuma: I edited my above answer. It now includes the complete (brute force) solution. There are some gaps to fill that i did not make explicit. The above answer and derivation by PowerPoint Trenton is only valid for $\lambda_1=\lambda_2$. May 15 at 13:29
• @PowerPointTrenton: Your answer is unfortunately wrong. Only for equal parameter is the rv X|X+Y uniformly distributed over [0,X+Y]. May 15 at 13:45