0
$\begingroup$

I have a probabilistic function f(x) which returns True or False depending on its input x. The input x is an integer on the range [1,28] and is chosen uniformly at random.

f(x) behaves as follows:

  • If x == 15 or x == 20, return True with 50% probability otherwise False
  • Else If 15 < x < 20, return True
  • Else return False

How many times does f(x) need to be called before getting a True, on average?

I've simulated this in code already, and what I'm interested in is a solution using probability and statistics.

I've thought about treating f(x) as a coin flip with probability of heads being 4/28 (for the range 15 < x < 20), and then using the expectation of a geometric RV to arrive at 7 flips until the first heads.

However I'm unsure of how to include the 50% probability of True when x == 15 or x == 20. It should reduce the expectation.

I'd appreciate any help.

$\endgroup$
2
  • 1
    $\begingroup$ Calculate the probability that true is returned on the first call. Use the law of total probability en.wikipedia.org/wiki/Law_of_total_probability to do that, i.e,, condition on something. $\endgroup$ Commented Oct 1, 2016 at 20:19
  • 1
    $\begingroup$ Thanks, thinking about it in terms of the first call makes it simpler. That effectively adjusts my p for Geo(p). Using total probability it becomes P(True) = 4/28 + (2/28)*(1/2) = 5/28, which gives E[Geo(5/28)] = 5.6, which is what my program gave me. $\endgroup$ Commented Oct 1, 2016 at 20:39

1 Answer 1

3
$\begingroup$

You are right that $P(15 < X < 20) = 4/28$. As about $15$ or $20$ it's $1/28$ in each case and then you flip a fair coin. Since the probability of coin flips outcome is independent of drawing $15$ or $20$, those events are independent and we multiply independent probabilities. From here you can easily find the answer.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.