# Probability of $a>cb$, $a$ and $b$ are uniform in some ranges.

What is the probability $P(a>cb)$ where $a$ and $b$ are drawn uniformly & independently in some ranges, for example, $a$ in $(0,1)$, $b$ in $(0,n)$?

$c$ is some constant and $c>0$.

-
Are $a$ and $b$ independent random variables? Because if not, we can only express the probability as an integral that cannot be evaluated without further information. – Dilip Sarwate May 25 '12 at 2:12
Yes, $a$ and $b$ are independent. I've edited the question. – hiro May 25 '12 at 4:26

$$\mathbb{P}(a > cb) = \int_{b'=0}^{\min(n,1/c)} \mathbb{P}(a>cb') \mathbb{P}(b \in (b',b'+db']) = \int_{b'=0}^{\min(n,1/c)} \mathbb{P}(a > cb') \dfrac{db'}{n}\\ = \int_{b'=0}^{\min(n,1/c)} \dfrac{1-cb'}{1} \dfrac{db'}{n} = \left . \dfrac{b'-cb'^2/2}{n} \right \rvert_{0}^{\min(n,1/c)} = \min(1,1/cn) - \dfrac{\min(cn,1/cn)}{2}.$$

EDIT As @Dilip Sarwate rightly points out, I am assuming that $a$ and $b$ are independent random variables.

EDIT Another method that doesn't require integration is as follows. Look at the variable $d = \dfrac{a}{c}$. $d$ has uniform distribution on the interval $\left[0, \dfrac1c \right]$. We now want the probability that $$\mathbb{P}(d>b).$$

If $\dfrac1c < n$, then for $d > b$, $b$ first needs to fall in the interval $\left[0,\dfrac1c \right]$ and whenever it falls within this interval half of the times it will be greater than $a$ and rest of the times it will be lesser than $a$. Hence the desired probability is $$\underbrace{\dfrac{1/c}{n}}_{\text{fall in the interval \left[0,\frac1c \right]}} \times \underbrace{\dfrac12}_{\text{half of the times it will be less than d}} = \dfrac1{2cn}$$

If $\dfrac1c > n$, then for $d > b$, if $d$ falls in the interval $\left[n,1/c \right]$ then it is always greater than $b$ else if $d$ falls in the interval $\left[0,n \right]$ and whenever it falls within this interval half of the times it will be greater than $b$ and rest of the times it will be lesser than $b$. Hence the desired probability is $$\underbrace{\dfrac{1/c-n}{1/c}}_{\text{falls in the interval \left[n,1/c \right]}} + \underbrace{\dfrac{n}{1/c}}_{\text{falls in the interval \left[0,n \right]}} \times \underbrace{\dfrac12}_{\text{half of the times it will be greater than b}} = 1 - \dfrac{cn}{2}$$

-
Assuming of course that $a$ and $b$ are independent random variables. – Dilip Sarwate May 25 '12 at 2:19
Yes. @DilipSarwate I have updated it accordingly. – user17762 May 25 '12 at 2:20

The notation below is a little different from yours, but it should be easy to adjust. We attack a (marginally) more general problem. The approach is geometric.

Let $X$ and $Y$ be independent random variables, with $X$ uniformly distributed on the interval $[0,m]$, and $Y$ uniformly distributed on the interval $[0,n]$. We want to find the probability that $X \gt cY$. Here $c$ is a positive constant.

Look at the rectangle $R$ with corners $(0,0)$, $(m,0)$, $(m,n)$, and $(n,0)$. The joint density function of the random variables $X$ and $Y$ is $\frac{1}{mn}$ on and inside rectangle $R$, and $0$ outside this rectangle.

Draw the line $x=cy$. More familiarly, we might call this line $y=\frac{1}{c}x$. This is a line through the origin, with slope $\frac{1}{c}$. The part of $R$ "below" this line has $x>cy$. Call this region $K$. The probability that $X>cY$ is the density function $\frac{1}{mn}$ times the area of $K$, or equivalently the area of $K$ divided by the area of rectangle $R$.

Geometrically, the region $K$ is either a triangle or a trapezoid, depending on the value of $c$.

If $\frac{1}{c}\le \frac{n}{m}$, then $K$ is a triangle. The base is $m$, and the height can be determined by seeing where the line $y=\frac{x}{c}$ meets the vertical line $x=m$. This point is at height $\frac{m}{c}$, so the area of $K$ is $\frac{m^2}{2c}$. Divide by $mn$. The probability is $\frac{m}{2cn}$.

If $\frac{1}{c}\gt \frac{n}{m}$, then $K$ is a trapezoid. There are various ways to find the area of this trapezoid. The easiest for me is to find the area of the rest of the rectangle, which is the area of a certain triangle. This tiangle has "base" (it is vertical) $n$. To find its height, find the place where $y=\frac{x}{c}$ meets $y=n$. This is at $x=cn$. So the triangle has area $\frac{cn^2}{2}$. So $K$ has area $mn-\frac{cn^2}{2}$. Divide by $mn$ for the probability.

Remark: The calculation can be easily modified to deal with situations where $X$ is uniformly distributed on the interval $[s,t]$, and $Y$ is uniformly distributed on $[u,v]$. It is just a question of drawing a picture, and calculating the relevant areas.

-