Variance of a random number of Bernoulli trials Toss a fair die and let $N$ be the outcome. Next, throw a coin $N$ times. Then, we denote $S$ the number of heads gotten. What is the expectation and the variance of $S$?
I tried defining the variable $S$ as $S = N*S_i$, where $S_i$ is toss $i$.
Then by independence of $N$ and $S_i I$ got the expectation as follows: $E[S] = E[N]E[S_i] = 3.5 * 0.5 = 1.75$.
For the variance also by independence: 
$$Var[S] = (E[N]^2) * Var[S_i] + (E[S_i]^2) Var[N] + Var[S_i]Var[N] \\= (3.5^2) * 0.5(1-0.5) + (0.5^2) * (35/12) + (35/12) * 0.5(1-0.5) = 4 25/48.$$
However, the solution model says that it should be $77/48$, so I think i'm tackling the problem the wrong way.
 A: Let $N$ be the number on the fair die and $X$ the number of Heads on one toss of the coin. Then $$E(S) = E(N)E(X) = (7/2)(1/2) = 7/4$$ as you say.
However, $$Var(S) = E(N)Var(X) + Var(N)[E(X)]^2 = 77/48,$$ as the answer key says. I will let you fill in the details of this formula. [The random variable $S$ amounts to a randomly chosen binomial with $N$ trials and $p=1/2.$]
A simulation of a million such experiments matches correct answers to two or
three significant digits.
set.seed(425)
s = replicate(10^6, rbinom(1,sample(1:6, 1), 1/2))
mean(s);  var(s)
## 1.748882  # aprx E(S) = 7/4 = 1.75
## 1.601607  # aprx Var(S) = 77/48 = 1.604167

Below is a histogram of the simulated distribution of $S.$ With $E(N) = 3.5,$
You might guess that this distribution would be something like
that of $\mathsf{Binom}(3, .5)$ with variance 3/4 or $\mathsf{Binom}(4, .5)$
with variance 1, but
results are much more variable because of the variability of $N.$
[Red dots show the distribution of $\mathsf{Binom}(4, .5)$.]

