Is statistical dependence transitive? Take any three random variables $X_1$, $X_2$, and $X_3$. 
Is it possible for $X_1$ and $X_2$ to be dependent, $X_2$ and $X_3$ to be dependent, but $X_1$ and $X_3$ to be independent?
Is it possible for $X_1$ and $X_2$ to be independent, $X_2$ and $X_3$ to be independent, but $X_1$ and $X_3$ to be dependent?

First problem: Toss a fair coin twice. Let $X_1=1$ if the first toss is a head, and $0$ otherwise. Let $X_3=1$ if the second toss is a head, and $0$ otherwise. Let $X_2$ be the number of heads in the two tosses combined.
Then $X_1$ and $X_2$ are dependent, as are $X_2$ and $X_3$, but $X_1$ and $X_3$ are independent.
Second problem: Again, two tosses of a fair coin. Let $X_1$ and $X_3$ each be $1$ if we get head on the first toss, and $0$ otherwise. Let $X_2$ be $1$ if we got a head on the second toss, and $0$ otherwise.  Then $X_1$ and $X_2$ are independent, as are $X_2$ and $X_3$, but $X_1$ and $X_3$ are very much not independent. 
