If $X$ and $Y$ are uniformly distributed on $(0,1)$, what is the distribution of $\max(X,Y)/\min(X,Y)$?

You might find this more helpful easier to write $F_Z(t)= \mathbb{P}[Z \leq t]$ as $1-(\mathbb{P}[X\leq Y/t] +\mathbb{P}[Y \leq X/t])$ for $t\ge 1$.

You can calculate this from the unit square

enter image description here

or by simple integration $$1-\left(\int_{y=0}^{1} \int_{x=0}^{y/t} dx \; dy + \int_{x=0}^{1} \int_{y=0}^{x/t} dy \; dx\right)$$


We find the cdf $F_Z(x)$ of the random variable $Z$. By symmetry, it is enough to find $\Pr(Z\le z|Y\gt X)$, that is, $$\frac{\Pr((Z\le z) \cap (Y\gt X))}{\Pr(Y\gt X)}.$$ The denominator is $\frac{1}{2}$. so we concentrate on the numerator.

The rest of the argument is purely geometric, and will require a diagram. Draw the square with corners $(0,0)$, $(1,0)$, $(1,1)$, and $(0,1)$.

Draw the line $x+y=1$ joining $(1,0)$ and $(0,1)$.

For a fixed $z$ (make it $\gt 1$) draw the line $y=zx$.

We will need labels. Let $P$ be the point where the lines $x+y=1$ and $x+y=1$ meet. Let $Q$ be the point where the line $y=zx$ meets the line $y=1$, and let $R=(0,1)$. Let $A=(1,0)$ and $B=(1,1)$. The quadrilateral $ABQP$ is the region where $Y\ge X$ and $Y\le zX$. So the probability that $Y\gt X$ and $Z\le z$ is the area of this region.

It is easier to first find the area of $\triangle PQR$. One can show that $QR=z$ and that the height of $\triangle PQR$, with respect to $P$, is $\frac{1}{1+z}$. Thus $\triangle PQR$ has area $\frac{1}{2}\frac{z}{1+z}$.

It follows that the area of $ABQP$ is $\frac{1}{2}-\frac{1}{2}\frac{1}{1+z}$. Divide by $\frac{1}{2}$ and simplify. We find that $\Pr(Z\le z)=\frac{z}{1+z}$.

Thus $F_Z(z)=\frac{z}{1+z}$ (for $z\gt 1$). If we want the density function, differentiate.