Multiplication rule question

Screen Link:
https://app.dataquest.io/m/1016/solving-complex-probability-problems%3A-practice-problems/3/mixed-probability-problems-2

My Code:

p_history = 0.07

p_nonhistory = 1 - p_history 
p_nonhistory_3 = p_nonhistory**3
p_history_4_or_more = p_nonhistory**3

Confused about the answer to the second part of this exercise (pasted below).

A library has a stock of 2,701 books. If we sample randomly and with replacement a book from the library, the probability of taking a history book is 0.07 every time we perform the random experiment. Calculate:

  1. The probability that we don’t take any history book in the first three draws. Assign your answer to p_nonhistory_3 .
  2. The probability that it takes four draws or more to get a history book from the library. Assign your answer to p_history_4_or_more .

I checked the solution for #2. It said 1 - p_nonhistory_3

I am not seeing the logic. It seems to me that, for it to take 4 or more draws to get a history book, the only condition that has to be met is that a history book was not drawn in the first 3 draws. Which would make the answer parts 1 and 2 equivalent. The stated answer is (1 - p_nonhistory_3). but that expression would be the probability that a history book is drawn one or more times in the first 3 draws, which would mean it did NOT take 4 or more draws to get a history book. What am I missing?

4 Likes

Hello @messner.james

You are on the right track.

That is correct.

- non-history book
- history book

Rather, they are looking at two parts of the same problem.
If we draw 3 non-history books in the first 3 draws:

  1. The probability of picking a non-history book in first 3 draws:
    p_nh = 0.93
    P_nh_first_3 = (0.93 * 0.93 * 0.93) = 0.933

_There was an error here, stating P_nh_first_3 = 0.073. Thanks @lmotta777 for finding it! _

  1. The probability of picking history book at the 4th draw and more (so the first 3 times non-history book were picked):
    P_h_4_and_more = (4th draw) + (4th and 5th) + (…) + (4th, 5th … nth)

where n - the number of books sampled.

But because these are part of the same problem, the probability must add up to 1:

P_nh_first_3 + P_h_4_and_more = 1

P_h_4_and_more = 1 - P_nh_first_3

Hope this clarifies

3 Likes

What is the difference between this problem and the problem of finding the probability that it takes three flips or more for a coin to land heads up?
Link to the coin problem: https://app.dataquest.io/m/379/solving-complex-probability-problems/3/example-walk-through

The way I go about this problem is this:
Let’s call event A (it takes four times or more to draw a history book)
A = {4, 5, 6, … , 100, 101, …}

The opposite of A is: it takes less than four times to draw a history book or at least one time out of the three times we can draw a book.
non-A = {1, 2, 3}

All the possible outcomes of non-A where we draw at least one history book in the first three time:
HNN, NHN, NNH, HHN, HNH, NHH, HHH
P(non-A) = 3 * p_history * p_nonhistory * p_nonhistory + 3 * p_history * p_history * p_nonhistory + p_history * p_history * p_history = 0.19564300000000004

Therefore P(A) = 1 - P(non-A) = 1 - 0.19564300000000004 = 0.80435699999 = P(NNN)

But the result seems to indicate that P(A) = 1 - P(NNN) = 0.19564300000000004 which is the opposite.

It seems contradictory to the explanation for the coins problem.

1 Like

Hi kakoori,

Your explanation doesn’t make sense or I’m missing something.
The probability of picking a non-history book in first 3 draws:
P_nh_first_3 = (0.07 * 0.07 * 0.07) = 0.07^3

This is the probability of picking a history book in the first 3 draws.
remember p_history = 0.07

Could you please clarify?

@lmotta777

It’s a mistake, thanks for pointing this out.

The correct statement should be:

p_history = 0.07
p_non-history = 0.93

P_non-history_in_first_3_draws = 0.93 * 0.93 * 0.93 = (0.93)3

I’ve corrected the above post.

Hi Kakoori,

Thank you.
However, I still don’t understand how the solution DQ gives is correct.
image
They are saying:
The probability of 4 or more = the probability of at least 3 or less

However, P_non-history_in_first_3_draws = probability of non history in first 3 draws
And, (1 - P_non-history_in_first_3_draws) = the compliment (which is the opposite)

So, I don’t understand how DQ came up with that solution because we are looking for getting a history book on 4 or mores tries, not 3 or less.

Your insight would be greatly appreciated.

Hi @vyvuong159

The only difference is that the book problem is like a biased coin problem. With a fair coin probabilities for heads and tails are both 0.5.

Ok.

