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.
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.