I have given a process which returns value 1 with probability $(1-k)$ such that $(0<=k<=1)$ and value $0$ with probability $k$. I wanted to calculate variance for random variable $X$ denoting returns of this process.
I calculated it as follows:
$\mathbb{E}(X)=\sum xp=(1-k).1+k.0=1-k$
$\mathbb{E}(X^2)=\sum xp=(1-k).1^2+k.0=1-k$
$Var(X)=\mathbb{E}(X^2)-(\mathbb{E}(X))^2 = 1-k-(1-k)^2 = 1-k-1+2k-k^2 = k(1-k)$
Now the process is modified to return value $1$ any number of times, each time with the same probability $(1-k)$ and then it can return value $0$ only once with probability $k$. That is the values returned can take form $1,1,...,1,1,0$. The process stops after returning value $0$. There is no limit on how many 1's the process can return. How can I modify above calculations to calculate variance for random variable representing value returned by this modified process? Also are above calculations indeed correct?