I have a probability density function:

$f(x) = \begin{cases} \frac 1 4xe^{\frac {-x}2}, & x\ge0 \\ 0, & x < 0\end{cases}$

To add more detail, cdf is:

$F(x) = \begin{cases} 1+\frac{-1}2xe^{\frac {-x}2}-e^{\frac {-x}2}, & x\ge0 \\ 0, & x < 0\end{cases}$

Find the $Med(x)$.


$$\int_{-\infty}^{x} f(x) dx=1+\frac{-1}2xe^{\frac {-x}2}-e^{\frac {-x}2}=\frac 12$$

I found 2 values $3.3567$ and $-1.5361$, and my book said that the answer is $-1.5361$. This is confusing because I thought $Med(X)\ge 0$.

  • $\begingroup$ The median is unique. So you can’t find two values. $\endgroup$ – mathcounterexamples.net Dec 26 '18 at 13:16
  • $\begingroup$ I solve the equation and it gives me 2 $x$ values, I haven't determined which $Med(X)$ is yet. $\endgroup$ – Tjh Thon Dec 26 '18 at 13:17
  • $\begingroup$ Which equation did you solve? Please update the question with what you did. $\endgroup$ – mathcounterexamples.net Dec 26 '18 at 13:18
  • $\begingroup$ I have edited my post. $\endgroup$ – Tjh Thon Dec 26 '18 at 13:24
  • 2
    $\begingroup$ Only the non-negative solution should be median since you used that part of the cdf for which $x\ge 0$; $F(x)$ cannot be $1/2$ for any $x<0$. $\endgroup$ – StubbornAtom Dec 26 '18 at 13:46

Your PDF is for the distribution $\mathsf{Gamma}(\text{shape}=2,\text{rate}=\frac 1 2).$ See the relevant Wikipedia page (or your textbook) for details. You seek $F_X^{-1}(\frac 1 2) = 3.356694.$

In R statistical software, the inverse CDF (quantile function) is denoted qgamma with appropriate arguments.

[1] 3.356694

I agree with the comment of @StubbornAtom, that the median cannot be negative. The "answer" −1.5361 is simply wrong.

Here is a graph of the PDF, with the location of the median shown by a dotted red line.

enter image description here


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.