# Covariance between two binomial RVs

Suppose we toss a fair dice $$n$$ times. For $$i=1,\dots,6$$, let $$X_i$$ denote the number of times the dice comes up with value $$i$$. Find the $$\textrm{cov}(X1, X2)$$.

By definition, $$\textrm{cov}(X1, X2)=E[X_1 X_2] - E[X_1]E[X_2]$$.

Since the dice is fair, we know that each $$X_i$$ follows a $$\textrm{Binomial}(n, 1/6)$$ distribution. So $$E[X_i]=n/6$$.

My question is how do we find $$E[X_1 X_2]$$? Thanks a lot for your help in advance.

Note that $$X_i$$ can be considered as the sum of independent Bernoulli random variables, i.e., $$X_i=\sum_{j=1}^nY_i^j$$, where $$Y_i^j$$ is $$1$$ when $$i$$ occurs at the $$j$$-th trial, and $$0$$ if otherwise. Then, we have $$\mathrm{E}[X_1X_2]=\sum_{j=1}^n\mathrm{E}[Y_1^jY_2^j]+\sum_{i\neq j}\mathrm{E}[Y_1^iY_2^j]=\sum_{i\neq j}\mathrm{E}[Y_1^i]\mathrm{E}[Y_2^j]=(n^2-n)/36$$. Therefore, it follows that $$\operatorname{Cov}(X_1,X_2)=\mathrm{E}[X_1X_2]-\mathrm{E}[X_1]\mathrm{E}[X_2]=-n/36$$.
A more general result is $$Cov(X_i,X_j)=-np_ip_j$$, where $$p_i$$ is the occurrance probability of the $$i$$-th outcome at a single trial.