# Calculating Quantile for a specific problem

so I understand how to calculate the 0.5 quantile of the given question. I calculate the CDF of x and then I multiply it to 0.5 But what if there's more than one function for multiple intervals? How can I calculate the 0.5 quantile of that? The blue is what I am trying to find the 0.5 quantile of. It's the CDF I found from the PDF.

• You integrate up to the point of interest, piecewise if necessary. In other words, you "break up" the integral piecewise. – Em. Jun 5 '16 at 23:24

The calculated cdf is not quite right. We have $F(x)$ for $x\le 0$, and $F(x)=\frac{x}{12}$ for $0\lt x\lt 2$. We also have $F(x)=\frac{1}{6}$ between $2$ and $5$. So far fine.
Between $x=5$ and $x=10$, we have $$F(x)=\Pr(X\le x)=\frac{1}{6}+2\cdot\frac{x-5}{12},$$ which is $\frac{x-4}{6}$. More generally, we can write for $x$ in this interval $$F(x)=F(5)+\int_5^x f(t)\,dt.$$
And finally $F(x)=0$ for $x\ge 10$.
The median ($0.5$ quantile) is located in the interval from $5$ to $10$. To find it, we solve $\frac{x-4}{6}=0.5$.
• You can check that $\frac{x-5}{10}$ between $5$ and $10$ is wrong in several ways. For example at a tiny bit past $5$, it gives probability near $0$, while of course we know there is a fair bit of weight (probability) in the interval up to $5$, namely $1/6$. Also $\frac{x-5}{6}$ gives the wrong answer at $x=10$. We have $1/6$ of the weight before $5$, and the bulk of the weight, $5/6$ of it, between $5$ and $10$. So the median will be between $5$ and $10$, roughly halfway but not quite because of the weight between $0$ and $5$. Solving, we get median $7$. – André Nicolas Jun 5 '16 at 23:48
• The language of quantiles is not quite uniform. One can use probabilities $0.25$, $0.5$, $0.9$, or percentages. Of course if we read $0.5$ as meaning $0.5\%$, then this quantile is not much greater than $0$. I interpreted $0.5$ as meaning $50\%$. – André Nicolas Jun 5 '16 at 23:51
• As to your teacher's solution that you linked to in a comment, it correctly said it was the area of the first rectangle plus the area of the part of the second rectangle between $5$ and $x$. (S)he calculated that area, but then forgot to do the plus. – André Nicolas Jun 5 '16 at 23:54