Consider a continuous random variable X with probability density function given by $f(x)=cx$ for $1 \le x \le 5$, zero otherwise. Find the median.

First I calculate the CDF: $F(x)=cx^2/2$ for $1 \le x \le 5$, zero otherwise.

Now we have to solve for constant c by using the definition of PDF, namely:

$\int\limits_{-\infty}^{\infty}f(x)dx=1 \implies (cx^2/2)_1^5=1 \implies c=1/12 $

Then to calculate the median, we set the CDF = 0.5:

$0.5=(1/12)(1/2)x^2 \implies x=\sqrt{12}$

But the book solution is $\sqrt{13}$. Can someone tell me what I am doing wrong?

Thank you.

  • $\begingroup$ @Eupraxis1981: I don't think so. Please check my answer. $\endgroup$
    – Rasmus
    Oct 29, 2013 at 13:58
  • $\begingroup$ The function $F(x)=cx^2/2$ is not the correct CDF here: its value at $1$ should be $0$. $\endgroup$
    – Rasmus
    Oct 29, 2013 at 14:03
  • 1
    $\begingroup$ "First I calculate the CDF" When I do that, I find $F(x)=\frac12c(x^2-1)$ for $x$ in $(1,5)$, $F(x)=0$ for $x\leqslant1$, and $F(x)=1$ for $x\geqslant5$, not what you wrote. $\endgroup$
    – Did
    Oct 29, 2013 at 14:03

3 Answers 3


Recall that there is an integration constant when finding the CDF $F(x)$.

Also recall that the CDF should take on the value ZERO when $x$ is from minus infinity to $x=1$ and it must take on the value ONE from $x=5$ to plus infinity. (i.e. the CDF is a non-decreasing function on the support of the density $f(x)$).

If you counter verify, you will see that the above paragraph does not hold for the CDF you found above, in your question.

Reworking on the problem, you should find an appropriate CDF. Simply put: the CDF should be

$$ F(x) = \frac{x^2}{24} - \frac{1}{24} $$

We see that $F(1) = 0$ and that $F(5) = 1$ indeed.


$$ 0.5 = \frac{x^2}{24} - \frac{1}{24} $$

Solving for $x$ yields that the median equals $\sqrt{13}$


You forgot the integration constant.

Calculating the CDF gives $F(x)=cx^2/2+d$ on $1\leq x\leq 5$, $F(x)=0$ for $x<1$ and $F(x)=1$ for $x>1$. Setting $F(1)=0$ and $F(5)=1$, we get $c=1/12$ and $d=-1/24$. The solution for $F(x)=1/2$ is then indeed $\sqrt{13}$.

  • $\begingroup$ I thought you only need integration constant if you are taking an indefinite integral. My integral is definite: from 1-5. $\endgroup$ Oct 29, 2013 at 13:59
  • $\begingroup$ @Eupraxis1981: Please see my comment below the question to see why the constant matters. $\endgroup$
    – Rasmus
    Oct 29, 2013 at 14:04
  • 1
    $\begingroup$ user1527227: I've removed my comment, since Rasmus is correct. My oversight (I was moving too quickly) is not carrying through the lower bound on the definite integral. However, its not a "constant of integration" but merely the lower value of the definite integral, i.e., $F(1) = \frac{1}{24}$, so $F(x) = \frac{x^2}{24} - \frac{1}{24}$ thats where the additional term comes from. $\endgroup$
    – user76844
    Oct 29, 2013 at 14:05
  • $\begingroup$ Yeah thanks guys! I also see I could have just changed my limits of integration from 1 to x and that would also work! $\endgroup$ Oct 29, 2013 at 14:13
  • $\begingroup$ @Eupraxis1981 You may call it however you like. In any case, it's this constant in the integral that one needs to work things out. $\endgroup$
    – Rasmus
    Oct 29, 2013 at 14:18

For median $m$:

$$ \int\limits_{-\infty}^{m} f(x) dx = \int\limits_{m}^{+\infty} f(x) dx\\ \int\limits_{1}^{m} f(x) dx = \int\limits_{m}^{5} f(x) dx\\ c \frac{x^2}{2}\Biggr|_{1}^{m} = c \frac{x^2}{2}\Biggr|_{m}^{5}\\ x^2\Biggr|_{1}^{m} = x^2\Biggr|_{m}^{5}\\ m = \sqrt{\frac{1^2 + 5^2}{2}}=\sqrt{13} $$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.