Probability Problem


What is the region on the graph that x/y will round down to 0?

  • Answer: y needs to be bigger than x, so it is the area above the y=x

What is the region on the graph that x/y will round down to 2?

  • Answer: x needs to be equal or greater than y twice && x needs to be smaller than y 3 times. Thus it is the area below y=x/2, above y=x/3x

Answer is basically sum of the triangles on the graph

Take advantage of Python codes to obtain an answer

!pip3 install numpy
 
import numpy as np
 
data_size = 10**6
 
x = np.random.random(data_size)
y = np.random.random(data_size)
ratios = x / y
round_down_ratio = np.floor(ratios)
even_ratio_res = (round_down_ratio % 2 == 0).mean()