Find the expected value and variance of $f\left(x\right)=\left(\frac{1}{2}\right)^{x}x=1,2,3,\ldots$ Find the expected value and variance of $f\left(x\right)=\left(\frac{1}{2}\right)^{x}x=1,2,3,\ldots$ where $X$ is a discrete random variable. I try
$E\left[X\right]=\sum_{i=1}^{k}x_{i}f\left(x_{i}\right)=\sum_{i=1}^{\infty}x_{i}\left(\frac{1}{2}\right)^{x_{i}}=1\cdot\left(\frac{1}{2}\right)+2\cdot\left(\frac{1}{2}\right)^{2}+3\cdot\left(\frac{1}{2}\right)^{3}+\cdots$
$$E\left[X\right]=1\cdot\left(\frac{1}{2}\right)+2\cdot\left(\frac{1}{2^{2}}\right)+3\cdot\left(\frac{1}{2^{3}}\right)+\cdots$$
That sum converges to $2$, so $$E\left[X\right]=2$$
$Var\left(X\right)=E\left[\left(X-\mu\right)^{2}\right]=E\left[X^{2}\right]-E\left[X\right]^{2}$
$E\left[X^{2}\right]=\sum_{i=1}^{\infty}x_{i}^{2}\left(\frac{1}{2}\right)^{x_{i}^{2}}\approx0.7678$
$E\left[X\right]^{2}=4$
Not sure if those are the right steps in order to solve the problem.I know is wrong due to the negative resulting variance.

Let there be a function of a random variable $X$ denoted by $g(X)$. If you want to calculate the expected value you write:
$$E[g(X)] = \sum_{i=1}^{k} g(x_i)f(x_i)$$
In your case this $f(x)$ is the PDF. So if you want to find $E(X^2)$ you write:
$$E(X^2)=\sum_{i=1}^{k}x_i^2f(x_i) = \sum_{i=1}^{k}x_i^2\left(\frac{1}{2}\right) ^{x_i}$$
Hope this helps...
