In an urn there are 5 white balls and 4 black balls. One ball is extracted from the urn and is replaced with a ball of the opposite collor. Then a new ball is extracted. $X$ represents the number of white balls extracted and $Y$ the number of black balls extracted.
(c) Compute the covariance of the 2 variables. Are these 2 variables independent?
In the official solution:
The distribution of these 2 variables is:
$$X:\left(\begin{matrix} 0 & 1 & 2 \\ \frac{12}{81} & \frac{49}{81} & \frac{20}{81} \end{matrix}\right) $$
$$Y:\left(\begin{matrix} 0 & 1 & 2 \\ \frac{20}{81} & \frac{49}{81} & \frac{12}{81} \end{matrix}\right) $$
Then
$$XY:\left(\begin{matrix} 0 & 1 \\ \frac{32}{81} & \frac{49}{81} \end{matrix}\right) $$
Then
$$E[XY] = \frac{49}{81}$$ and $$cov(X, Y) = \frac{49}{81} - \frac{89}{28} * \frac{73}{81}$$
What I don't understand is how did he get the distribution for $XY$.
Since $2$ balls are extracted in total, $X+Y=2$, so although the distributions for $X$ and $Y$ are written like marginal distributions, they actually tell you the joint distribution, since the value of $X$ determines the value of $Y$ and vice versa. (This also explains the symmetry between the two distributions.)
Now $0\cdot2=2\cdot0=0$ and $1\cdot1=1$, so $P(XY=1)=P(X=Y=1)$ and $P(XY=0)$ is the complement.