MUN Computer Science 1002 - Lab 9

Probability

Review:

 

Probability puzzles

For this lab, let's look at some puzzles with probabilities.

Apple picking

Suppose you have two boxes of apples from a suspect area near an industrial spill. One box contains three good apples and four contaminated ones, and the second box contains five good apples and six contaminated.

  1. What is the probability that you picked a good apple given that you selected the first box?
  2. Suppose that you select a box uniformly at random, and then pick a random apple out of the box. What is the probability that you picked a good apple?
  3. Suppose that you select a box uniformly at random, and then pick a random apple out of the box. Given that you got a good apple, what is the probability that you've chose the second box?
  4. Now suppose that the test for contamination has false positive rate 1/5 and false negative rate 1/3. You randomly pick one of the apples from box 2. If the test is positive, what is the probability that the apple is contaminated?
  5. (Bonus; do it if you have time at the end) Suppose that out of 11 apples in the second box, 4 are ripe, 3 are unripe and 4 are overripe. As you can tell a little bit by touch which is which, probability of picking a ripe apple is 2/3, of unripe is 1/12 and overripe is 1/4. What is the probability that an apple is ripe given that you picked it?

Back in flight

Remember the time when we got to fly places?... Imagine the following scenario: n people are trying to board a plane; the plane is full, so there are exactly n seats available. However, the first person misplaced their boarding pass, so they just pick a random seat and sit themselves there. The passengers come in one by one, and if their seat is free, they sit there, otherwise pick a random free seat.
  1. What is the probability that the first person picks their own seat when choosing at random? Note that in this case everybody would sit in their own seats.
  2. What is the probability that the second person will have their seat occupied?
  3. Suppose there are only two seats on the plane (and, respectively, two people boarding). Again, the first person picks a random seat. What is the probability that the second person will get their own seat?
  4. Now, suppose there are three seats on the plane. Again, the first person chooses a random seat, and the rest sit in their own if possible, otherwise pick at random out of available ones. What are the probabilities that person 3 would sit in 1st person seat? 2nd person's seat? Their own seat? (Without loss of generality, you can assume that seat 1 is 1st person's seat, and in general seat i is assigned to person i, who came in ith).
  5. Now, with the intuition from the previous subquestion, if there are n people, what is the probability, for each i, that person n would sit in seat i? In particular, what is the probability that person n will sit in their own seat?
  6. Suppose that we know that the first person did not take their seat. What is the expected number of passengers who get seated in their own seats before anybody discovers that their seat is taken?