how to find expected value? The random variables X and Y have joint probability function $p(x,y)$ for $x = 0,1$ and 
$y = 0,1,2$. 
Suppose $3p(1,1) = p(1,2)$, and $p(1,1)$ maximizes the variance of $XY$. 
Calculate the probability that $X$ or $Y$ is $0$. 
Solution: Let $Z = XY$. Let $a, b$, and $c$ be the probabilities that $Z$ takes on the values $0, 1$, and $2$, respectively. 
We have $b = p(1,1)$ and $c = p(1,2)$ and thus $3b = c$. And because the probabilities sum to $1,  a = 1 – b – c = 1 – 4b$.  
Then, $$E(Z) = b + 2c = 7b,$$$$ E(Z\cdot Z) = b + 4c = 13b.$$ Then, $$Var (Z) = 13b-19b^2.$$$$ \frac{dVar(Z)}{db}=13-98b=0 \implies b =\frac{ 13}{98}.$$ The probability that either $X$ or $Y$ is zero is the same as the probability that $Z$ is $0$ which is as $a = 1 – 4b = \frac{46}{98} = \frac{23}{49}$. 
I am not sure how they got: $E(Z) = b + 2c = 7b$. Can someone explain this step where $b$ and $2c$ come from?

\begin{align}\mathbb{E}(Z)&=0\cdot P(Z=0)+1\cdot P(Z=1)+2\cdot P(Z=2)\\
&=1\cdot P(Z=1)+2\cdot P(Z=2)\\
&=1\cdot P(X=1,Y=1)+2\cdot P(X=1,Y=2)\\
&=b+2c
\end{align}
