# Covariance of number of 1's and the sum of all results of $n$ fair die tosses

A die is tossed $n$ times. Find the covariance of the number of one's and the sum of all results.

I started by defining a random variable $X_i$ as $i=1,\ldots,n$, $X_i=1$ if at the $i$'th toss turned to be $1$ and $X_i=0$ otherwise.

By that I would be able to represent $X$: the number of 1's as $X=\sum_{i=1}^nX_i$ and calculate the expectancy for $X$.

I had trouble deciding which random variable should I define for $Y$: the sum of results.

I could really use any kind of direction, thanks in advance!

• You are to find $\operatorname{Cov}\left(\sum X_i, \sum 1_{\{X_i = 1\}}\right)$. – Therkel Jan 11 '17 at 19:24

## 1 Answer

Sketch/hint: Let the random variable $Y_i \in \{1,2 \cdots 6\}$ be the $i-th$ die result. Then

$$X_i = \begin{cases}1 & Y_i=1 \\ 0 & {\rm otherwise}\end{cases}$$

We want to compute $Cov(X,Y)$ where $X=\sum_{i=1}^n X_i$ and $Y=\sum_{i=1}^n Y_i$

Start by showing (or recalling) that, in general, the covariance of independent variables is zero, and that if $X_1,X_2 \dots X_n$ are independent and also $Y_1,Y_2 \dots Y_n$, then $$Cov(X_1 + X_2 +\cdots,Y_1 + Y_2 +\cdots)=Cov(X_1,Y_1)+Cov(X_2,Y_2)+\cdots$$

Show that the independence assumption holds in your case, and compute $Cov(X_i,Y_i)$

Can you go on from here?

• Could I say that if the result on the i-th toss wasn't 1 than Xi,Yi are independent and Cov(Xi,Yi)=0 If it was 1 than Xi and Yi actually represent the same situation so I will change E(XY)-E(X)E(Y) to E(X^2)-[E(X)]^2 which is Var(X)? I'm not sure I got you entirely.. – Ken Mizrahi Jan 11 '17 at 21:12