Dividing Two Random Variables I am having trouble with a problem that I am working on for a course.  I am not looking for an answer to the question (I have the answer), but I am rather looking for understanding of the concept.  Let me pose the question.  The parts I have questions about I will mark to the right with a bold Q and a number, i.e. Q1, Q2, etc.
"The random variables $X$ and $Y$ are independent and uniform on the interval $(0,a)$.  Find the p.d.f. of $\frac{X}{Y}$"
Worked solution for this problem looks like so:
$Z=\frac{X}{Y}$
$F_Z(z)=P\left \{ \frac{X}{Y} \leq z \right \}$
$F_Z(z)=P\left \{ X \leq zY \right \}$ Q1
Case 1: $z < 1$ Q2
$F_Z(z)=\int_{0}^{a}\int_{0}^{zy}f_x(x)f_y(y)dxdy$ Q3 Q4
$F_Z(z)=\int_{0}^{a}\int_{0}^{zy}(\frac{1}{a})(\frac{1}{a})dxdy$
$F_Z(z)=\frac{z}{2}$ for all $z\leq1$ Q5
Case 2: $z \geq 1$
$F_Z(z)=P\left \{ X \leq zY \right \}$
$F_Z(z)=1-\int_{0}^{a}\int_{0}^{x/z}f_x(x)f_y(y)dxdy$ Q6 Q7
$F_Z(z)=1-\int_{0}^{a}\int_{0}^{x/z}(\frac{1}{a})(\frac{1}{a})dxdy$
$F_Z(z)=1-\int_{0}^{a}(\frac{x}{z})dx$
$F_Z(z)=1-\frac{1}{2z}$ for all $z>1$ Q8
From there, I understand differentiate to find the p.d.f. of each case, which makes sense.
I understand that the p.d.f. of a uniform distribution is $\frac{1}{b-a}$ for the interval $(a,b)$, which in this case makes the p.d.f. for both $X$ and $Y$ equal to $\frac{1}{a}$.
Here are my numerous questions about this process:
Q1 - Why is moving the random variable $Y$ to the $z$ side of the inequality necessary?
Q2 - How are the cases selected?
Q3 - Where do these limits of integration come from?
Q4 - Why are the two functions $f_x(x)$ and $f_y(y)$ now multiplied, when they were divided in the initial question?
Q5 - Why does the case selected show $z<1$ but the final CDF solved for gives $z \leq 1$?
Q6 - Where do these limits of integration come from?  Why are they so different from Case 1?
Q7 - Why is this equations now $1-\int$ whereas Case 1 was just the $\int$
Q8 - Much like Q5 how did these inequalities change?
I know this is quite a bit, but I am very lost on this concept.  I seem to be lacking an overall understanding of random variables that is causing a significant amount of confusion in a problem like this.
Thank you for any help you can provide with this!
If this is a bit much, please let me know how I can best post these kinds of questions in the future.
 A: A picture of an event usually helps in finding its probability.

Each panel graphs the relation $x/y \le z$ for typical values of the number $z \gt 0.$ (When $z\lt 0,$ no points in the unit square satisfy this inequality, so the relation is empty.)  I have chosen units of measurement in which the constant $a$ is one unit.  This does not affect the ratio $X/Y,$ so we needn't adjust $z$ at all.
Before we proceed, notice that since $X$ and $Y$ are uniform and independent, the probability of any event is just its area relative to that of the entire square.  Thus, elementary Euclidean geometry affords immediate answers which we may use to check the integrations:

*

*The probability of the left event is the area of the triangle.  This triangle has height $1$ and base $z,$ whence its area is $(z)(1)/2 = z/2.$


*The probability of the right event is the area of the trapezoid.  It has bases $1$ and $1-1/z$ and height (looking sideways) of $1,$ whence its area is $(1\,+\,1-1/z)(1)/2 = 1-1/(2z).$

Here is how the picture immediately answers all your questions:

*

*It isn't necessary to re-express the event $X/Y \le z$ as $X \le zY,$ but doing so makes it clear that this event is bounded by the line $x = zy$ (shown by the dotted lines in the figure).  It passes through the origin with slope $1/z.$


*At the left where $z\lt 1$ the event is a triangle whereas at the right where $z \ge 1$ it is a trapezoid.  Their probabilities are calculated slightly differently.


*The limits of integration describe the triangle in the left panel.


*The functions $f_x$ and $f_y$ are probability density functions.  They multiply because you assume the random variables $X$ and $Y$ are independent.  The density of $X/Y$ is not usually given by $f_x/f_y.$  (Indeed, the ratio of densities is unitless whereas a density must have units of probability per (unit $x$ times unit $y$).)


*The given solution is sloppy about inequalities, but it doesn't matter because the case $z=1$ is illustrated by either panel.


*The limits of integration describe the (gray) triangle in the right panel that is complementary to the trapezoid.


*One could integrate directly over the trapezoid at the right, but it is simpler to integrate over its complement because that's equivalent to the computation already performed for the triangle at the left.


*There is no evident change in any of the inequalities.
