Question: Let X have PMF $$P(X=k)=-\frac{1}{log(1-p)} \frac{p^k}{k} $$ for k=1,2,..... Here p is a parameter with $0<p<1$. Find the mean and variance of X
I was able to calculate the mean and got $E(X)=\frac{p}{((p-1)log(1-p))}$. I'm getting confused as to how to calculate $Var(X)$, in particular how to calculate $E(X^2)$. Should we square both k and the $P(X=k)$ terms in the expectation?
No: the definition of expectation is $$E[f(X)] = \sum_{k} f(k) P(X=k).$$ So the sum should be $$ E[X^2] = \sum_{k \geq 1} k^2 \frac{-1}{\log{(1-p)}} \frac{p^k}{k}. $$