CDF of $W=\max\left(\frac{X}{Y},\frac{Y}{X}\right)$ Given a joint probability density function of $X$ and $Y$
$$f(x,y)=\begin{cases} \frac{1}{a^2} & 0<x,y<a \\ 0, & \text {otherwise} \end{cases}$$
I want to find the cumulative distribution function of $W=\max\left(\frac {X}{Y},\frac {Y}{X}\right)$.
I can find the cdf of $Z=\frac XY$ (is $F(z) =1-\frac {z}{2}$ correct?), and I know how to find the CDF of max of two independent RVs. Is it correct to assume that the CDF of $W$ is equal to the CDF $X>Y$?
 A: Actually, with $Z:=\frac XY$, if $z\geq1$, $\mathbb{P}(Z\leq z) = \mathbb{P}(X\leq zY) = \frac 1{a^2} \int_0^a\int_0^a \chi_{x \leq zy} dydx = \frac 1{a^2}\int_0^a\min(a,zy)dy = \frac 1{a^2}\big( \int_0^\frac azzydy+\int_\frac az^aady\big) = \frac 1{a^2}\big( \frac{a^2}{2z}+a^2-\frac{a^2}z\big) = 1-\frac{1}{2z}$
If $z\leq1$, $\mathbb{P}(Z\leq z) = \mathbb{P}(X\leq zY) = \frac 1{a^2} \int_0^a\int_0^a \chi_{x \leq zy} dydx = \frac1{a^2}\int_0^azydy = \frac z2$
Now , with $w\geq1$, $\mathbb{P}(W\leq w) = \mathbb{P}(\frac1w\leq Z \leq w) = \mathbb{P}(Z\leq w) - \mathbb{P}(Z < \frac1w) = 1-\frac1{2w}-\frac1{2w} = 1-\frac1w$
A: The cumulative distribution function is $F_W(w)=\mathbb{P}\left(W < w\right)$, which in this case is $\mathbb{P}\left(\max\left(\frac {X}{Y},\frac {Y}{X}\right) < w \right)$. Equivalently, this is $\mathbb{P}\left(\frac {X}{Y} < w \cap \frac{Y}{X} < w \right) = \mathbb{P}\left(\frac {X}{Y} < w \cap \frac{1}{w} < \frac{X}{Y} \right) = \mathbb{P}\left(\frac{1}{w} < \frac{X}{Y} < w \right)$. For $w < 1$, $F_W(w)$ will be $0$ because either $\frac{X}{Y}$ or $\frac{Y}{X}$ must be greater than $0$.
Then from $F_Z(z)$, $F_W(w) = F_Z(w)-F_Z\left(\frac{1}{w}\right)$. $F_Z(z)$ is given by $$\mathbb{P}\left( \frac{X}{Y} < z \right) = \mathbb{P}\left(X < Yz\right)$$
As an integral, this would be $$\int_0^{a} \int_0^a [x<yz]f(x, y)\ \mathrm dx\ \mathrm dy$$ $F_Z(z)$ is then given by $$\begin{cases} 
      0 & z \le 0 \\
      \frac{z}{2} & 0\le z \le 1 \\
      1-\frac{1}{2z} & z \ge 1 
   \end{cases}$$
Plugging this in for $F_W(w)$ for $w > 1$ yields $$F_W(w) = \left(1-\frac{1}{2w}\right)-\frac{\frac{1}{w}}{2} = 1-\frac{1}{w}$$
