Suppose you flip four fair coins. Let $X$ be the number of heads showing, and let $Y$ be the number of tails showing. Compute $Cov(X, Y)$ and $Corr(X, Y)$.
Although it is not stated, it is clear that $X,Y$ are Binomial to $n=4, \theta=1/2$.
Thus we know that variance of a binom dist is $n\theta(1-\theta)=1$ in our case.
We also know that the expectation of a binom dist is $n\theta=2$ in our case.
Thus, our formula becomes:
$cov(X,Y)=E(XY)-E(X)E(Y)=E(XY)-(2)(2)$
How do I calculate $E(X)E(Y)$?
Can I treat $X$ and $Y$ as independent?
$E(X)=E(Y)=2$ as you computed. $E(X^2)=E(Y^2)=5$, so $Var(X)=Var(Y)=1$ and $E(XY)=E(X(4-X))=4E(X)-E(X^2)=3$, so $Cov(X,Y)=-1$ and $Cor(X,Y)=-1$.