Bernoulli Random Variables and Variance The question is:

Suppose $Z_1, Z_2, \ldots $ are iid $\operatorname{Bernoulli}\left(\frac{1}{2}\right)$ and let $S_n = Z_1 + \ldots +Z_n$. Let $T$ denote the smallest $n$ such that $S_n = 3$. Calculate $\operatorname{Var}(T)$.

What I know is that $\operatorname{Var}(T) = E(T^2) - E(T)^2$ but I am not sure how to calculate the expectation from the given information. Perhaps need to go through moment-generating function and the formula $M^{(r)}(0) = E(X^r)$?

You can compute the value of $\mathbb P(T=k)$ for each integer $k$. Since we deal with random variables which takes values either $0$ or $1$, the event $T=k$ is the same as $(S_{k-1}=2)\cap (Z_k=1)$. Now use independence, and what you know about the distribution of $S_n$ for $n\geqslant 1$.
