Question
- There are $n+m$ independent trials, success probability $p$
- $X = $ # of successes in first $n$ trials
- $Z = $ total # of successes in $n+m$ trials
What is the joint pmf of $X$ and $Z$?
My attempt
I think the answer is...
$$P(X=x,Z=z) = \binom{n}{x} p^x (1-p)^{n-x} \binom{m}{z-x} p^{z-x} (1-p)^{m-z+x}$$
Assuming $x\le n$ and $z-x\le m$
I thought about various test cases like $P(X=0,Z=4)$ etc, and it seems to be correct...
Thanks for your help and patience!
\begin{align} P(X=x, Z=z)&=P(X=x, Y=z-x)\\ &=P(X=x)P(Y=z-x) \text{, by independence} \\ &= \begin{cases} \binom{n}{x} p^x (1-p)^{n-x} \binom{m}{z-x} p^{z-x} (1-p)^{m-z+x}&, 0 \le x \le n, 0\le z-x \le m \\ 0& \text{otherwise}\end{cases} \\ &= \begin{cases} \binom{n}{x}\binom{m}{z-x} p^z (1-p)^{m+n-z} &, 0 \le x \le n, 0\le z-x \le m \\ 0& \text{otherwise}\end{cases} \end{align}