We have a $6$-sided dice, where $3$ sides are yellow, $2$ are red and $1$ is blue. We throw dice untill the red side appears $3$ times (not necessarly in a row), but no more than 6 times. Find expected value of number of throws.
My attempt:
$\mathbf{P}\left(X=0\right)=\mathbf{P}\left(X=1\right)=\mathbf{P}\left(X=2\right)=0 \\ \mathbf{P}\left(X=3\right)=\left(\frac{1}{3}\right)^3=\frac{1}{27} \\ \mathbf{P}\left(X=4\right)=\left(\frac{1}{3}\right)^3\cdot{4\choose3}\cdot\frac{2}{3}=\frac{8}{81} \\ \mathbf{P}\left(X=5\right)=\left(\frac{1}{3}\right)^3\cdot{5\choose3}\cdot\left(\frac{2}{3}\right)^{2}=\frac{40}{81} \\ \mathbf{P}\left(X=6\right)=\left(\frac{1}{3}\right)^3\cdot{6\choose3}\cdot\left(\frac{2}{3}\right)^{3}=\frac{\frac{160}{9}}{81} \\ \mathbf{E}X=\sum_{i=3}^6i\cdot\mathbf{P}\left(X=i\right)=\dots=4\frac{71}{243} $
Is this solution correct? I used Bernoulli scheme here.
You are heading in the good way! Yet, there are some mistakes. It's going wrong from $X>3.$ You multiply by $\binom{4}{3}$, but this is not right. If you do so, you not only allow sequences like $\not R\not R\not RR$, but also $RRR\not R$, which should not be allowed. The correct expression for $\mathbb{P}(X=4)=3\ \left(\frac{1}{3}\right)^3\left(\frac{2}{3}\right)$. Or in general (for $n>3)$: $\mathbb{P}(X=n)=(n-1)\left(\frac{1}{3}\right)^3\left(\frac{2}{3}\right)^{n-3}$.
Extra: a nice exercise might be to find the expectancy if we do not restrict to 6 throws, we keep rolling on until we have three times red. A hint I provide: you have to realise that $\sum_{j=1}^{\infty} (n-1)\left(\frac{2}{3}\right)^{n-2}=\left[\sum_{j=0}^{\infty} \left(\frac{2}{3}\right)^{n-1}\right]'=\frac{3}{2}\frac{1}{\left(1-\left({\frac{2}{3}}\right)\right)^2}$