<s>[INST] calculate expected value of total number of offspring in second generation Suppose a plant has $X$ offspring per year with $P(X=k) = \frac{1}{4}$ for $k = 1,2,3,4.$
Independently, each offspring has from one to four offspring in the next year with the same discrete uniform distribution. Let $Y$ denote the total number of offspring in the second generation. How to calculate the values of $E(Y|X = k)$ for any outcomes of $X$.
 [/INST] Hint: Start with the definition of expected value:
$$ E[X] = \sum_{i = 1}^n {x*P[X = x]} .$$
If we add in the condition, this becomes:
$$ E[Y | X = x] = \sum_{i = 1}^n {y*P[Y = y | X = x]} .$$
Now, start by asking what happens if the plant has $X = 1$ offspring? There are four possibilities: $Y = 1, 2, 3, 4$. Each has probability $\frac{1}{4}$. So, that gives you the first part of your answer:
$$ E[Y | X = 1] = 1*\frac{1}{4} + 2*\frac{1}{4} + 3*\frac{1}{4} + 4*\frac{1}{4} = \frac{5}{2} .$$
Next, consider what happens when $X = 2$. Now, $Y = 1$ is not possible - each of the two plants in the first generation must have a minimum of $1$ offspring. So, okay, what about $Y = 2$? Well, that is possible. It happens if each of the first two has $1$ offspring, which has probability $\left(\frac{1}{4}\right)^2 = \frac{1}{16}$. Now, what about the probability that $Y = 3$? Well, that can happen two ways - the first offspring has $1$ and the second $2$, or vice versa. So, that probability is $2*\left(\frac{1}{4}\right)^2 = \frac{1}{8}$. The probability that $Y = 4$ is $3*\left(\frac{1}{4}\right)^2 = \frac{3}{16}$ - that's from offspring possibilities of $1$ and $3$, $2$ and $2$, or $3$ and $1$. Keep going through all possible values of $Y | X = 2$. Then, you'll be able to calculate
$$ E[Y | X = 2] = 2*\frac{1}{16} + 3*\frac{1}{8} + 4*\frac{3}{16} + ... $$
You can keep going this route and brute force your way through the problem, or look for a pattern, but that's how to start thinking about this problem.
</s>