5
$\begingroup$

I read this Google Interview Question.

Q:If the probability of observing a car in 30 minutes on a highway is 0.95, what is the probability of observing a car in 10 minutes (assuming constant default probability)?

A:The trick here is that .95 is the probability for 1 or more cars, not the probability of seeing just one car. The prob. of NO cars in 30 minutes is 0.05, so the prob of no cars in 10 minutes is the cube root of that, so the prob of seeing a car in 10 minutes is one minus that, or ~63%

My question is, if The probability of NO cars in 30 minutes is 0.05, why the probability of no cars in 10 minutes is the cube root of that ??

Which algorithm used in this question?

  • 0
    Check https://math.stackexchange.com/questions/1016268/probability-of-crossing-a-point-in-a-given-time-window and https://math.stackexchange.com/questions/2335614/probability-of-crossing-a-point-in-a-given-time-window-follow-up as well for more critical discussions2017-06-27

4 Answers 4

6

The unstated (or, rather, very vaguely stated) assumption in the problem is that the probabilities of observing a car during any given non-overlapping time intervals of equal length are equal and independent.

(Of course, this assumption can't really be true in practice, even if "observing a car" is taken to be a point event — for example, if the road has $n$ lanes and you observe a different car within each of $n$ consecutive 1 millisecond intervals, you're not going to observe another one within the next millisecond — but it can be a fairly good approximation if the intervals are of moderate length and the road not very busy.)

This assumption (almost; see comments) implies that the arrival of cars is (assumed to be) a Poisson process. More specifically, it implies that the probability of no cars arriving within any given 10 minute interval is the same. Since we know that the probability of no cars arriving within a 30 minute interval equals the product of the probabilities of no cars arriving in each of the three consecutive 10 minute intervals within it, the answer follows.


To be specific, let $A$, $B$ and $C$ denote the events "no cars are observed within the first / second / third 10 minutes" respectively. Then we have

$ \mathrm{Pr}[A \text{ and } B \text{ and } C] = \mathrm{Pr}[A] \cdot \mathrm{Pr}[B \text{ if } A] \cdot \mathrm{Pr}[C \text{ if } A \text{ and } B].$

Since the events $A$, $B$ and $C$ are independent by assumption, we get

$ \mathrm{Pr}[A \text{ and } B \text{ and } C] = \mathrm{Pr}[A] \cdot \mathrm{Pr}[B] \cdot \mathrm{Pr}[C],$

and, since by assumption $\mathrm{Pr}[A] = \mathrm{Pr}[B] = \mathrm{Pr}[C]$,

$ \mathrm{Pr}[A \text{ and } B \text{ and } C] = \mathrm{Pr}[A]^3.$

We know that $\mathrm{Pr}[A \text{ and } B \text{ and } C] = 0.05$, and we want to solve for $\mathrm{Pr}[A]$ (which, by assumption, equals the a priori probability of observing no cars within any given 10 minute interval), so we take the cube root of both sides and get

$ \mathrm{Pr}[A] = \sqrt[3]{\mathrm{Pr}[A \text{ and } B \text{ and } C]} = \sqrt[3]{0.05} \approx 0.3684.$

Subtract that from one to get $\mathrm{Pr}[\text{not } A] \approx 0.6316$.

  • 0
    @kaartic: Why would it be? That would mean that you'd be *less* likely to see a car within the 30 minute interval than in any of the 10 minute intervals that comprise it. Clearly that would be absurd.2017-10-20
1

The question seems rather ambiguous, but let's assume cars arrive as a Poisson process rate $\lambda$. If this is the case, the distribution of the time (from now) to the first arrival of the car is exponential with parameter $\lambda$. Therefore probability of no cars arriving is $P(T>t) = exp(-\lambda t)$. Thus

$P(T>10min) = \exp(-\lambda \times 10) = \exp(-\lambda*30/3) = \exp(-\lambda*30))^{\frac{1}{3}} = \sqrt[3]{P(T>30min)}$

Alternatively you could approximate by a binomial model. Suppose in 10 minutes the chance of no car arriving is $p$. Then in thirty minutes (assuming each period is independent) the probability of no cars passing is $p^3$. Whence, $p=\sqrt[3]{0.05}$.

0

Let's say that the probability of no cars in 30 minutes can be decomposed as (you assume constant probability)

P10 = probability of no cars in 10 minutes

P30 = P10 * P10 * P10 = P10^3 = 0.05

Thus P10 = cuberoot(0.05)

  • 1
    @Soner, because probability of (A and $B$) equals (probability of A) times (probability of B), provided A and B are independent events - and the hidden-but-plausible assumption is that what happens in any one 10-minute interval is independent of what happens in any other (non-overlapping) 10-minute interval.2011-07-18
0

For curiosity, I saw other solutions and found that everyone is solving via probability of not observing a car in 10 minutes.

Let's answer it in a straight way.

Assumption: Considering Probability of observing a car in any given non-overlapping time interval of equal length are equal and independent. Reason: Question clearly states "assuming constant default probability"

Let 'p' be the probability of observing a car in any 10 minutes interval.

Now let's generate the probability of observing a car in 30 minutes, let it be P(30).

Let's divide 30 minutes time interval into three 10 minutes intervals as A, B and C.

P(A) = Probability of seeing a car in first 10 minutes P(B) = Probability of seeing a car in second 10 minutes P(C) = Probability of seeing a car in third 10 minutes 

As all are independent events so,

P(A) = P(B) = P(C) = p 

Similarly,

P(not A) = Probability of not seeing a car in first 10 minutes P(not B) = Probability of not seeing a car in second 10 minutes P(not C) = Probability of not seeing a car in third 10 minutes 

As all are independent events so,

P(not A) = P(not B) = P(not C) = 1-p 

Then,

P(30) = P(A) + P(not A)*P(B) + P(not A)*P(not B)*P(C) 

It can be seen in this way:

Consider an event, We are tossing a coin 3 times a row and we want to find what is the Probability of getting at least 1 head.

P(getting at least 1 head) = P(getting head in 1st toss) + P(getting head in 2nd toss given in 1st toss we got tail) + P(getting head in 3rd toss, given in 1st and 2nd toss we got a tail) P(getting at least 1 head) = 1/2 + 1/2*1/2 + 1/2*1/2*1/2 = 7/8 

Similarly,

P(30) = p + (1-p)*p + (1-p)*(1-p)*p => 0.95 = p + p - p^2 + p + p^3 - 2p^2 => 0.95 = p^3 - 3p^2 + 3p => 1-0.95 = 1 - p^3 + 3p^2 - 3p => 0.05 = (1-p)^3 => p = 1 - (0.05)^(1/3) => p ~= 0.6316 

P(probability of observing a car in 10 minutes) = 0.6316