# If $X$ is independent of $Y$ and $Y$ is independent of $Z$, is $X$ independent of $Z$? [duplicate]

If $$X$$ is independent of $$Y$$ and $$Y$$ is independent of $$Z$$, is $$X$$ independent of $$Z$$? In other words, is independence transitive?

No. in the extreme case, take for exammple $$X=Z$$.
1. $$X$$ - You find a lottery ticket on the street
2. $$Y$$ - You flip a coin and get a head
3. $$Z$$ - You win the lottery.
$$X$$, $$Y$$ and $$Y$$, $$Z$$ are independent, but lottery ticket for sure help you to win some extra cash.