<s>[INST] Choosing an interval of the CDF to find each quartile I have a random variable $X$ which has the following CDF:
$$F(y) = \left\{\begin{array}{ll}
0 & : y \lt 0\\
\frac{y}{30} & : 0 \le y \lt 20\\
\frac{2}{3} + \frac{y-20}{60} & : 20 \le y \lt 40\\
1 & : y \ge 40
\end{array}
\right.$$
To find the median of $X$, I know I need to plug $q_2$ into the CDF and set it equal to 0.5:
$$ F(q_2) = 0.5 $$
and solve for $q_2$. But which interval of the CDF should I use? My intuition tells me it would be the third interval since 20 falls in the middle of 0 and 40 and this is the interval that would be used for $F(20)$, but I have a feeling this is wrong. Which one should I use for $q_2$, as well as $q_1$ and $q_3$?
 [/INST] If your random variable $X$ has the cdf 
$$F(y) = \left\{\begin{array}{ll}
0 & : y \lt 0\\
\frac{y}{30} & : 0 \le y \lt 20\\
\frac{2}{3} + \frac{y-20}{60} & : 20 \le y \lt 40\\
1 & : y \ge 40
\end{array}
\right.$$
you're supposed to find the inverse so you get $F(y) = \frac{y}{30}  $ for $y$. then the inverse is $30y$. If plug in $F^{-1}(.5) = \frac{1}{2}30 = 15$
I'll just note you switch from $X$ to $y$. You can also see it has $\frac{2}{3} + \frac{y-20}{60} $.  If you plug in $y=20$ you get $\frac{2}{3}$ 
</s>