To cite the classic. There’s some truth in your fiction and some fiction in your truth.

A can be complementary for 8 other problems:
- non-history book
- history book

There are 8 possible P(non-A)'s. Each will give you a different answer.

The history book problem dictates that the history book be not drawn in first 3 draws, so the answer is p_nonhistory3, as each draw is independent.

This is slightly mixed up but it’s ok.
P(non-A) as defined in:

would be a different problem:

What is the probability that the history book at least once in the first three draws?

Then, indeed: P(A) = 1 - P(non-A) = 1 - 0.19564300000000004 = 0.80435699999

But P(NNN) is not part of the problem, so the last part (0.80435699999 = P(NNN)) is incorrect.

The misunderstanding arrises in my opinion because this is the actual complementary of the problem, i.e.:
P(non-A) = P(NNN)
This is because you must draw a history book only after 4 or more draws. So the first 3 times you cannot draw a history book. Hence:

P_nh_in_first_3 = p_nh * p_nh * p_nh = p_nh3 = 0.933 = 0.80435699999

Hope this clarifies. If you have any questions or doubts, I’ll be happy to assist you.

1 Like

@lmotta777

Rather:
The probability of h in 4 or more = all possible outcomes - The probability of not h in 3

Because a history book can be drawn only after the 4th draw or more, the compliment is h is not drawn in first 3. Hence:

1 = P_nh_1-to-3 + P_h_4+

I think the problems with this mission arise because the compliment is not explicitly stated and thre is room for What if?..

But I must agree with DQ that stating:

Solving Complex Probability Problems: Practice Problems
3. Mixed probability problems 2.
The probability that it takes four draws or more to get a history book from the library

Indeed means that the history book cannot be drawn before the 4th draw.

Thank you Kakoori,

It makes sense now. The equation is what made the connection.

1 Like

Hi @kakoori,
Thank you very much for your detailed explanation.

