# Are all variables in a set of random variables independent if all pairs are independent?

If I have a sequence of random variables $X_1, X_2, \ldots, X_n$ (possibly infinite) such that all pairwise cdf's are factorized:

$$F(X_i, X_j) = F_i(X_i) F_j(X_j)$$

for all pairs $(X_i, X_j)$, does it mean that the joint cdf is also factorized? That is:

$$F(X_1, \ldots, X_n) = \prod_{i=1}^{n} F_i(X_i)$$

In other words, if I prove that each pair in the sequence is statistically independent of each other, can longer sequences still be non-independent?

It seems to me that they can, but I can't come up with a counter example.

-

The simplest of the many standard counterexamples is when $(X_1,X_2,X_3)$ takes the values $(1,1,1)$, $(1,0,0)$, $(0,1,0)$ and $(0,0,1)$ all equiprobably.