# Your evil probability professor has an urn with 9 balls.

Your evil probability professor has an urn with 9 balls: 2 red, 3 white and 4 blue. He draws two balls from the urn without replacement. Let X be the number of red balls drawn and Y the number of white balls.

a) Determine the joint probability mass function of X and Y.
b) Are X and Y independent random variables?
c) Compute the covariance between X and Y.

For point A:
$$P(0,0)=\frac{4}{9} \cdot \frac{3}{8} = \frac{1}{6}$$ That is correct for the solution.
$$P(0,1)=\frac{4}{9} \cdot \frac{3}{8} + \frac{3}{9} \cdot \frac{4}{8} = \frac{1}{3}$$ That is correct for the solution.
$$P(1,0)=\frac{2}{9} \cdot \frac{4}{8} + \frac{4}{9} \cdot \frac{2}{8}= \frac{2}{9}$$ That is correct for the solution.
$$P(1,1)=\frac{2}{9} \cdot \frac{3}{8} + \frac{3}{9} \cdot \frac{2}{8}= \frac{1}{6}$$ That is correct for the solution.
$$P(2,0)=\frac{2}{9} \cdot \frac{1}{8} = \frac{1}{36}$$ That is correct for the solution.
$$P(0,2)=\frac{3}{9} \cdot \frac{2}{8} = \frac{1}{12}$$ That is correct for the solution.

For point B to check the independancy I have just to check if for example $$P(X=0,Y=0) = P(X=0) \cdot P(Y=0)$$.
$$\frac{1}{6} \neq (\frac{7}{9} \cdot \frac{6}{8}) \cdot (\frac{6}{9} \cdot \frac{5}{8})$$.
So X and Y are not independent.

For point C I know that the covariance $$Cov(X,Y)=E[X \cdot Y]-E[X]\cdot E[Y]$$, but how can compute the expectations, do I have to figure put with distribution is? How can I do it?

Can someone help me? Thanks in advance, Fabio!

For a) keep in mind that the order you draw the balls in matters. For example, for $$P(0,1)$$ we can draw a blue ball then a white ball or a white ball then a blue ball.

For b) independence says that for every $$x$$ and $$y$$, $$P(x,y) = P_X(x)P_Y(y)$$. It's not enough to check a single pair $$(x,y)$$ to prove independence. On the other hand, if there is some $$x$$ and $$y$$ for which $$P(x,y) \ne P_X(x)P_Y(y)$$ then $$X$$ and $$Y$$ are not independent.

For c) recall that $$\displaystyle \mathbf E[f(X,Y)] = \sum_{(x,y)} f(x,y)P(x,y)$$.

• Thank you for the answer, I understood how to compute correctly the first part, for part B I tried the formula what you wrote, what I did it's correct? For part C how can I compute f(x,y) I have to figure out the distribution type?
– TFAE
Commented Oct 23, 2018 at 22:11
• @FabioTaccaliti b) looks right. For c) in $\mathbf{E}[XY]$ we have $f(x,y) = xy$ and for $\mathbf{E}[X]$ we have $f(x,y) = x$ and similarly for $Y$. Commented Oct 24, 2018 at 0:58
• And then I have to multiply these $f$ with the probabilities that I calculate in the first part of the problem?
– TFAE
Commented Oct 25, 2018 at 17:53
• @Fabio Taccaliti yes Commented Oct 25, 2018 at 20:42
• @FabioTaccaliti All the pieces are there correctly but just remember to multiply E[X] by E[Y] rather than add them. Commented Oct 25, 2018 at 21:10

Another way to check dependence (i.e. part B only) is that if $$X,Y$$ are independent then for any values $$x,y$$ we have $$P(Y=y) = P(Y=y | X=x)$$. However, clearly if there are 2 red balls then there cannot be any white balls, i.e. $$P(Y > 0) > 0$$ but $$P(Y > 0 | X=2) = 0$$. This might be a more intuitive example demonstrating dependence.

• Thank you for the answer, this makes sense, can you help me with part C? Thanks!
– TFAE
Commented Oct 23, 2018 at 22:16

but how can compute the expectations, do I have to figure put with distribution is?

You have the distribution, $$P(x,y)$$. Use it.

The expectation of function $$g$$ of $$X,Y$$ is:

\begin{align}\mathsf E(g(X,Y)) &=\sum_{x}\sum_{y} g(x,y)~P(x,y)\\[1ex]\textsf{so...}\\[2ex]\mathsf E(X) &=\sum_{x}\sum_{y} x~P(x,y) \\ &=0+P(1,0)+P(1,1)+2P(2,0)\end{align}

And so on.

• Sorry, I don't understand your expression, so, for example, I'll have: <br/> $E[X] =0 \cdot P(X=0) + 1 \cdot P(X=1) + 2 \cdot P(X=2)$ <br/> $E[Y] =0 \cdot P(Y=0) + 1 \cdot P(Y=1) + 2 \cdot P(Y=2)$ <br/> $E[X,Y] = 0 \cdot 0 \cdot P(X=0,Y=0) + 1 \cdot 0 \cdot P(X=1,Y=0) + 0 \cdot 1 \cdot P(X=0,Y=1) + 1 \cdot 1 \cdot P(X=1,Y=1) + 2 \cdot 0 \cdot P(X=2,Y=0) + 0 \cdot 2 \cdot P(X=0,Y=2)$ right? <br/> For $P(X=0)$ should I consider just a ball, so $\frac{7}{9}$ or two balls $\frac{7}{9} \cdot \frac{6}{8}$?
– TFAE
Commented Oct 23, 2018 at 23:37
• @FabioTaccaliti \begin{align}P(X{=}0)&=P(X{=}0,Y{=}0)+P(X{=}0, Y{=}1)+P(X{=}0, Y{=}2)\\[2ex]&= \sum_y P(X{=}0,Y{=}y)\end{align} Commented Oct 23, 2018 at 23:46
• I still don't get it, sorry..
– TFAE
Commented Oct 25, 2018 at 17:57