$X$=number of successes before 2nd failure in a seq of independent Bernoulli trials. pmf of $X$ and $\mathbb E[X]$ 
Let random variable $X$ denote the number of successes before the 2nd failure of a sequence of independent Bernoulli(p) trials. I need to describe the pmf of $X$ and calculate the expected value $\mathbb E[X]$

I tried the following:
$$f_X(x)=P(X=x)= \binom{x+2-1}x p^x (1-p)^{2-1} \cdot (1-p) = \binom{x+1}x p^x (1-p)^2$$
Is that correct?
How can i calculate $\mathbb E[X]$?
The hint given is that $$\sum_{k=1}^{\infty}kx^{k-1}=\frac{1}{(1-x)^2}, |x|<1$$ and $$\sum_{k=1}^{\infty}k^2x^{k-1}=\frac{x+1}{(1-x)^3}, |x|<1$$

Let $X_{1}$ denote the number of successes before the first failure
and let $X_{2}$ denote the number of successes between the first
failure and the second failure.
Then $X_{1}$and $X_{2}$ are independent and identically distributed
with $P\left(X_{i}=k\right)=p^{k}\left(1-p\right)$ for $i=1,2$.
Using the first hint for $i=1,2$ we find: $$\mathbb{E}X_{i}=\sum_{k=0}^{\infty}kp^{k}\left(1-p\right)=\left(1-p\right)p\sum_{k=1}^{\infty}kp^{k-1}=\frac{p}{1-p}$$
For a fixed nonnegative integer $k$ there are $k+1$ configurations
for a sequence that contains $k$ successes, $2$ failures and ends with a failure.
This allows us to find the PMF (not PDF): $$P\left(X=k\right)=\left(k+1\right)p^{k}\left(1-p\right)^{2}$$
Now we could go apply both hints and find: $$\mathbb{E}X=\sum_{k=0}^{\infty}k\left(k+1\right)p^{k}\left(1-p\right)^{2}=\left(1-p\right)^{2}p\left[\sum_{k=1}^{\infty}k^{2}p^{k-1}+\sum_{k=1}^{\infty}kp^{k-1}\right]=\frac{2p}{1-p}$$ 
But it is much more handsome to apply linearity of expectations: $$\mathbb{E}X=\mathbb{E}\left(X_{1}+X_{2}\right)=\mathbb{E}X_{1}+\mathbb{E}X_{2}=\frac{2p}{1-p}$$
Doing so we do not even need the second hint.
Actually also the first hint can be missed because it is obvious that:$$\mathbb{E}X_1=p\left(1+\mathbb{E}X_1\right)+\left(1-p\right)0=p+p\mathbb{E}X_1$$(do you see why?)
leading directly to: $$\mathbb{E}X_1=\frac{p}{1-p}$$
