1

I just finished with the first module in the algo specialization course in coursera.

There was an exam question that i could not quite understand. I have passed that exam, so there's no point for me to retake it.

Out of curiosity, I want to learn the principles around this question.

The question was posted as such:

Suppose that a randomized algorithm succeeds (e.g., correctly computes the minimum cut of a graph) with probability p (with 0 < p < 1). Let ϵ be a small positive number (less than 1).

How many independent times do you need to run the algorithm to ensure that, with probability at least 1−ϵ, at least one trial succeeds?

The options given were:

log(1−p)/logϵ

log(p)/logϵ

logϵ/log(p)

logϵ/log(1−p)

I made two attempts and both were wrong. My attempts were:

  1. log(1−p)/logϵ
  2. logϵ/log(1−p)

It's not so much I want to know the right answer. I want to learn the principles behind this question and what it's asking for. So that I know how to answer similar questions in future.

I have posted this on the forum, but nobody answered after a month. So I am trying it out here.

NO need to post the answer directly. If you got me to get to aha moment, i will mark it as correct.

Thanks.

Kim Stacks
  • 10,202
  • 35
  • 151
  • 282
  • 1
    If I'm understanding the question correctly, the fact that the algorithm computes a min-cut seems irrelevant - an effectively identical question could read "You have a bag of coins that have `p` probability of landing heads when flipped (with `0 < p < 1`). Let ϵ be a small positive number (less than 1). How many coins do you need to simultaneously flip such that, with probability `1- ϵ`, at least one coin lands on heads?" Not that this implies an answer, but cutting away extraneous info is always good. – Mshnik Aug 25 '17 at 04:22

1 Answers1

2

How many independent times do you need to run the algorithm to ensure that, with probability at least 1−ϵ, at least one trial succeeds?

Let's rephrase it a bit:

What is the smallest number of independent trials such that the probability of all of them failing is less than or equal to ϵ?

By the definition of independent events, the probability of all of them occurring is the product of their individual probabilities. Since the probability of one trial failing is (1-p), the probability of n trials failing is (1-p)^n.

This gives us an inequality for n:

(1-p)^n <= ϵ
Anton
  • 3,113
  • 14
  • 12
  • i understand your phrasing. which is helpful. but using what you gave me means the answer is `logϵ/log(1−p)`. However, I know for a fact that answer is wrong. Which means, either a) the reasoning you gave is not correct (seems unlikely) or b) I reasoned to the wrong answer despite your explanation or c) your reasoning is right. the implied answer is right. the marking system had an error Am I right to say that your reasoning implies `logϵ/log(1−p)`? – Kim Stacks Aug 27 '17 at 00:34
  • 1
    @KimStacks Yes, it's `logϵ/log(1−p)`. I think we can eliminate other answers on common sense grounds. 1) `ϵ`, `p` and `1-p` are all less than `1`, so their logarithms are negative and the logarithms' absolute values increase as the the corresponding numbers decrease. – Anton Aug 27 '17 at 01:04
  • 1
    @KimStacks 2) The more likely the algorithm is to succeed, the fewer times we need to run it. So as `p` increases, `n` must decrease. This eliminates `log(1−p)/logϵ` and `logϵ/log(p)`. 3) The more confident we need to be that that the algorithm succeeds at least once, the more times we need to run it. So as `ϵ` decreases, `n` must increase. This eliminates `log(1−p)/logϵ` and `log(p)/logϵ`. – Anton Aug 27 '17 at 01:04
  • Thanks, took me a while to follow your logic of elimination worth it! – Kim Stacks Aug 27 '17 at 01:56