Question:
You repeatedly and independently roll a fair die until the result of the roll is divisible by $3$.
Define the random variable X to be the number of times you roll the die.
For example, if the results of the rolls are $4, 5, 1, 4, 3$, then $X = 5$. What is the expected value $E(X)$ of $X$?
Answer: 3
Attempt:
The way I attempted this was:
The result of die roll: 1 2 3 4 5 6, only 3 and 6 are divisible by 3.
That is $Pr$ = $\frac{2}{6}$
For $E(X)$, I did $x$*$p(x)$ for all the possibilities.
So, ($\frac{1}{6}$ * 1) + ($\frac{1}{6}$ * 2) + ($\frac{2}{6}$ * 3) + ($\frac{1}{6}$ * 4) +($\frac{1}{6}$ * 5) + ($\frac{2}{6}$ * 6) = $5$
Not quite the answer though. When I do just ($\frac{2}{6}$ * 3) * ($\frac{2}{6}$ * 6) = $3$. Gives me the correct answer but I just don't understand the logic behind it.
Question:
Let $n$ $>=$ $2$ be an integer and let $a_1, a_2, ..., a_n$ be a uniformly random permutation of the set {1,2,...n}. Let $X$ be the random variable with value:
$X$ = the number of indices $i$ with 1 $<=$ i $<=$ $n-1$ and $a_i < a_{i+1}$
For example, if $n = 6$ and the permutation is $3, 5, 4, 1, 6, 2$ then $X = 2$. What is the expected value $E(X)$ of $X$? Use indicator variables.
Answer: $\frac{n-1}{2}$
I define my indicator variable:
$$ X = \left\{\begin{array}{rc} 1,&\text{the number of indices i with 1 $<=$ i $<=$ $n-1$ and $a_i < a_{i+1}$ }{} \\ 0,&\text{other cases}{}\end{array}\right. $$
For $n=2$: {1,2} , {2,1} so $Pr = $ $\frac{1}{2}$
$E(X) =$ $P(X_2) =$ $\frac{1}{2}$
For $n=3$: {1,2, 3} , {1,3,2} , {2,3,1} so $Pr = $ $\frac{3}{6}$
Is this the correct method to solve this? I did this for $n$ values but when I computed there result with the answers, I never got it to be the same. How do I solve this?
For the first question you started correctly, but then you drifted at the "all possibilities" part. You gotta realize, that technically you can be throwing that thing infinitely many times and never hit your $3$ or $6$.
Lets write down all the possible results and corresponding probabilities
Just $1$ throw: $P = \frac{1}{3}$. Pretty straightforward
$2$ throws: Now we fail once (probability of fail is $\frac{2}{3}$) and then succeed (probability of fail into success is, respectively $\frac{1}{3}*\frac{2}{3}$
$3$ throws: Now we fail twice (probability of fail twice is $(\frac{2}{3})^2$) and then succeed (probability of fail twice into success is, respectively $(\frac{2}{3})^2*\frac{1}{3}$
You can continue this to infinity. So lets write the expectation then.
$E[X] = 1*\frac{1}{3} + 2*\frac{1}{3}*\frac{2}{3} + 3*\frac{1}{3}*(\frac{2}{3})^2 + ...$
To figure out the result you factor $\frac{1}{3}$ first and then create infinitely many geometric series with a different start. The following expression is something like this:
$E[X] = \frac{1}{3}*( \frac{1}{1 - \frac{2}{3}} + \frac{\frac{2}{3}}{1 - \frac{2}{3}} + \frac{(\frac{2}{3})^2}{1 - \frac{2}{3}} + \frac{(\frac{2}{3})^3}{1 - \frac{2}{3}} ... = 1 + \frac{2}{3} + (\frac{2}{3})^2 + (\frac{2}{3})^3 + ... = \frac{1}{1 - \frac{2}{3}} = 3$