This is from the book Python for Probability, Statistics, and Machine Learning. It's a good book for people that already have a math background, I believe. Anyway, there is something I don't understand and I hope you guys could give me a hand.
Given $Z = \frac{X}{Y-X}$, where $Y$ and $X$ are uniformly distributed in $[0,1]$. I would like to obtain the density $f_Z(z)$.
That is, $$P(Z<z) = \iint B_1 dX dY$$ with $$ B_1 = \{0<Z<z\}$$
From here it is true that $Y>X$ and that $Y>X(1/z+1)$, but the author then states, and I quote:
Putting this together gives $$A_1 = \{\mbox{max}(X,X(1/z+1)) < Y < 1 \}$$
Integrating over $Y$ as follows
$$\int_0^1 \{\mbox{max}\left(X,X(1/z+1)\right) < Y < 1 \} dY = \frac{z-X-Xz}{z} \mbox{ where } z> \frac{X}{1-X}$$
I get that $\frac{z-X-Xz}{z}$ is a fancy way of writing $1 - X(1/z+1)$, but I don't know how to obtain that result and particularly how to integrate over this function $\mbox{max\{\}}$. Plus I don't get the condition of $z$
How would you explain this? I hope this is the place for such a question. Thanks