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)$?

The moment generating function idea is in this case a good one. 
Let $T_1$ be the smallest $n$ such that $S_n=1$. More informally, $T_1$ is the waiting time until the first "success." Let $T_2$ be the waiting time from the first success to the second, and let $T_3$ be the waiting time from the second success to the third. 
Then the $T_i$ are independent and identically distributed, and $T=T_1+T_2+T_3$. Thus the moment generating function of $T$ is the cube of the mgf of $T_1$.
We proceed to find the mgf of $T_1$. So we want $E(
e^{tT_1})$. Note that $T_1=k$ with probablity $\frac{1}{2^k}$. So for the moment generating function of $T_1$ we want 
$$\sum_{k=1}^\infty \frac{1}{2^k}e^{tk},$$
This is an infinite geometric progression with first term $\frac{e^t}{2}$ and common ratio $\frac{e^t}{2}$. Thus the moment generating function of $T_1$ is
$$\frac{e^t}{2(1-\frac{e^t}{2})}.$$
Cube this to get the mgf of $T$, and use that mgf to find $E(T)$ and $E(T^2)$. 
Remark: The fact that the probabilities were $\frac{1}{2}$ was not of great importance. And neither was the fact that we are interested in the waiting time until the third success. 
Our $T$ has distribution which is a special case of the negative binomial. The method we used adapts readily to find the mgf of a general negative binomial.
