finding the median of piecewise function A random variable $X$ has the pdf
$f(x) = \begin{cases}x^2 \text{ if } 0 < x \leq 1 \\ 2/3 \text{ if } 1 < x \leq 2\\ 0 \text{ otherwise } \end{cases}$
How do I work with the 2/3 if I'm finding the median?
 A: [My first advice is never look at the answer in the back of the book -- I offer this advice in full seriousness, but nobody seems to take it. At the very least, not until you have solved it and proved beyond any reasonable doubt that you have solved it correctly, and preferably not even then. For some reason "knowing the answer" before tackling the problem seems highly inclined to produce shallow, muddied thinking that actually interferes with progress. Instead work on being aware of definitions, what tools you have that relate to those definitions and how they work, understanding what you're trying to achieve, and spending time thinking about the problem. If you can't get anywhere, revisit your definitions and tools and then make an easier version of the problem and solve it first.]
The first step is to draw the density so you can see what you're doing.
You need the area of the left part plus area of the part marked A to add to 1/2 

The left part has area 1/3 so A must have area ... ?
Now A is a rectangle. You can see the height of the rectangle. What must its width be?
Given its width, what must $m$ be?
Alternative approach: calculate the area to the right of $m$ to be 1/2 (the unmarked part). Now you only have a single rectangle to deal with. If the area is 1/2, and the height is known, what's its width? So what must $m$ be?
Now think about how to split the integral of $f$ up into pieces so you can do it algebraically. You presumably know that for $a<b<c$ you can write $\int_a^c g(x) dx=\int_a^b g(x) dx+\int_b^c g(x) dx$, since it's one of the most basic properties of integrals, and likely one you have used many times -- but it should also be intuitively obvious (e.g. when you cut a piece of paper into two pieces the total area is the same as what you started with).
A: The median $x_m$ is defined by $\Pr[X\leq x_m]=\frac{1}{2}$, so you need to compute the cumulative distribution
$$F[x]=\Pr[X\leq x]=\int_0^xf[x]dx$$
You can substitute the piecewise definition of $f[x]$ into this equation.
Hint: If $x_m\leq1$ then you do not need the second part of $f$. How can you check if this is the case?
If $x_m>1$, then can you use the previous result to help determine $F[x]$ for $x>1$?
A: You need to integrate 3/2 from 1 to $m$ (median) that should be equated to $(1/2-1/3).$ That gives you the answer: 5/4.
