Joint probability distribution of geometric distribution Let $X$ and $Y$ be independent and identically distributed $(i.i.d.)$ r.v.’s, each having the probability distribution,
$p(k) = (1 − λ)λ^k$; $k = 0,1,...$
where $λ :(0; 1)$ is a constant. 
Define $U = min(X; Y )$; $V = max(X; Y )$; $W = V − U$.
Determine the joint probability distribution of $U$ and $W$ (taking care with $W = 0$) and verify
that $U$ and $W$ are independent r.v.’s.
My work:
I set up this: $P(X=W+U, Y=U)$ when $X>Y$ and $P(X=U, Y=W+U)$ when $X<Y$. and the joint distributions are the same in both cases as $W$ is always non-negative. finally I got the following joint pmf:
$f(w,u)=(1-λ)^2 λ^(w+2u-2)$
when $X=Y$, $f(w,u)=(1-λ)^2 λ^(2u-2)$ 
and ${(w,u): w=0,1...; u= 0,1,..}$
is this the correct joint pmf? what will be the final joint pmf?
 A: Both values of $U$ and $W$ are non-negative integers, say $u$ and $w$ respectively.  We need to find which values of $(x,y)$ are associated with $(u,w).$  This is tantamount to solving the simultaneous equations
$$\begin{array}{rl}
\min(x,y) &=u \\ 
\max(x,y)-\min(x,y)&=w
\end{array}$$
for $(x,y).$  There are two possibilities: $\min(x,y)=x$ or $\min(x,y)=y.$ In the first case, $x=u$ whence $y=u+w.$ In the second case $y=u$ whence $x=u+w.$  These cases overlap when $w=0,$ which occurs when $X=Y.$
Therefore, by the probability axioms, when $w\ne 0$
$$\Pr((U,W)=(u,w)) = \Pr((X,Y)=(u,u+w)) + \Pr((X,Y)=(u+w,u))$$
and otherwise when $w=0$
$$\Pr((U,W)=(u,0)) = \Pr((X,Y)=(u,u)).$$
The independence of $X$ and $Y$ means their probabilities multiply, immediately giving
$$\eqalign{
\Pr((U,W)=(u,w)) &= \left\{\begin{array}{rl}(1-\lambda)\lambda^u\,(1-\lambda)\lambda^{u+w} + (1-\lambda)\lambda^{u+w}\,(1-\lambda)\lambda^u  & \text{if }w\ne 0 \\ (1-\lambda)\lambda^u\, (1-\lambda)\lambda^u &\text{if } w=0\end{array}\right. \\
&=  (1-\lambda)^2\lambda^{2u+w}\left\{\begin{array}{rl}2 & \text{if }w\ne 0 \\ 1 &\text{if } w=0.\end{array}\right.
}$$
A convenient way to write that last expression in brackets uses the binary indicator function $\mathcal{I}:$
$$\mathcal{I}(w\ne 0) + 1 = \left\{\begin{array}{rl}2 & \text{if }w\ne 0 \\ 1 &\text{if } w=0.\end{array}\right.$$
Thus
$$\Pr((U,W)=(u,w)) = (1-\lambda)^2\ \left(\color{blue}{\lambda^{2u}}\right)\ \left(\color{red}{\left(\mathcal{I}(w\ne 0) + 1\right)\lambda^w}\right).$$
This is a product of a normalizing constant $(1-\lambda)^2,$ a function of $u$ alone (in blue), and a function of $w$ alone (in red), demonstrating $U$ and $W$ are independent.
