Probability of a Car Passing By

Question: The probability of a car passing a certain intersection in a 20 minute windows is 0.9. What is the probability of a car passing the intersection in a 5 minute window? (Assuming a constant probability throughout)

Answer: This is one of the basic probability question asked in a software interview. Let’s start by creating an equation. Let x be the probability of a car passing the intersection in a 5 minute window.

Probability of a car passing in a 20 minute window = 1 – (probability of no car passing in a 20 minute window)
Probability of a car passing in a 20 minute window = 1 – (1 – probability of a car passing in a 5 minute window)^4
0.9 = 1 – (1 – x)^4
(1 – x)^4 = 0.1
1 – x = 10^(-0.25)
x = 1 – 10^(-0.25) = 0.4377

That was simple eh. Ready for a challenge? Have a look at some of the other probability questions.

If you like this post, please Digg it or thumbs up on stumble upon. :)

Get a free subscription to Oracle magazine published by Oracle Corp.
 Powered by Max Banner Ads 

Related posts:

  1. 10 Google Interview Puzzles
  2. Challenge – Equal Probability between 1 and 7
  3. Pick a Random Byte
  4. The Ant Problem
  5. Boys and Girls
7 Comments

7 Responses

  1. mathie says:

    This solution seems synthetic to me. This is dividing time up into 5 minute intervals and treating the problem as a series of bernoulli trials.

    Why is the solution not based on poisson distribution?

  2. Eric Fredine says:

    Fun stuff. Here’s another solution:

    Since the probability throughput is constant, the probability density function for not seeing a car is given by:

    ProbNoCar(t) = e^ct where c is a constant that determines the rate of decay. The actual probability is given by the integral of e^ct which is e^ct (nice property of e).

    So, now we just need to determine c.

    ProbNoCar(20) = 0.1 = e^c*20
    c*20 = ln(0.1) = -2.3026
    c = -0.1151

    and plug in 5:
    ProbNoCar(5) = e^-0.1151*5 = 0.5623

    and subtract it from 1:
    ProbCar(5) = 1 – ProbNoCar(5) = 0.4377

  3. TKI says:

    Hi I read your solution for the above problem. Initially I found the solution convincing but I got stuck in the same logic you used

    you used that probability (of a car not passing in 20 minutes window) is 4 times of the probability (of a car not passing in 5 minutes window )

    Using the same logic
    probability (of a car passing in 5 minutes window ) = 1 – probability (of a car not passing in 5 minutes window )

    probability (of a car passing in 5 minutes window ) = 1 – [ {probability (of a car not passing in 20 minutes window )/4}]

    x = 1 – (0.1/4) gives x = 0.975

    kindly clear my problem

  4. Abhishek says:

    I beg to differ, and fail to agree with your solution.
    The hinge of your solution is that:-
    Probability that no car passes in a 20 minute window= ( P(no car passing in a 5 min. window))^4

    This reasoning, I think, is wrong. Its the following that makes sense:
    P(no car passing in a 20 min window)=
    P(no car passing in the first 5 mins)*P(no car passing in the second 5 mins)*P(no car passing in the third 5 mins)*P(no car passing in the last 5 mins)

    And the probability of a car going in each of the 5-min frame isn’t equal.. because, each probability depends upon the previous one.

    I have a solution(a rather lengthy one), crafted from my approach. Tell me if you agree so far, so that I may post it.

  5. Doggie says:

    That is a valid point. I guess I should have phrased the question as “at least one car passing by”. :)

  6. Gijs says:

    Isn’t this only valid if ‘a car passing by’ is meant to mean ‘one or more cars passing by’ instead of ‘exactly one car passing by’?

  7. Car Charity says:

    Blog looks really good mate, keep it up! The information is delivered solidly! :)

Leave a Reply

Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>