I understand the part saying that (1) you can draw a history book after 4 or more draws only if (2) a history book doesn’t appear in the first 3 draws (I rephrased your sentence a bit, your original phrase is: “the first 3 times you cannot draw a history book.”

Let call part (1) “you can draw a history book after 4 or more draws” is event A.
Let call part (2) “a history book doesn’t appear in the first 3 draws” is event B.

However, as far as I understand, event A and event B aren’t the opposite of each other. The opposite of event A (i.e. event non-A) should be “It takes less than four draws to get a history book”. Now, another way to state event non-A is “It takes at least one draw to get a history book in the first 3 times”.

It turns out that event B is the opposite of event non-A. To be clearer:

  • event non-A says: “It takes at least one draw to get a history book in the first 3 times
  • the opposite of event non-A, i.e. event B, says: “A history book doesn’t appear in the first 3 draws”.

This makes sense to me, the opposite of the fact a history book appears at least once in the first 3 draws is that a history book doesn’t appear at all in the first 3 draws.

Therefore, P(non-A) is not equal to P(NNN) (whereas you said P(non-A) = P(NNN)), where NNN is the event B. So 1 - P(NNN) is not equal to P(A).

In addition, I asked what the difference is between this problem and the problem of finding the probability that it takes three flips or more for a coin to land heads up, because I also think the two problems are similar, only different in the biased issue as you mentioned. Considering solving the history book problem is similar to the way the lecture solved the coin problem (except for the biased part), the result turns to be P(A) = 0.804357 = P(NNN) as described in the comparison table below:


Please let me know what I misunderstood in this table as well as what I explained above. Thanks so much @kakoori

1 Like

That is correct. They compliment each other.

The thing is that non-A notation may be slightly misleading and counterintuitive in the beginning as this is not an opposite of A but rather not belonging to A.

I agree on that. :grinning: But please note, that we are starting to drift to another problem, because:
event (non-A): “It takes at least one draw to get a history book in the first 3 times”

but because we start with a finite problem (3 draws) we don’t need to account for an infinite compliment, e.g.:

  1. an example case with only 3 draws
    compliment of non-A: “The non-history book can be drawn at most 1 in first 3 times”

  2. an example case with inifinite draws
    complient of non-A: “The non-history book can be drawn at most 1 in first 3 times but will be definitely drawn for 4 and more draws”

I think this part is built upon the non-A is opposite instead of non-A is all events complimenting A misunderstanding.

For the coin problem:
event-A = “it takes 3 flips or more to get heads”

You can think of it this another way:

event-1st: Heads in 1st flip and more
event_1st = “H in 1st flip” , “H in 2nd flip” , “H in 3rd flip” , … “H in nth flip” , …
compliment_event_1st = Heads in no flips a.k.a. all Tails
compliment_event_1st (a.k.a. non-1st) = “T in 1st flip” , “T in 2nd flip” , “T in 3rd flip” , … “T in nth flip” , … = 0.5 * 0.5 * 0.5 * … * 0.5 * … = 0.5 = 0

event-2nd: Heads in 2nd flip and more
event_2nd = “H in 2nd flip” , “H in 3rd flip” , … “H in nth flip” , …
compliment_event_2nd = Heads not in 1st flip = Tails in 1st
compliment_event_2nd = “T in 1st flip” = 0.5

And finally…

event-3rd: Heads in 3rd flip and more
event_3rd = “H in 3rd flip” , … “H in nth flip” , …
compliment_event_2nd = Heads not in 1st nor 2nd flip = Tails in 1st and 2nd flip
compliment_event_2nd = “T in 1st flip and 2nd flip” = 0.5 * 0.5 = 0.25

Do note that this is the limit, i.e. if you flip a coin, say, 5 times in a row and repeat that 100 times than you expect ca. 75 of flip rounds to satisfy the event-3rd. But the outcome would be somthing like 70, or maybe 80. As you approach infinit number of flip rounds, the experiment result fits more the above calculation.

So, to sum up. I think the biggest landmine is taking compliment as opposite.

Is it more clear or more messed up? :sweat_smile:

Thank you again for your attentiveness. I really appreciate that. I only have a final follow-up comment about the complement versus the opposite. You can ignore it though :blush:

The complement rule says that: Complement of an Event: All outcomes that are NOT the event. So the Complement of an event is all the other outcomes (not the ones we want). And together the Event and its Complement make all possible outcomes.

From this concept, I’ve understood that complement and opposite is the same thing, which is the part that contains all outcomes that are NOT the event. So P(A) = 1 - P(the complement/opposite part, or Non-A).

I found a similar problem in the GMAT Prep Magoosh webpage (I think it’s similar, but maybe you don’t think so): https://magoosh.com/gmat/math/basics/gmat-math-the-probability-at-least-question/

In a certain game, you pick a card from a standard deck of 52 cards. If the card is a heart, you win. If the card is not a heart, the person replaces the card to the deck, reshuffles, and draws again. The person keeps repeating that process until he picks a heart, and the point is to measure: how many draws did it take before the person picked a heart and won? What is the probability that one will have at least two “heartless” draws on the first two draws, not picking the first heart until at least the third draw?

The solution is:

A full deck of 52 cards contains 13 cards from each of the four suits. The probability of drawing a heart from a full deck is 1/4. Therefore, the probability of “not heart” is 3/4.

P(at least three draws to win) = 1 – P(win in two or fewer draws)

Furthermore,

P(win in two or fewer draws) = P(win in one draw OR win in two draws)

= P(win in one draw) + P(win in two draws)

Winning in one draw means: I select one card from a full deck, and it turns out to be a heart. Above, we already said: the probability of this is 1/4.

P(win in one draw) = 1/4

Winning in two draws means: my first draw is “not heart”, P = 3/4, AND the second draw is a heart, P = 1/4. Because we replace and re-shuffle, the draws are independent, so the AND means multiply .

P(win in two draws) =(3/4)*(1/4) = 3/16

P(win in two or fewer draws) = P(win in one draw) + P(win in two draws)

= 1/4 + 3/16 = 7/16

P(at least three draws to win) = 1 – P(win in two or fewer draws)

= 1 – 7/16 = 9/16

I take the similar route to solve the history book problem

The probability of drawing a history book is 0.07. Therefore, the probability of “non-history” is 1-0.07 = 0.93.

P(at least four draws to get a history book) = 1 – P(get a history book in three or fewer draws)

Furthermore,

P(get a history book in three or fewer draws) = P(get a history book in one draw OR get a history book in two draws OR get a history book in three draws )

= P(get a history book in one draw) + P(get a history book in two draws) + P(get a history book in three draws)

Get a history book in one draw means: I select one book from the library, and it turns out to be a history book. Above, we already said: the probability of this is 0.07.

P(get a history book in one draw) = 0.07

Get a history book in two draws, in other words, get a history book only in the second draw, means: my first draw is “non-history”, P = 0.93, AND the second draw is a history book, P = 0.07. Because we replace, the draws are independent, so the AND means multiply .

P(get a history book in two draws) =0.93 * 0.07 = 0.0651

Get a history book in three draws, in other words, get a history book only in the third draw, means: my first draw is “non-history”, P = 0.93, AND the second draw is also a non-history book, P = 0.93, AND the third draw is a history book, P = 0.07. Because we replace, the draws are independent, so the AND means multiply .

P(get a history book in three draws) =0.93 * 0.93*0.07 = 0.060543

P(get a history book in three or fewer draws) = P(get a history book in one draw) + P(get a history book in two draws) + P(get a history book in three draws)

= 0.07 + 0.0651 + 0.060543 = 0.195463

P(at least four draws to get a history book) = 1 – P(get a history book in three or fewer draws)

= 1 – 0.195463 = 0.804357

This result, again, is equal to the probability that we don’t take any history book in the first three draws: 0.93 * 0.93 * 0.93 = 0.804357

Sorry, I don’t know why I keep returning to this result :slight_smile:

1 Like

Hi @vyvuong159,

sorry for a late reply, I had a forced break from the DQ. :slight_smile:

Now, for your questions.

That is true but again, you must be aware of what is 1 on the right hand side. This is the sum of all possible events for this particular problem, i.e.:

You have a fair 6 side dice and give it a roll. What is the probability of rolling 6?

It’s 1/6, or to be more specific:

All outcomes in the problem (all outcomes of rolling once): 1, 2, 3, 4, 5, 6.
Positive outcomes (event A): 6.
Negative outcomes (non-A): 1, 2, 3, 4, 5.

P(A) = \frac{\{6\}}{\{1, 2, 3, 4, 5, 6\}} = \frac{1}{6} \approx 0.167
P(non-A) = \frac{\{1, 2, 3, 4, 5\}}{\{1, 2, 3, 4, 5, 6\}} = \frac{5}{6} \approx 0.833
P(A) + P(non-A) = \frac{1}{6} + \frac{5}{6} = \frac{6}{6} = 1

Notice that the total number of outcomes depend on the problem, so the non-A events depend on it as well. If we state the problem differently, e.g.

Roll 6 side dice once. If you roll 5 you get 1 extra roll. What is the probability of rolling 6?

non-A event will now be bigger:

All rolls: 1, 2, 3, 4, (5,1), (5,2), (5,3), (5,4), (5,5), (5,6), 6
A: (5,6), 6
non-A: 1, 2, 3, 4, (5,1), (5,2), (5,3), (5,4), (5,5)

P(A) = \frac{2}{11} \approx 0.182
P(non-A) = \frac{9}{11} \approx 0.818
P(A) + P(non-A) = \frac{2}{11} + \frac{9}{11} = 1

Event non-A (and A) changes depending on the conditions.

I think this part is false. Or rather messud up a bit. :wink:

Notice, that what you actually do, is focusing on the first two outcomes (this results in \frac{}{16} result). You notice (correctly!) this part is important as the series of draws can potentially be inifinite.

To draw hearts at third draw (or more) you need to make a heartless draw 2 times in a row. I guess you make a jump here and write:

P(first 2 draws are heartless) = P(at least three draws to win)

But because the problem asks for probability of drawing heart at 3rd+ draw, then IMO (win in first draw) and (win in second) do not count as possible events.

There is only the (draw of 2 heartless cards in a row) and (drawing a heart card at 3rd+ draw) and no other options.

So by calculating

you actually get the probability of getting 2 heartless draws, but the other way around. The tricky part is the infinite series of outcomes. That’s why it’s broken down into an inifinite portion (event A to be calculated) and a finite portion (event non-A - a complement that can be easily calculated). As a whole they form all the outcomes.

That’s how I see it. :slight_smile:

Thanks @kakoori for your attentiveness and patience as always :smiling_face_with_three_hearts:. Hope you have a great week ahead! I think I am clearer.

Hi @messner.james,

I think you’re right. In my opinion the correct answer would be: p_history_4_or_more = 1 - (1 - p_nonhistory_3) = 0.804

If (1 - p_nonhistory_3) is the probability of drawing a history book in the first 3 draws (the complementary of don’t take any history book in the first three draws).

Its complementary: 1 - (1 - p_nonhistory_3) would be not doing that. And for me this is the same of saying that this is the probability of needing four draws or more to get a history book from the library.

Did you get to the same conclusion?

Thanks

Daniel

I’dlike to ask the history book question differently for clarification -
If I already selected 3 non-history books and I had infinite amount of tries remaining, why wouldn’t there be a 100% chance that at some point I select a history book? By this logic, p_nonhistory_3 and answer p_history_4_or_more would be equal.

Thanks!