find joint distribution $\min (X,Y)$ and $W$, where W is a discrete distribution Let, $X,Y$ are independent rv with pdf.s
$f_X(x\mid \lambda)=\dfrac{1}{\lambda}e^{-x/\lambda}$, $x&gt;0$ and $f_Y(y\mid \mu)=\dfrac{1}{\mu}e^{-x/\mu}$, $y&gt;0$.
Let $Z=\min\{X,Y\}$ and
$W=1$ if $Z=X$ and $0$ if $Z=Y$
Find joint distribution of $(Z,W)$?

I found pmf of $W$ which is $f_W(w)=\Big(\dfrac{\mu}{\lambda+\mu}\Big)^w\Big(\dfrac{\lambda}{\lambda+\mu}\Big)^{1-w}$
But have problem while calculating $P(Z\leq z, W=1)$.
$P(Z\leq z, W=1)=P(Z\leq z\mid W=1)P(W=1)=P(X\leq z)P(W=1)$
The last line does not look right to me. What should I do? Thanks for any help!
First, develop joint distribution of $W$ and $Z$ for both $W$ cases:

$$f(Z=z,W=0)=f(Z=z,Z=Y)=f(Y=z,Y&lt;X)=f(Y=z,X&gt;z)=f(Y=z)P(X&gt;z)$$
$$f(Z=z,W=1)=f(Z=z,Z=X)=f(X=z,X&lt;Y)=f(X=z,Y&gt;z)=f(X=z)P(Y&gt;z)$$

Last two terms can be written as follow:

$$f(Z=z,W=0) = f(Y=z)P(X&gt;z) = \frac{1}{\mu}e^{-z/\mu} e^{-z/\lambda}$$
$$f(Z=z,W=1) = f(X=z)P(Y&gt;z) = \frac{1}{\lambda}e^{-z/\lambda} e^{-z/\mu}$$

Finally, one can write:
$$f(Z=z,W=w)=e^{-\left(\frac{1}{\lambda} + \frac{1}{\mu} \right)z}\left(\frac{1}{\lambda}\right)^w\left(\frac{1}{\mu}\right)^{1-w}$$
First, develop joint distribution of $W$ and $Z$ for both $W$ cases:

$$f(Z=z,W=0)=f(Z=z,Z=Y)=f(Y=z,Y&lt;X)=f(Y=z,X&gt;z)=f(Y=z)P(X&gt;z)$$
$$f(Z=z,W=1)=f(Z=z,Z=X)=f(X=z,X&lt;Y)=f(X=z,Y&gt;z)=f(X=z)P(Y&gt;z)$$

Last two terms can be written as follow:

$$f(Z=z,W=0) = f(Y=z)P(X&gt;z) = \frac{1}{\mu}e^{-z/\mu} e^{-z/\lambda}$$
$$f(Z=z,W=1) = f(X=z)P(Y&gt;z) = \frac{1}{\lambda}e^{-z/\lambda} e^{-z/\mu}$$

Finally, one can write:
$$f(Z=z,W=w)=e^{-\left(\frac{1}{\lambda} + \frac{1}{\mu} \right)z}\left(\frac{1}{\lambda}\right)^w\left(\frac{1}{\mu}\right)^{1-w}$$