What will be $E(X)$ and $Var(X)$? Given a discrete random variable
$$P(X = k) = \frac{1}{2^k}, \ \ \ k=1,2,...$$
How to calculate the expected value and Variance of $X$?

Let $E(x)=\sum_{k=1}^\infty kx^k$ and $D(x)=\sum_k x^k$. Then
$$
E(x)+D(x)=\sum_k(k+1)x^k=\frac{d}{dx}\left(\sum_{k=1}^\infty x^{k+1}\right)=\frac{d}{dx}\frac{x^2}{1-x}=\frac{x(2-x)}{(1-x)^2}\cdot
$$
In particular,
$$
E(0.5)=\frac{0.5(2-0.5)}{(1-0.5)^2}-D(0.5)=3-1=2.
$$
This takes care of the expectation. Similarly, let $F(x)=\sum_{k=1}^\infty k^2x^k$. Then:
$$
F(x)+3E(x)+2D(x)=\sum_k(k+1)(k+2)x^k=\frac{d^2}{dx^2}\left(\sum_{k=1}^\infty x^{k+2}\right)=\frac{d^2}{dx^2}\frac{x^3}{1-x}=\frac{2x(-3+3x-x^2)}{(1-x)^3}.
$$
And so
$$
F(0.5)=\frac{2(0.5)(-3+1.5-0.5^2)}{(1-0.5)^3}-3E(0.5)-2D(0.5)=14-6-2=6.
$$
The variance is thus $6-2^2=2$.
