Distribution of $Z=\frac{X}{X+Y}$ when $X,Y$ are i.i.d geometric random variables If $X,Y$ are independent and have same geometric distribution with parameter $p$, find the distribution of $Z=\frac{X}{X+Y}$.
The solution is
$$\mathbb{P}\left(Z=\frac{m}{n}\right)=\sum_k\mathbb{P}(X=km,Y=k(n-m))=\frac{p^2(1-p)^{n-2}}{1-(1-p)^n}\label{1}\tag{1}$$
But I want to solve this problem by using a bivariate transformation. Let $W=X+Y$: then
\begin{align}
\mathbb{P}(Z=z,W=w) & =\mathbb{P}(X=wz,Y=w(1-z)) \\ & =(1-p)^{wz-1}p(1-p)^{w(1-z)-1}p \\ & =p^2(1-p)^{w-2}\label{2}\tag{2}
\end{align}
$W$ take values in $\{2,3,\ldots\}$, for $z\in (0,1)$:
$$\mathbb{P}(Z=z)=\sum_{w=2}^{\infty}p^2(1-p)^{w-2}=p\label{3}\tag{3}$$
It is wrong but I can't figure out why.
Q1: At first I think the reason is that $Z$ is not a discrete RV, so I can't use bivariate transformation \eqref{2} in the discrete way, but how to bivariate transform $W,Z$? One is discrete, the other is continuous.
Q2: But when I write $Z=m/n$ in \eqref{3}, then $W$ can only take values in $kn$, then
$$\mathbb{P}\left(Z=\frac{m}{n}\right)=\sum_k p^2(1-p)^{kn-2}=\frac{p^2(1-p)^{n-2}}{1-(1-p)^n}$$
which is the right answer. So I'm confused that can we bivariate transform in \eqref{2} when $Z$ is continuous? in my opinion, continuous RV always come with Jacobian.
In a word, I want to know either if \eqref{2} is wrong or \eqref{3} is wrong.
 A: You have pointed this out in your statement of Q2, but I think it will help to clarify: Equation \eqref{2} is correct, but it holds only for certain allowed values of $(z,w)$. To be precise, $w \geq 2$ must be an integer and $z$ must be of the form $\frac v w$ for some integer $1 \leq v \leq w-1$, otherwise the probability is zero For example, suppose $w=3$ and $z = 1/2$. Is it true that
$$
\mathbb P \left( Z = \frac 1 2, W = 3 \right) = p^2 (1-p)^{3-2} ,
$$
as Equation \eqref{2} says? From your reasoning in Q2, the answer is no, because $3$ is not a multiple of $2$; it is impossible to have both $Z = 1/2$ and $W=3$, in other words.
All this is to say that it is possible to write down a formula for $\mathbb P(Z = z, W=w)$, but such a formula must consider the form of $z$ as a fraction. It is clearer instead to consider $(z,w)$ written in the form $\big( \frac m n, n \big)$ with $1 \leq m \leq n-1$, as it must be if the probability is to be positive.
Finally, it is important to note that $Z$ is discrete. It can only take rational values of the form $\frac m n \in \mathbb Q \cap (0,1)$, and this is a countable set.
A: $Z$ is not a continuous random variable.
Because $X$ and $Y$ are positive integers, $Z = \frac{X}{X + Y}$ is always in $\Bbb{Q} \cap (0, 1)$, and the probability of $Z$ taking any particular rational value in $(0, 1)$ is strictly positive: $P(Z = z) > 0$ whenever $z \in \Bbb{Q} \cap (0, 1)$. If $Z$ were continuous on $(0, 1)$ then $P(Z = z)$ would always equal $0$ for any $z \in (0, 1)$ and we would have a probability density for $Z$ rather than a probability mass for $Z$. This is why we don't have a Jacobian, and why our probability expressions are done in terms of infinite sums, rather than integrals.
Equation (2) is incorrect unless $wz \in \Bbb{N}$.
$P(Z = z, W = w)$ is only nonzero if $z = k/w$ for some $k \in \{ 1, 2, ..., w-1 \}$. For instance, if $z = 4/5$ and $w = 3$, $wz = 2.4$ and $w(1-z) = 0.6$, so it is impossible for $X = wz$, $Y = w(1-z)$.
Equation (3) is incorrect, because its derivation is based on assuming Equation (2) is valid for all $w \geq 2$.
Not to mention, it's clearly impossible for $P(Z = z) = p$ for every $z \in \Bbb{Q} \cap (0, 1)$.
A: You need to be very careful when computing marginal pmfs after performing a transformation on discrete random variables. Here is what I mean.
First note that your random vector $(X,Y)$ is supported on the positive integer lattice $S=\mathbb{N}^2$.
As soon as you define $Z=\frac{X}{X+Y}$ and $W=X+Y$, you're designing a new discrete bivariate random vector $(Z,W)$ which is supported on the set $$T(\mathbb{N}^2)=\bigg\{\Big(\frac{m}{n},n\Big):m,n\in \mathbb{N},1\leq m <n\bigg\}$$ Here $T$ is the transformation $$T(x,y)=\bigg(\frac{x}{x+y},x+y\bigg)$$ It is absolutely true for $m,n\in \mathbb{N}$ with $1 \leq m < n$ that $$P\bigg(Z=\frac{m}{n},W=n\bigg)=P(X=m,Y=n-m)=p^2(1-p)^{n-2}$$ What isn't true is the claim you made in (3). If you want to use the joint pmf of $(Z,W)$ to evaluate these probabilities, you need identity the possible outcomes of $Z$, carefully express $\{Z=m/n\}$ as a disjoint union using your joint pmf $(Z,W)$, and then filter out those events among your union which have vanishing probabilities. For example, we could say $$\{Z=m/n\}=\coprod_{k=2}^{\infty}\Big\{(Z,W)=(m/n,k)\Big\}=\coprod_{k=2}^{\infty}\Big\{(X,Y)=(mk/n,(n-m)k/n)\Big\}$$ Here $m,n\in \mathbb{N}$ such that $1 \leq m <n$ and $m/n$ is fully reduced. Note $$P\big((X,Y)=(mk/n,(n-m)k/n)\big)=0$$ whenever $k$ is not a multiple of $n$. Therefore, $$P(Z=m/n)=\sum_{k\in n\mathbb{Z}}^{\infty}P\big((X,Y)=(mk/n,(n-m)k/n)\big)+\sum_{k\notin n\mathbb{Z}}^{\infty}P\big((X,Y)=(mk/n,(n-m)k/n)\big)=\sum_{j=1}^{\infty}P\big((X,Y)=(jm,j(n-m))\big)=\sum_{j=1}^{\infty}p^2(1-p)^{jn-2}=\bigg(\frac{p}{1-p}\bigg)^2\cdot \frac{(1-p)^n}{1-(1-p)^n}$$ as desired.
