We have an unfair coin with a probability of 0.6 of obtaining a heads. Each flip is independent.

How many tails do you expect to see before getting three heads?

For example, imagine you see the third heads on the tenth trial. This would mean you have seen 2 heads in the first 9 trials followed by a heads on the tenth. Then your answer would be observing 7 tails. Generalize this to the i^th trial.

I am not sure where to go from here. My thinking is somewhere along the lines of a negative binomial but I cannot seem to get it to work correctly.

$$P(X=r) = 
\begin{pmatrix}
n-1\\
r-1
\end{pmatrix}
p^rq^{k-r}
$$
$$
E(X) = 
\sum\_{x}^n xP(X=x)\\
E(X) = 
\sum\_{x}^n x
\begin{pmatrix}
n-1\\
r-1
\end{pmatrix}
p^rq^{k-r}
$$

My alternative was to use geometric distribution:

$$P(X=x) = 
q^{x-q}p
$$
$$
E(X) = 
\sum\_{x}^n xP(X=x)\\
E(X) = 
\sum\_{x}^n x
q^{x-q}p
$$

However I am not sure if this is correct. Additionally I am not sure how to address k if this is correct.