Probability – Probability Calculations on Highway

algorithmslinear algebraprobability

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?

Best Answer

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$.

Related Question