a die is rolled twice, let X be the sum of the outcomes and let Y be the first outcome minus the second outcome. Compute Cov(X,Y)
If is the outcome of your first roll and is the outcome of the second roll, then according to the question
Now use the properties of covariancesto find:
Or you can say
Find the expected values from these tables
Code:First X 1 2 3 4 5 6 Second 1 2 3 4 5 6 7 2 3 4 5 6 7 8 3 4 5 6 7 8 9 4 5 6 7 8 9 10 5 6 7 8 9 10 11 6 7 8 9 10 11 12 First Y 1 2 3 4 5 6 Second 1 0 1 2 3 4 5 2 -1 0 1 2 3 4 3 -2 -1 0 1 2 3 4 -3 -2 -1 0 1 2 5 -4 -3 -2 -1 0 1 6 -5 -4 -3 -2 -1 0 XY First Second 1 2 3 4 5 6 1 0 3 8 15 24 35 2 -3 0 5 12 21 32 3 -8 -5 0 7 16 27 4 -15 -12 -7 0 9 20 5 -24 -21 -16 -9 0 11 6 -35 -32 -27 -20 -11 0