Variance of product of two random variables I’m trying to calculate the variance of a function of two discrete independent functions.
The first function is $f(x)$ which has the property that: 
$$\Bbb{P}(f(x)) =\begin{cases} 0.243 & \text{for}\ f(x)=0 \\ 0.306 & \text{for}\ f(x)=1 \\ 0.285 & \text{for}\ f(x)=2 \\0.139 & \text{for}\ f(x)=3 \\0.028 & \text{for}\ f(x)=4 \end{cases}$$
The second function, $g(y)$, returns a value of $N$ with probability $(0.402)*(0.598)^N$, where $N$ is any integer greater than or equal to $0$. (Imagine flipping a weighted coin until you get tails, where the probability of flipping a heads is 0.598. $N$ would then be the number of heads you flipped before getting a tails.)
I have a third function, $h(z)$, which is similar to $g(y)$ except that instead of returning N as a value, it instead takes the sum of N instances of $f(x)$. How can I generate a formula to find the variance of this function? On the surface, it appears that $h(z) = f(x) * g(y)$, but this cannot be the case since it is possible for $h(z)$ to be equal to values that are not a multiple of $f(x)$. (If $g(y)$ = 2, the two instances of $f(x)$ summed to evaluate $h(z)$ could be 4 and 1, the total of which, 5, is not divisible by 2.)
I have calculated E(x) and E(y) to equal 1.403 and 1.488, respectively, while Var(x) and Var(y) are 1.171 and 3.703, respectively.
 A: In more standard terminology, you have two independent random variables: $X$ that takes on values in $\{0,1,2,3,4\}$, and a geometric random variable $Y$. Then, $Z$ is defined as $$Z = \sum_{i=1}^Y X_i$$ where the $X_i$ are independent random 
variables with the same distribution as $X$. Thus, conditioned on the event $Y=n$,
$Z=\sum_{i=1}^n X_i$, and so $E[Z\mid Y=n] = n\cdot E[X]$ and $\operatorname{var}(Z\mid Y=n)= n\cdot\operatorname{var}(X)$. The random variables $E[Z\mid Y]$
and $\operatorname{var}(Z\mid Y)$ are thus equal to $Y\cdot E[X]$ and
$Y\cdot \operatorname{var}(X)$ respectively. These are just multiples
of $Y$.
The conditional variance formula gives 
$$\begin{align}
\operatorname{var}(Z) &= E\left[\operatorname{var}(Z \mid Y)\right]
+ \operatorname{var}\left(E[Z\mid Y]\right)\\
&= E\left[Y\cdot \operatorname{var}(X)\right]
+ \operatorname{var}\left(Y\cdot E[X]\right)\\
&= E[Y]\cdot \operatorname{var}(X) + \left(E[X]\right)^2\operatorname{var}(Y).
\end{align}$$
See Example 5p in Chapter 7 of Sheldon Ross's A First Course in Probability,
8th edition.
