This is a discrete math problem, $\mathbb{E}(X)$ is the expected value of $X$: Let $X$ be a random variable with $P(X=k)=(1-p)^kp$, $k=0,1,2,3,\ldots$, $0 \leq p \leq 1$. Show that $\mathbb{E}(X)=\frac{1-p}{p}$.
I think we're supposed to use generating functions. So far, I have $\mathbb{E}(X)=\sum_{k=0}^{\infty}(k(1-p)^k p)$=$0+(1-p)p+2(1-p)^2 p+3(1-p)^3 p + \ldots $. To try and construct that sequence: $\frac{1}{1-(1-p)}=\frac{1}{p}=1+(1-p)+(1-p)^2+(1-p)^3+(1-p)^4+\ldots$.
The derivative of $\frac{1}{p}$ is $-\frac{1}{p^2}=(1-p)+2(1-p)^2+3(1-p)^3 + \ldots$, so multiply by $p$ to get $p$ in every term, $-\frac{p}{p^2}=-\frac{1}{p}=(1-p)p+2(1-p)^2 p+3(1-p)^3 p + \ldots$, but that would mean $\mathbb{E}(X)=-\frac{1}{p}$, so I must have made a mistake somewhere. I think maybe the last step where I multiplied by $p$ to multiply every term by $p$, am I allowed to do that if $p$ isn't a constant?
I would recommend you to notice that:
\begin{align*} \sum_{k=0}^{\infty}k(1 - p)^{k}p & = \sum_{k=1}^{\infty}k(1 - p)^{k}p = p(1 - p)\sum_{k=1}^{\infty}k(1 - p)^{k-1} \end{align*} where the last series resembles the derivative of a geometric series.
Indeed, if $|x| < 1$, the next series converges: \begin{align*} \sum_{x=0}^{\infty}x^{n} = 1 + x + x^{2} + \ldots = \frac{1}{1 - x} \end{align*}
Differentiating both sides, we get that: \begin{align*} \sum_{n=1}^{\infty}nx^{n-1} = 1 + 2x + 3x^{2} + \ldots = \frac{1}{(1 - x)^{2}} \end{align*} which is exactly what we are looking for. Gathering the previous results, it yields that: \begin{align*} \sum_{k=0}^{\infty}k(1 - p)^{k}p = p(1 - p)\frac{1}{(1 - (1 - p))^{2}} = \frac{1 - p}{p} \end{align*} just as desired.
Hopefully this helps!