# Let $X$ be the total number of heads and $Y$ be the difference between the total number of heads and the total number of tails. Find $\rho(X, Y )$

A coin (with probability of getting head equal to $p$) is tossed twice. Let $X$ be the total number of heads and $Y$ be the difference between the total number of heads and the total number of tails. Find $\rho(X, Y)$.

-
Where are you stuck? – Stefan Hansen Dec 15 '12 at 13:48
This cannot be: please indicate what you tried. (Or are you flatly using MSE as a site to quickly get fully written solutions to your homework? I hope not.) – Did Dec 15 '12 at 15:01
Interesting: you flout spectacularly the rules of the site, you delete a previous comment of yours to which mine answered (better to erase your footsteps?), and you libel as disturbance my reminder... Let me note that none of your questions, so far, indicates anything about what you tried or what you know. Why is that? – Did Dec 15 '12 at 18:39
Three comments by the OP now deleted by the OP. – Did Dec 16 '12 at 9:23

If the coin is tossed twice, there are four possible outcomes, corresponding to the following values of $X$ and $Y$. (I take the definition of $Y$ to mean "number of heads (H) minus number of tails (T)")

event  probability   X  Y
HH     pp            2  2
HT     p(1-p)        1  0
TH     (1-p)p        1  0
HH     (1-p)(1-p)    0  -2

To compute the correlation between $X$ and $Y$ (I assume that's what you mean by $\rho(X,Y)$), we observe that $E X = 2p^2+2p(1-p)=2p$, $E X^2 = 4p^2+2p(1-p)=2p(p+1)$ and thus $$\operatorname{Var} X = E X^2 - (E X)^2 = 2p(1-p).$$ Similarly, one computes $E Y=2p^2-2(1-p)^2=2(2p-1)$, $E Y^2=4p^2+4(1-p)^2=8p^2-8p+4$, and thus $$\operatorname{Var} Y = E Y^2 - (E Y)^2 = -8p^2+8p=8p(1-p).$$ One also computes that $EXY=4p^2$, and thus the covariance between $X$ and $Y$ is $$\operatorname{Cov}(X,Y) =E XY-E X EY = 4p^2 - 16p^2(1-p)^2.$$

Finally, the covariance between $X$ and $Y$ becomes $$\rho(X,Y)=\frac{\operatorname{Cov}(X,Y)}{\sqrt{\operatorname{Var} X \operatorname{Var} Y}} = \frac{p \left(4p(2-p)-3\right)}{1-p}.$$

-
I would have liked to comment to ask Bs11 what he has tried himself (herself), but my reputation doesn't seem to allow this. Hence the full answer. I agree that MSE should not be used to get full answers to homework questions. – Eckhard Dec 15 '12 at 15:11
Eckhard This is a friendly advice: when the OP forgets (or refuses) to show what they tried or what they know, one may prefer to provide hints rather than a full solution (I know, this is not always easy). To get the idea, you might wish to consult answers to other questions by same OP. – Did Dec 16 '12 at 9:23