Qm
BrainteasersJane StreetOptiver

When is the ratio of two random numbers between one and two?

Two numbers, p and q, are chosen independently and uniformly at random between 0 and 1.

What is the probability that p divided by q lies between 1 and 2 (inclusive)? Solve it geometrically, and then say what the probabilities are for the ratio being below 1 and for it being above 2.

Show a hint

Draw the unit square with q along one axis and p along the other. The condition is q at most p at most 2q. Find the area of that region.

Your answer

Solving needs a free account

Answers, streaks and solutions unlock when you are signed in. Reading the question and the hint stays free.

Discussion

Sign in to join the discussion · reading is open to everyone

💡 Discussion rules

  1. No full solutions here. Hints and approaches only.
  2. Complexity, edge cases and intuition are the point.
  3. Interview experiences are welcome. Respect your NDAs.

Loading discussion…

Learn the concepts

The theory behind this question.

Related questions

A random chord longer than the side of the triangleBoth hands in the right half of the dialBreaking a stick into a triangleDropping needles to estimate piRelabel one die so that every total is equally likelyCan the three stick pieces form a triangle
All questions →