<s>[INST] Expected value of rolling dice until getting a $3$ I am having trouble with this question with regards to random variables and calculating expected values:

Suppose I keep tossing a fair six-sided dice until I roll a $3$. Let $X$ be the number of times I roll the dice. What is the value of $E[X]$?

So for this problem I was thinking that the answer would just be $1$. Here is my thought behind it. 
For each turn there is a $1/6$ chance of hitting a three. If I keep rolling and rolling I will eventually hit a $3$. So the math works out to be $(1/6)*6$ which is equal to $1$. Does this logic make sense? I am a bit confused with how exactly I would go about picking the values for $P(X=x)$ and how to calculate expected value. Some insight would be very helpful. 
 [/INST] A solution without calculus:
$E[x]$ is simply the sum of the number of rolls times the probability that this number of rolls have occurred. If exactly $n$ rolls occur before one stops, then one must roll something other than $3$ $n-1$ times, and then a $3$ $1$ time. The probability of this happening is
$$
\left(\frac{5}{6}\right)^{n-1}\cdot\left(\frac{1}{6}\right)
$$
And thus we want to compute
$$
E[x]=\frac{1}{6}\cdot \sum_{n=1}^{\infty} n\left(\frac{5}{6}\right)^{n-1}
$$
So
$$
\frac{5}{6}E[x]=\frac{1}{6}\cdot \sum_{n=1}^{\infty} n\left(\frac{5}{6}\right)^n=\frac{1}{6}\sum_{n=2}^{\infty} (n-1)\left(\frac{5}{6}\right)^{n-1}=\frac{1}{6}\sum_{n=2}^{\infty}n\left(\frac{5}{6}\right)^{n-1}-\frac{1}{6}\sum_{n=2}^{\infty}\left(\frac{5}{6}\right)^{n-1}
$$
$$
=E[x]-\frac{1}{6}-\frac{1}{6}\cdot \frac{5}{6}\cdot\frac{1}{1-\frac{5}{6}}=E[x]-\frac{1}{6}-\frac{5}{6}=E[x]-1
$$
But then $\frac{1}{6}E[x]=1$, so $E[x]=6$.
</s>