Finding correlation coefficient Two dice are thrown. $X$ denotes number on first die and $Y$ denotes maximum of the numbers on the two dice. Compute the correlation coefficient.
 A: We outline a basically computational approach, leaving details to you. The mean of $X$ is easily found to be $\frac{7}{2}$. For the variance of $X$, we first find $E(X^2)$, which is
$$\frac{1}{6}(1^2+2^2+3^2+4^2+5^2+6^2).$$
Thus $\text{Var}(X)=\frac{91}{6}-\left(\frac{7}{2}\right)^2=\frac{35}{12}$.
Next we find the mean and variance of $Y$. The probability that the maximum is $1$ is $\frac{1}{36}$. We have $Y=2$ if our tosses are $(1,2)$, $(2,1)$, or $(2,2)$. Thus $\Pr(Y=2)=\frac{3}{36}$.  We have $Y=3$ if our tosses are $(1,3)$, $(2,3)$, $(3,3)$, $(3,1)$, or $(3,2)$, for a probability of $\frac{5}{36}$. Similarly, we can see that $\Pr(X=4)=\frac{7}{36}$, and $\Pr(X=5)=\frac{9}{36}$ and $\Pr(X=6)=\frac{11}{36}$. Now we can compute $E(Y)$ and $E(Y^2)$, and then $\text{Var}(Y)$.
The correlation coefficient is 
$$\frac{\text{Cov}(X,Y)}{\sqrt{\text{Var}(X)\text{Var}(Y)}}.$$
We still need to find $\text{Cov}(X,Y)$, which is $E(XY)-E(X)E(Y)$.
To find $E(XY)$, we compute
$$\frac{1}{6}\left(E(XY|X=1)+E(XY|X=2)+\cdots+E(XY|X=6)\right).$$
We do a sample calculation, say $E(XY|X=3)$. If $X=3$, the maximum is $3$ with probability $\frac{3}{6}$ (second toss any of $1$, $2$, or $3$) and $4$, $5$, or $6$ each with probability $\frac{1}{6}$. So the mean of the maximum, given $X=3$, is $3\cdot\frac{1}{6}+4\cdot\frac{1}{6}+5\cdot\frac{1}{6}+6\cdot\frac{1}{6}$, which is $3$, and therefore $E(XY|X=3)=9$. 
Remark: Alternatively, we could write down the full $6\times 6$ joint distribution table for $(X,Y)$, and do the computations using that table. 
A: If $X \sim DiscreteUniform(1,6)$ and $Z \sim DiscreteUniform(1,6)$ are independent random variables, then their joint pmf, say $f(x,z)$ is: 
f = (1/6)*(1/6);   domain[f] = {{x, 1, 6}, {z, 1, 6}}  && {Discrete};

The desired correlation is then easy to compute using automated tools:
Corr[{x, Max[x, z]}, f]

returns:  $3 \sqrt{\frac{3}{73}}$ which is approximately 0.608 ...
Notes


*

*The Corr function used above is from the mathStatica package for Mathematica. As disclosure, I should add that I am one of the authors.

