Prove that two random variables are independent Given $X_1,...,X_n$ independent random variables, each is a roll of a fair dice (each gets a number from 1 to 6 uniformly), define for each subset $I \neq \emptyset$ of $\{1,...,n\}$ the following indicators: $D_I =1$ iff the sum of variables in $I$ is divisible by 3. I want to prove that for two $I \neq J$, the  variables $D_I$ and $D_J$ are independent. Any ideas for elegant solution?
 A: Denote $X_I:=\sum_{i\in I}X_i$ for any $I\subseteq\{1,\dots,n\}$.
A good start of an elegant solution would be proving that for a nonempty $I$ we have: $$\Pr(X_I\equiv r\mod3)=\frac13\text{ for }r=0,1,2\tag1$$
For this let $i_0\in I$ and let $J=I\setminus\{i_0\}$.
Then: $$\Pr(X_I\equiv r\mod3)=\sum_{k\in\mathbb N}\Pr(X_{i_0}+k\equiv r\mod3\mid X_J=k)\Pr(X_J=k)$$
$X_{i_0}$ takes values in $\{1,2,3,4,5,6\}$ with equiprobability for these values and for exactly $2$ elements $m$ in $\{1,2,3,4,5,6\}$ we have: $m+k\equiv r\mod3$.
This tells us that $\Pr(X_{i_0}+k\equiv r\mod3\mid X_J=k)=\frac26=\frac13$ for every $k\in\mathbb N$ and consequently: $$\Pr(X_I\equiv r\mod3)=\sum_{k\in\mathbb N}\frac13\Pr(X_J=k)=\frac13$$
Note that $\{D_I=1\}=\{X_I\equiv 0\mod3\}$ so it is proved now that $\Pr(D_I=1)=\frac13$
It remains to prove that $\Pr(D_I=1=D_J)=\frac19$ if $I\neq J$ and both sets are not empty.
For this observe that $D_I=1=D_J$ if and only if:$$\langle X_{I\setminus J},X_{I\cap J},X_{J\setminus I}\rangle\in\{\langle\overline0,\overline0,\overline0\rangle,\langle\overline2,\overline1,\overline2\rangle,\langle\overline1,\overline2,\overline1\rangle\}$$
Here $X_{I\setminus J},X_{I\cap J},X_{J\setminus I}$ are independent, and e.g. $X_{I\setminus J}=\overline1$ is a notation for $X_{I\setminus J}\equiv1\mod3$ .
I will leave the rest to you.
A: I noticed that many of your previous math.SE questions were on linear algebra, so I hope you don't mind me using a linear algebra approach. Essentially, I will translate the probability  problem about independence of random variables into a linear algebra problem about linear independence of vectors.
Let us store the outcomes of the $n$ dice throws as a vector $$(x_1 {\rm \ mod \ } 3, \ \dots \ , x_n {\rm \ mod  \ } 3 ) \in (\mathbb Z_3)^{\oplus n}.$$
We may think of $(\mathbb Z_3)^{\oplus n}$ as a vector space over the field $\mathbb Z_3$. It has dimension $n$ as a $\mathbb Z_3$-vector space, and it contains a total of $3^n$ elements. Clearly, given the nature of the dice roll, each "outcome vector" in our vector space is equally likely to occur.
Within this vector space, we can identify a subset consisting of those "outcomes vectors" that satisfy $\sum_{i \in I} x_i = 0 {\rm \ mod \ } 3 $. The nice thing about this subset is that it is a vector subspace, defined as the hyperplane,
$$ \begin{bmatrix} a_1 \ \dots \ a_n \end{bmatrix} \begin{bmatrix} x_1 \\ \vdots \\ x_n \end{bmatrix} = 0,$$
where all the numbers in the equation are to be thought of as elements in $\mathbb Z_3$, and where we define
$$ a_i = \begin{cases} 1 &  {\rm \ if \ } i \in I, \\ 0 & {\rm \ if \ } i \notin I \end{cases}$$
Since $I \neq \emptyset$, we know that at least one of the $a_i$'s is non-zero. So the matrix $\begin{bmatrix} a_1 \ \dots \ a_n \end{bmatrix}$ has rank $1$, and hence, the vector subspace defined by the above matrix equation is $(n-1)$-dimensional as a vector space over $\mathbb Z_3$, which implies that it contains $3^{n-1}$ elements.
We can do the same with $J$: the subset of outcome vectors such that $\sum_{i \in J} x_i = 0 {\rm \ mod \ } 3$ is the $(n-1)$-dimensional vector subspace with $3^{n-1}$ elements defined by
$$ \begin{bmatrix} b_1 \ \dots \ b_n \end{bmatrix} \begin{bmatrix} x_1 \\ \vdots \\ x_n \end{bmatrix} = 0,$$
where
$$ b_i = \begin{cases} 1 &  {\rm \ if \ } i \in J, \\ 0 & {\rm \ if \ } i \notin J \end{cases}.$$
Now let's think about the set of outcomes such that both $\sum_{i \in I} x_i = 0 {\rm \ mod \ } 3$ and $\sum_{i \in J} x_i = 0 {\rm \ mod \ } 3$ are satisfied. This is a vector subspace, defined by the matrix equation
$$ \begin{bmatrix} a_1 \ \dots \ a_n \\ b_1 \ \dots \ b_n \end{bmatrix} \begin{bmatrix} x_1 \\ \vdots \\ x_n \end{bmatrix} = 0.$$
And here's the crucial point. Since $I \neq J$, it is clear that $(a_1, \dots, a_n)$ and $(b_1, \dots, b_n)$ are not $\mathbb Z_3$-multiples of each other: they are linearly independent! So the matrix $\begin{bmatrix} a_1 \ \dots \ a_n \\ b_1 \ \dots \ b_n \end{bmatrix} $ has rank two, and hence, the vector subspace defined by the above equation has dimension $n-2$, which means that it contains $3^{n-2}$ elements.
Finally, the probability of $D_J = 1$ (where $D_J$ is as defined in your question) is the number of "outcome vectors" such that $\sum_{i \in J} x_i = 0 {\rm \ mod \ } 3$, divided by the total number of outcome vectors in the entire vector space:
$$ {\rm P}(D_J = 1) = \frac{3^{n-1}}{3^n} = \frac 1 3.$$
Meanwhile, the probability of $D_J = 1$ given that $D_I = 1$ is the number of "outcome vectors" such that both $\sum_{i \in I} x_i = 0 {\rm \ mod \ } 3$ and $\sum_{i \in J} x_i = 0 {\rm \ mod \ } 3$ are true, divided by the number of outcome vectors such that $\sum_{i \in I} x_i = 0 {\rm \ mod \ } 3$ is true:
$$ {\rm P}(D_J = 1 | D_I = 1) = \frac{3^{n-2}}{3^{n-1
}} = \frac 1 3.$$
Since ${\rm P}(D_J = 1) = {\rm P}(D_J = 1 | D_I = 1)$, it follows that $D_I$ and $D_J$ are independent as random variables.
