In a dark room there is a box with 8 red and 5 black socks, calculate expectation In a dark room there is a box with 8 red and 5 black socks, socks are removed from the box until two red socks appear. The random variable $X$ is the number of socks removed for this purpose, make table of distribution of the values of this random variable and calculate its mathematical expectation 
this my solution :
$ P(\text{one black sock})=5/13 $ 
$ P(\text{two black socks})=4/13 $ 
$ P(\text{three black socks})=3/13 $ 
$ P(\text{four black socks})=2/13 $ 
$ P(\text{five black socks})=1/13 $ 
$ P(\text{one red sock})=8/13 $ 
$ P(\text{two red socks})=7/13 $ 
$ E(x) = 5/13 * 0 + 4/13 * 0 + 3/13 * 0 + 2/13 * 0 + 1/13 * 0 + 8/13 * 1 + 2 * 7 /13 $ 
Is that right ? 
 A: Hint:
The possible outcomes for your experiment are:


*

*The second red sock was drawn on the second pull (meaning that both the first and second pulls were both red, i.e. RR)

*The second red sock was drawn on the third pull (meaning that among the first two pulls one was red and the other black, while the third pull was red, i.e. either RBR or BRR)

*The second red sock was drawn on the fourth pull (meaning that among the first three pulls one was red and the other two black, while the fourth pull was red, i.e. either RBBR, BRBR, or BBRR)

*$\vdots$

*The second red sock was drawn on the seventh pull (meaning that among the first six pulls one was red and the other five black, while the seventh pull was red, i.e. either RBBBBBR, BRBBBBR, ..., or BBBBBRR)


 The probability that the second red sock was drawn on the $x$'th pull would be $\dfrac{\binom{5}{x-2}\binom{8}{1}}{\binom{13}{x-1}}\cdot \dfrac{7}{13-(x-1)}$.  Be sure to stop and understand why.

A: You need to calculate $P(X=n)$ for each value of $n$. That is, what is the probability that it takes $n$ draws to see two red socks. This happens if and only if the first $n-1$ socks consist of $n-2$ black socks and $1$ red sock, and the $n$th draw is a red sock.
We must have $P(X=1)=0$ because you cannot draw the second red sock on the first draw. In addition, $P(X=n)=0$ for $n > 7$ because there are only 5 black socks, so we must have drawn at  least two red socks by the 7th draw.
If $n>1$, we have
\begin{align*}
P(X=n)&=P(\text{first $n-1$ draws have 1 red sock}, \text{$n$th draw is red})\\
&=P(\text{first $n-1$ draws have 1 red sock})\cdot P(\text{$n$th draw red}|\text{first $n-1$ draws have 1 red sock}).
\end{align*}
Now for the first probability, we can use counting techniques. There are $n-1$ choices for which of the first $n-1$ draws is the red sock. There are $8$ choices for which red sock is chosen, and there are $5\cdot 4\cdots (5-(n-3))$ choices for which black socks are chosen. (Again, this is only valid for $n \leq 7$.) In total there are $13 \cdot 12 \cdots (13-(n-2))$ ways to choose $n-1$ socks. So this gives us a probability of $\frac{(n-1)\cdot 8 \cdot 5 \cdot 4 \cdots (5-(n-3))}{13\cdot 12 \cdots (13-(n-2))}.$
For the second (conditional) probability, there are $7$ red socks left to choose from and $13-(n-1)$ socks left to choose from, so we get $\frac{7}{13-(n-1)}$.
Multiplying these together gives $P(X=n)$. Finally, you can compute $E[X]=\sum_{n=2}^7 n\cdot P(X=n)$. 
A: You have:

$ E(x) = 5/13 *1 + 4/13 *2 + 3/13 * 3 + 2/13 * 4 + 1/13 * 5 + 8/13 * 1 + 2 * 7 /13 $

Well ... I recognize that you are trying to separate into cases, and then multiply the probabilities for each case by the number of socks drawn .. so that's good .... but the execution leaves a lot to be desired. 
Yes, there are several ways in which you can get to $2$ red socks:


*

*You can draw the $2$ red socks as your first $2$ socks

*You can draw the second red sock as your third sock, i.e. you draw a red one and a black one as your first two (in any order), and then you draw a second red sock as your third sock

*You can draw the second red sock as your fourth sock, i.e. you draw one red one and two black ones as your first three (in any order), and then you draw a second red sock as your fourth sock
... [all the way to:]


*You can draw the second red sock as your seventh sock, i.e. you draw one red one and all five black ones as your first six (in any order), and then you draw a second red sock as your seventh sock


... So again, I want to give you some credit and say that I vaguely recognize these cases in your formula ... but:


*

*First, your probabilities are off. For example, I assume that your $p(twoBlackSocks)$ is suposed to be the probability of drawing two black sock as your first two socks. Now, first of all, that should be $\frac{5}{13} \cdot \frac{4}{12}$, rather than $\frac{4}{13}$, because you would have to draw a black sock as your first sock (probability $\frac{5}{13}$), and then draw a second black sock as your second (probability $\frac{4}{12}$, because after the first black sock is taken out, there are $4$ black socks out of $12$ sockas total left).

*Second: $p(twoBlackSocks)$ is not even a probability you are interested in in the first place if you use the above scheme. Rather, you want to figure pout something like $P(SecondRedSockDrawnasThirdSock)$ or (what is the same thing) $P(DrawingOfRedSockIsPrecededByDrawingOfOneRedAndOneBlackSock)$

*Third, the multipliers should be the total of number of socks drawn. I see that in your formula you multiply the $\frac{5}{13}$ by $1$, but if you first draw one black sock, and then the two red ones, then you have a total of $3$ socks drawn, and so you need to multiply by $3$
In sum, your formula should look something like:
$E(x) = P(SecondRedSockDrawnAsSecondSock) \cdot 2 + P(SecondRedSockDrawnAsThirdSock) \cdot 3 + ...$
And, just to get you started, let's calculate $P(SecondRedSockDrawnAsThirdSock)$:
Again, this is the probability of drawing a red ock after having drawn one red and one black sock, but in any order. So, if we use:
$P(BRR)$ (probability of drawing, in succession, black, then red, then red)
$P(RBR)$ (probability of drawing, in succession, red, then black, then red)
then we have:
$P(SecondRedSockDrawnAsThirdSock) = P(BRR) + P(RBR)$
where 
$P(BRR) = \frac{5}{13} \cdot \frac{8}{12} \cdot \frac{7}{11}$
and
$P(RBR) = \frac{8}{13} \cdot \frac{5}{12} \cdot \frac{7}{11}$
Now, note that you get very similar denominators and numerators, and indeed there are more efficient formulas for this ... as a shown in some of the other answers.  But this is the basic idea. Good luck!
A: Note that $X$ is the minimum number of draws needed to obtain $2$ red socks (without replacement). Hence, to say that $X=k$ means that in the first $k-1$ draws we obtained exactly one red sock and then on the subsequent $k$th draw we obtained a red sock. Hence
$$
P(X=k)=\frac{\dbinom{8}{1}\dbinom{5}{k-2}}{\dbinom{13}{k-1}}\times \frac{7}{13-k+1}\quad (k=2,\dotsc,7)
$$
where the first term in the product corresponds to probability of obtaining exactly one red sock in $k-1$ draws and then the second term corresponds to obtaining a red sock on the next draw. I leave it to you to compute the expectation. 
