# Law of total variance and conditional probability. Exercise question

Classic setup -- given some coin with $$P(H) = 1-q$$ where $$q$$ is some random variable (RV) with $$f_Q(q)= 2q, 0 \le q \le 1$$ and $$0$$, otherwise. Assume conditioned on $$Q$$, each coin flip is independent.

1. Calculate P(H) given single toss, and
2. given some RV, $$Y_i$$ where $$Y_i=1$$ when coin toss is H, and $$0$$ otherwise. There are 30 days and within each day a coin is tossed, find $$Var(Z)$$ where $$Z=4(Y_1 + ...+ Y_{30})$$.

I have no problems with 1) having $$p_{H|Q}(h|q)$$ and $$f_Q(q)$$ I find joint $$f_{H,Q}(h,q)$$ and integrate over $$q$$., so $$p(H) = 1/3$$. I'm struggling with 2) -- I perfectly understand that I can find answer via law of total variance, namely $$Var(Z) = Var(E(Z|Q)) +E(Var(Z|Q))$$, but why I can't straight substitute value obtained in 1) and look at $$Y_i \sim Ber(\frac{1}{3})$$? What is the difference between these approaches? I though that via 1) I transform problem into sum of 30 iid Bernoulli rv's. But it seems not to be the case...

$$Y_i\sim \text{Ber}(1/3)$$ is correct, but $$Y_i$$ are not independent unless $$Q$$ is given. So, you can't distribute variance calculation over the sum. This dependence is broken inside the total variance formulas when $$Q$$ is assumed to be given.
• Thank you. But how $Y_i$ are dependent? Before coin toss I obtain it's bias and it stays the same for all 30 tosses. Also Q is given and is 1/3 (or 2/3). – Sharov Oct 30 '20 at 0:09
• No, when $Q$ is given $Y_i | Q$ is Ber(1-Q), but when it's not given, $Y_i$ is Bern with $1/3$. Q is not $2/3$ here. Hence, $Y_i$ are dependent since they have underlying Q common. – gunes Oct 30 '20 at 0:18
• Am I right that Q here is something like hidden\unobservable\latent variable? And so all $Y_i$ is correlated in this case? Once we explicitly depend on it they are no more correlated,correct? – Sharov Oct 30 '20 at 8:39
• Yes, and more precisely, once it's explicitly stated as given, $Y_i$ are not correlated any more. – gunes Oct 30 '20 at 8:55