Does $X ⊥ Y \leftrightarrow X ⊥ Y | Z$ implies $(X,Y) ⊥ Z$? Let $X, Y$ and $Z$ be random variables. Let


$p_1$ be the statement that $(X,Y) ⊥  Z$ (meaning $(X,Y)$ and $Z$  are independent), 
$p_2$ be the statement that $X ⊥  Y$ (meaning $X$ and $Y$ are independent) 
$p_3$ be the statement that $X ⊥  Y \mid Z$ (meaning $X$ and $Y$ are conditionally independent given $Z$) 


What I have known is that if $p_1$ is true, then $p_2$ and $p_3$ imply each other.

I wonder if the reverse is true. That is, if $p_2$ and $p_3$ imply each other, will $p_1$ be true? To disprove it, is there a counterexample? Thanks.
No, the converse is not true.  Here are two counter-examples:

1) Consider the following triplets of values all with equal probability.  $p_2$ and $p_3$ are both true in that $X$ and $Y$ are unconditionally independent of each other and (given $Z$) are conditionally independent of each other, while $p_1$ is not true as the pair $(X,Y)$ is not independent of $Z$ 

 X    Y    Z 
 1    1    1
 1    2    1
 2    1    1 
 2    2    1
 1    3    2
 1    4    2
 2    3    2
 2    4    2 


2) Consider the following triplets of values all with equal probability.  Neither $p_2$ and $p_3$ are true in that $X$ and $Y$ are neither unconditionally independent of each other nor (given $Z$) conditionally independent of each other, while $p_1$ is not true as the pair $(X,Y)$ is not independent of $Z$ 

 X    Y    Z 
 1    1    1
 1    2    1
 2    1    1 
 1    3    2
 1    4    2
 2    3    2
If $p_1$false, then $p_3$ does not imply $p_2$ because assuming $p_1$ and $p_3$, we can't decide whether $X$ and $Y$ are dependent or independent.

I &lt;3 all Tim's.