$X, Y \sim Geom\left(p\right)$, and $X, Y$ are independent. Find $p_{X | X+Y}\left(i | n\right)$.

**My approach:**

pmf of geometric distribution: $p_X(i) = {p(1-p)^{i-1}}$

Then, by the law of total probability: $p_{X | X+Y}\left(i | n\right) = \frac{p_{X, X+Y}\left(i,n\right)}{p_{X+Y}\left(n\right)} $

[**Is using the law of total probability here correct as opposed to using Bayes theorem?**]

Let $Z = X + Y$. Then, the CDF of Z is

$$F_Z\left(n\right) = Pr\left(Z \leq n\right) = Pr\left(X+Y \leq n\right)$$

Then, by conditioning on X, we can get:

$$Pr\left(X+Y \leq n\right) = \sum_{i=1}{Pr\left(X+Y \leq n\right | X = i)Pr\left(X=i\right)}$$

Then, $Pr\left(X=i\right)$ is simply the pmf of $X$ for a geometric random variable, which we know. Then since X takes the value $i$, we can rewrite this as

$$ Pr\left(X+Y \leq n\right) = \sum_{i=1}{Pr\left(Y \leq n-i | X=i\right)Pr\left(X=i\right)}$$

Since $X, Y$ are independent, then $Pr\left(Y \leq n-i | X=i\right) = Pr\left(Y \leq n-i\right)$, which is the CDF for $Y$, $F_Y(n-i)$. Thus, we have

$$ \sum_{i=1}{F_Y(n-i) p_{X}(i)}$$

Then by differentiating with respect to n to get the pmf from the CDF [**Is the interchange of the differential and the summation allowed here since the upper bound of the summation is technically infinity?**]:

$$p_{Z}(n) = p_{X+Y}(n) = \frac{d}{dn} \sum_{i=1}{F_Y(n-i) p_{X}(i)} = \sum_{i=1}{\frac{d}{dn} F_Y(n-i) p_{X}(i)} = \sum_{i=1}{p_Y(n-i) p_{X}(i)}$$

Thus, $p_{X+Y}(n) = p^2 (1-p)^{n-i-1} (1-p)^{i-1}) = p^2 (1-p)^{n-2}$. Then, all that is needed is the joint pmf $p_{X, X+Y}\left(i, n\right)$

**I am stuck with how to find the joint pmf because** $X$ **and** $X+Y$ **are not independent. Any help is appreciated!**