Let $X$ and $Y$ have a uniform distribution on $\left [ 0,1 \right ] \times \left [ 0,1 \right ]$. I have to derive the cdf and pdf of $Z = \frac{X}{Y}$.
My attempt: Let $Z = \frac{X}{Y} \Leftrightarrow Y = Z^{-1} X$ for $Z \in \left [ 0,1 \right ]$.
Then $$G(z) = P(Z \leq z)$$ $$ = P\left ( Y \leq \frac{z^{-1}}{x} \right )$$ $$ = z^{-1} + \int_{z^{-1}}^{1} \int_{0}^{\frac{z^{-1}}{x}} dy dx$$ $$ = z^{-1} + z^{-1} (log 1 - log z^{-1})$$ $$ = \frac{1}{z} - \frac{1}{z} log\left ( \frac{1}{z} \right )$$
Does my work so far look correct?
$Z$ defined on $(0, +\infty)$ (for any $z > 1$, pick $x = 1$ and $y=\frac{1}{z}$ to obtain $z = \frac{x}{y}$. for $z \in (0, 1)$ pick $x=y=z$)
Then,
$P(Z \le \alpha) = P(Y \ge \frac{X}{\alpha})$, this is a probability of all $(X, Y) \in [0,1]×[0,1]$ above line $Y = \frac{X}{\alpha}$.
Draw that line and compute the square of the area above that line, you'll get two cases
$$ P(Z \le \alpha)= \begin{cases} \frac{\alpha}{2},& \text{if } \alpha\le 1\\ 1 - \frac{1}{2\alpha}, & \text{otherwise} \end{cases} $$ That's distribution function for $Z$.
You can notice CDF is differentiable everywhere including $1$, thus you can get pdf as well