marginal distribution of $X_2$ Consider $X_1 = x$ and $n$ a natural number and $p$ between $0$ and $1$
$$X_1 \sim B(n, p) =  \binom{n}{x} p^x q^{n-x}$$
$$X_2 \mid X_1 \sim B(X_1, p)$$
I can prove that $X_2 \sim B(n,p^2)$. Is this the marginal distribution of $X_2$?
Can someone elaborate the marginal distribution?
EDIT: proof
Let's simply look at $X_2$ to start, then
$$\mathbb{P}(X_2=x)=\sum_{y=0}^n \mathbb{P}(X_2=x\mid X_1=y)\mathbb{P}(X_1=y)$$
If $y<x$, the conditional probability is $0$, thus
$$\mathbb{P}(X_2=x)=\sum_{y=x}^n \mathbb{P}(X_2=x\mid X_1=y)\mathbb{P}(X_1=y)$$
We can now write
$$\begin{eqnarray}\mathbb{P}(X_2=x\mid X_1=y) & = & {y \choose x} p^x q^{y-x} \\ \mathbb{P}(X_1=y) & = & {n \choose y} p^y q^{n-y}  \end{eqnarray}$$
and thus
$$\mathbb{P}(X_2=x)=\sum_{y=x}^n {y \choose x} p^x q^{y-x} {n \choose y} p^y q^{n-y}$$
We can work out the combinatorial factors and regroup some other factors
$$\begin{eqnarray}\mathbb{P}(X_2=x) & = & p^x q^{n-x} \sum_{y=x}^n \frac{n!}{x!(y-x)!(n-y)!} p^y \\ & = &\frac{n!}{x!(n-x)!}p^x q^{n-x} \sum_{y=x}^n \frac{(n-x)!}{(y-x)!((n-x)-(y-x))!} p^y \\ & = &\frac{n!}{x!(n-x)!}p^{2x} q^{n-x} \sum_{z=0}^{n-x} \frac{(n-x)!}{(z)!((n-x)-z)!} p^z \end{eqnarray} $$
In the last step, you recognize with the binomium of Newton $(1+p)^{n-x}$, thus
$$\begin{eqnarray}\mathbb{P}(X_2=x) & = & \frac{n!}{x!(n-x)!}p^{2x} q^{n-x} (1+p)^{n-x}\\ & = & \frac{n!}{x!(n-x)!}p^{2x} (1-p)^{n-x} (1+p)^{n-x}\\ & = & \frac{n!}{x!(n-x)!}(p^2)^{x} (1-p^2)^{n-x} \\ \end{eqnarray} $$
This means that $X_2 \sim B(n,p^2)$.
 A: One way to look at this is that you have $n$ candidates for inclusion, and each candidate has probability $p$ of passing each of two tests, and the outcomes of all tests are mutually indepednent, with probability $p$ of success at each test.
Then $X_1$ is the number of candidates who pass the first test, and $X_2$ is the number among those who go on to pass the second test.
For each candidate, the probability of passing both tests is $p^2,$ and $X_2$ is the number of candidates who do that. Therefore $X_2\sim\operatorname{Binomial}(n,p^2).$
More explicitly, for $i=1,\ldots, n,$ let $A_i=0\text{ or } 1$ according as candidate $i$ passes the first test. And for $i=1,\ldots,n,$ let $B_i=0 \text{ or } 1$ according as candidate $i$ passes the second test.
Let $X_1 = A_1 + \cdots + A_n$ be the number of candidates who pass the first test. Let $X_2 = A_1 B_1 + \cdots + A_n B_n$ be the number of candidates who pass the second test. Then $X_1 \sim \operatorname{Binomial}(n,p)$ and $X_2\mid X_1 \sim \operatorname{Binomial}(X_1,p),$ and $X_2\sim\operatorname{Binomial}(n, p^2).$
