Using distribution properties to find the exact value of the following sum $\sum_{x=1}^\infty \frac{x^2}{2^x}$
I believe I should be using geometric properties. So I'm trying to get it to resemble
$\sum_{x=1}^\infty xp(1-p)^{x-1}$
But I can't seem to manipulate it how I'd like. Am I incorrect in assuming it's closest to a geometric distribution?
I've also tried resembling a binomial, which would get me
$2\sum_{x=1}^\infty x^22^{1-x}$
But I don't know where to obtain a $p$ from. Also, doesn't $(1-p)$ need to be $\leq 1$?
 A: Let random variable $X$ have geometric distribution, parameter $p=1/2$. Then
$$E(X^2)=\sum_{x=1}^\infty \frac{x^2}{2^x}.\tag{1}$$
Now recall that $X$ has mean $\frac{1}{p}$ and variance $\frac{1-p}{p^2}$. Also, 
$$\text{Var}(X)=E(X^2)-(E(X))^2.$$
Thus $E(X^2)=\frac{1-p}{p^2}+\frac{1}{p^2}=\frac{2-p}{p^2}$.
Finally, put $p=1/2$, and we have found the sum on the right-hand side of (1). 
Using the same idea, we can find $\sum_1^\infty (x^2)(p(1-p)^{x-1})$ and related sums.
A: Just using basic algebra.
Consider $$A=\sum_{x=1}^\infty xp(1-p)^{x-1}=p\sum_{x=1}^\infty x(1-p)^{x-1}$$ and notice that this looks as a derivative with respect to $p$ of something looking like $(1-p)^x$. So $$\frac d {dp} (1-p)^x=-x (1-p)^{x-1}$$ This makes $$A=-p\frac d {dp}\Big(\sum_{x=1}^\infty  (1-p)^x\Big)$$ where you see terms in geometric progression. So $$\sum_{x=1}^\infty  (1-p)^x=\frac{1-p}{p}$$ $$\frac d {dp}\Big(\sum_{x=1}^\infty  (1-p)^x\Big)=\frac d {dp}\Big(\frac{1-p}{p}\Big)=-\frac{1}{p^2}$$ So $$A=\frac{1}{p}$$
If instead you had $$B=\sum_{x=1}^\infty x^2p(1-p)^{x-1}=p\sum_{x=1}^\infty x^2(1-p)^{x-1}$$ you could rewrite $$x^2=x(x-1)+x$$ and then $$\sum_{x=1}^\infty x^2(1-p)^{x-1}=\sum_{x=1}^\infty x(x-1)(1-p)^{x-1}+\sum_{x=1}^\infty x(1-p)^{x-1}$$ $$\sum_{x=1}^\infty x^2(1-p)^{x-1}=(1-p)\sum_{x=1}^\infty x(x-1)(1-p)^{x-2}+\sum_{x=1}^\infty x(1-p)^{x-1}$$ where now you see terms looling like the first and second derivative of $\frac{1-p}{p}$.
I am sure that you can take from here and make the problem as general as you wish.
