# Calculating total probability given some conditions

One machine element is being produced in $3$ series, each series consisting of $20$ elements. In the first series, there are $15$ elements that work correctly, in the second series there're $18$ and in the third series there are $16$. A series is randomly picked, and a single element is also randomly picked from the chosen series. The picked element was one that works correctly. Now this element is returned to the series it was picked from, and from the same series another element is picked. What is the probability that the last picked element is a correctly working one?

(The probability to pick a series is $1/3$)

Where I am stuck at:

I can easily calculate the probability for the first element( simple matter of applying total probability formula ). What I am stuck with, is the second part and the actual answer to this task. I have no idea how to approach this kind of problem, so any answer is highly appreciated.

• en.wikipedia.org/wiki/Bayes'_theorem will help you convert from probability working given which series to instead probability of series given that it is working. Jun 3, 2016 at 18:01
• @JMoravitz how does this help me? Jun 3, 2016 at 18:47

Let us define some events in order to clean up notation a bit. Let $W_1,W_2$ be the events that the first element works and second element works respectively. Let $S_1,S_2,S_3$ be the events that we are pulling items from series $1,2$ and $3$ respectively.

The problem asks us "What is the probability that a second element drawn from the same series as the first also works given that the first element works"

I.e. find $Pr(W_2\mid W_1)$

We know that $Pr(W_2\mid W_1)=Pr(W_2\cap S_1\mid W_1)+Pr(W_2\cap S_2\mid W_1)+Pr(W_2\cap S_3\mid W_1)$

We know further that $Pr(W_2\cap S_1\mid W_1)=Pr(S_1\mid W_1)Pr(W_2\mid S_1\cap W_1)$. Similarly for the other terms.

We know very easily how to calculate $Pr(W_2\mid S_1\cap W_1)$. In the case that we are pulling elements with replacement, it will be $\frac{15}{20}$. If we are pulling elements without replacement, it will be $\frac{14}{19}$. It was slightly ambiguous whether the item drawn initially is able to be drawn a second time, but the grunt work details is unimportant here.

Similarly, we can calculate $Pr(W_2\mid S_2\cap W_1)$ and $Pr(W_2\mid S_3\cap W_1)$

The only pieces of information that we are truly missing to complete our calculations are $Pr(S_1\mid W_1), Pr(S_2\mid W_1)$ and $Pr(S_3\mid W_1)$. Each of these can be found via Baye's Theorem.

$$Pr(A\mid B) = \frac{Pr(B\mid A)Pr(A)}{Pr(B)}$$

In this case, $Pr(S_1\mid W_1) = \frac{Pr(W_1\mid S_1)Pr(S_1)}{Pr(W_1)}$

We know $Pr(W_1\mid S_1)$ is $\frac{15}{20}$, and we know $Pr(S_1)=\frac{1}{3}$. To continue we need to find $Pr(W_1)$

To do so, we note that $Pr(W_1)=Pr(W_1\cap S_1)+Pr(W_1\cap S_2)+Pr(W_1\cap S_3) \\= Pr(S_1)Pr(W_1\mid S_1)+Pr(S_2)Pr(W_1\mid S_2)+Pr(S_3)Pr(W_1\mid S_3)$

Each of these pieces of information are known.

Completing all of the necessary tedious arithmetic and plugging back into the necessary formulae will complete the problem.

• Pr(W2∣S1∩W1) Wouldn't this be 15/20 squared? Jun 3, 2016 at 19:05
• @Hydroxis no. $Pr(W_2\mid S_1\cap W_1)$ is the probability that the second works given that we are working with series 1 and the first draw was already one that works. The first has already been drawn. It has already happened. There is no changing that. The only thing left to ask is the probability that the next is also working. $(\frac{15}{20})^2$ is $Pr(W_1\cap W_2\mid S_1)$, something different. Jun 3, 2016 at 19:06
• If I give you a fair coin and ask you what the probability that the next time you flip it it comes up heads, it is one in two chance. If I told you I used the coin earlier in the day, does that change that fact? If I told you earlier in the day I flipped a head, does that change that fact? It doesn't suddenly drop to $\frac{1}{4}$. Jun 3, 2016 at 19:09
• I think the analogy would be getting a head twice in a row? Jun 3, 2016 at 19:11
• Also, Pr(W2∣W1) Wouldn't this be equal to Pr(W1 | W2) * Pr(W2) / Pr(W1) ? Jun 3, 2016 at 19:40

Let $A_i$ be the event were our ith picking yields a working element. Also let $S$ be the chosen series, with values $a, b, c$, for the series with $15, 18, 16$ working elements, respectively. Then we can see that:

$$P(A_i|_{S=a}) = \frac{15}{20}, P(A_i|_{S=b}) = \frac{18}{20}, P(A_i|_{S=c}) = \frac{16}{20}$$

With those values we can obtain the probability of $A_i$ without conditions:

$$P(A_i) = P(A_i \cap S=a) + P(A_i \cap S=b) + P(A_i \cap S=c)$$ $$P(A_i) = \frac{P(A_i|_{S=a})}{3} +\frac{P(A_i|_{S=b})}{3} + \frac{P(A_i|_{S=c})}{3} = \frac{49}{60}$$

So then, by using Bayes' Theorem, we can get the probability that the pieces are from a specific $s$ series, knowing that the first element was good:

$$P(S=s|_{A_1}) = \frac{P(A_1|_{S=s})P(S=s)}{P(A_1)}$$ $$P(S=a|_{A_1}) = \frac{15}{49}, P(S=b|_{A_1}) = \frac{18}{49}, P(S=c|_{A_1}) = \frac{16}{49}$$

Now, i'll also calculate this in advance since we'll need it. By using the chain rule:

$$P(A_2 \cap S=s |_{A_1}) = P(A_2|_{S=s \cap A_1})P(S=s|_{A_1})$$

But if we assume $S=s$ then $A_2$ and $A_1$ are independent, so: $$P(A_2 \cap S=s |_{A_1}) = P(A_2|_{S=s})P(S=s|_{A_1})$$ $$P(A_2 \cap S=a |_{A_1}) = \frac{225}{980}, P(A_2 \cap S=b |_{A_1}) = \frac{324}{980}, P(A_2 \cap S=c |_{A_1}) = \frac{256}{980}$$

And now, finally, the result we want:

$$P(A_2|_{A_1}) = P(A_2 \cap S=a |_{A_1}) + P(A_2 \cap S=b |_{A_1}) + P(A_2 \cap S=c |_{A_1}) = \frac{805}{980}$$

We can observe that it is slightly higher than $49/60$.

• Halfway through you lost me with your notation. Jun 3, 2016 at 19:24