# How to mathematically prove that we are sampling from same distributions?

The content of this question is about rigorously proving something which is otherwise considered easily correct intuitively.

Let's assume we have a multivariate distribution $g(x_1,x_2,...,x_n)$ over the variables $x_{1:n}$. Let's assume that we know how to sample from that distribution, too. We draw samples $x^{1}_{1:n},x^{2}_{1:n}, ... ,x^{N}_{1:n}$ from this distribution.

Then we assume that we have the distributions $f_{1}(x_1), f_{2}(x_2|x_1),f_{3}(x_3|x_2,x_1),...,f_n(x_n|x_{1:n-1})$ which is equal to $g(x_1,x_2,...,x_n) = f_{1}(x_1)f_{2}(x_2|x_1)f_{3}(x_3|x_2,x_1),...,f_n(x_n|x_{1:n-1})$ by the chain rule of probabilities. Now, for each sample $x^{i}_{1:n}$ we first sample $x^{i}_{1}$ from $f_{1}(x_1)$, then $x^{i}_{2}$ from $f_{2}(x_2|x_1)$ up to $x^{i}_{N}$ from $f_n(x_n|x_{1:n-1})$. We again obtain $N$ samples.

Intuitively we know that the first $N$ samples which come from $g(x_1,x_2,...,x_n)$ and second $N$ samples each of which sequentially come from $f_{1}(x_1),f_{2}(x_2|x_1),f_{3}(x_3|x_2,x_1),...,f_n(x_n|x_{1:n-1})$ are identically distributed. But how can we show this fact in a mathematically rigorous way? I could not think of any procedure and became stuck.