Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Suppose we have $v$ and $u$, both are independent and exponentially distributed random variables with parameters $\mu$ and $\lambda$, respectively.

How can we calculate the pdf of $v-u$?

share|improve this question
    
You might rely on a standard procedure. –  Did Feb 29 '12 at 23:03
add comment

2 Answers

up vote 14 down vote accepted

I too prefer to call the random variables $X$ and $Y$. You can think of $X$ and $Y$ as waiting times for two independent things (say $A$ and $B$ respectively) to happen. Suppose we wait until the first of these happens. If it is $A$, then (by the lack-of-memory property of the exponential distribution) the further waiting time until $B$ happens still has the same exponential distribution as $Y$; if it is $B$, the further waiting time until $A$ happens still has the same exponential distribution as $X$. That says that the conditional distribution of $X-Y$ given $X > Y$ is the distribution of $X$, and the conditional distribution of $X-Y$ given $X < Y$ is the distribution of $-Y$. Since $P(X>Y) = \frac{\lambda}{\mu+\lambda}$, that says the PDF for $X-Y$ is $$ f(x) = \frac{\lambda \mu}{\lambda+\mu} \cases{e^{-\mu x} & if $x > 0$\cr e^{\lambda x} & if $x < 0$\cr}$$

share|improve this answer
    
+1: Nice, elegant argument. –  Mike Spivey Mar 1 '12 at 3:59
2  
why $P(X>Y)=\frac{\lambda}{\mu+\lambda}$? –  Coargu Aliquis Aug 14 '13 at 16:55
add comment

The right answer depends very much on what your mathematical background is. I will assume that you have seen some calculus of several variables, and not much beyond that. Instead of using your $u$ and $v$, I will use $X$ and $Y$.

The density function of $X$ is $\lambda e^{-\lambda x}$ (for $x \ge 0$), and $0$ elsewhere. There is a similar expression for the density function of $Y$. By independence, the joint density function of $X$ and $Y$ is $$\lambda\mu e^{-\lambda x}e^{-\mu y}$$ in the first quadrant, and $0$ elsewhere.

Let $Z=Y-X$. We want to find the density function of $Z$. First we will find the cumulative distribution function $F_Z(z)$ of $Z$, that is, the probability that $Z\le z$.

So we want the probability that $Y-X \le z$. The geometry is a little different when $z$ is positive than when $z$ is negative. I will do $z$ positive, and you can take care of negative $z$.

Consider $z$ fixed and positive, and draw the line $y-x=z$. We want to find the probability that the ordered pair $(X,Y)$ ends up below that line or on it. The only relevant region is in the first quadrant. So let $D$ be the part of the first quadrant that lies below or on the line $y=x+z$. Then $$P(Z \le z)=\iint_D \lambda\mu e^{-\lambda x}e^{-\mu y}\,dx\,dy.$$

We will evaluate this integral, by using an iterated integral. First we will integrate with respect to $y$, and then with respect to $x$. Note that $y$ travels from $0$ to $x+z$, and then $x$ travels from $0$ to infinity. Thus $$P(Z\le x)=\int_0^\infty \lambda e^{-\lambda x}\left(\int_{y=0}^{x+z} \mu e^{-\mu y}\,dy\right)dx.$$

The inner integral turns out to be $1-e^{-\mu(x+z)}$. So now we need to find $$\int_0^\infty \left(\lambda e^{-\lambda x}-\lambda e^{-\mu z} e^{-(\lambda+\mu)x}\right)dx.$$ The first part is easy, it is $1$. The second part is fairly routine. We end up with $$P(Z \le z)=1-\frac{\lambda}{\lambda+\mu}e^{-\mu z}.$$ For the density function $f_Z(z)$ of $Z$, differentiate the cumulative distribution function. We get $$f_Z(z)=\frac{\lambda\mu}{\lambda+\mu} e^{-\mu z} \quad\text{for $z \ge 0$.}$$ Please note that we only dealt with positive $z$. A very similar argument will get you $f_Z(z)$ at negative values of $z$. The main difference is that the final integration is from $x=-z$ on.

share|improve this answer
    
Before the first double integral, should that be "below or on the line $y = x + z$"? –  Patrick Mar 1 '12 at 0:10
    
@Patrick: Thank you for spotting the typo! Fixed. –  André Nicolas Mar 1 '12 at 0:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.