Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been solving problems from the book by DeGroot and Schervish and I can't understand why m is the upper limit of integration in the solution to this problem. Why not the lower one?

Here is the problem:

Suppose that a random variable X has a continuous distribution for which the p.d.f. f is as follows:

$f(x) = 2x$ for $ 0< x <1, 0 $ otherwise

Determine the value of $d$ that minimizes $E(|X − d|)$.

Here is the solution:

$$ \int_0^m 2x \, dx=0.5 $$

Thank you very much in advance.

share|cite|improve this question
The answer from nbubis doesn't explain the last integral you gave. I've posted an answer that does. Setting that integral to $0.5$ is not "the solution", but it leads you quickly to the solution. – Michael Hardy Aug 18 '12 at 16:43
I find much confusion in the question and the answers. – Michael Hardy Aug 18 '12 at 21:30
...and now there's somewhat less confusion. – Michael Hardy Aug 18 '12 at 21:51
ahaha;) cool! mathematics doesnt like confusion although it has this inside of his blood.. – Seyhmus Güngören Aug 18 '12 at 21:54
up vote 0 down vote accepted

The expected value is given by (assuming $d$ is in $[0,1]$): $$E = \int_0^1{2x|x-d|}dx = \int_0^d{2x(d-x)}dx + \int_d^1{2x(x-d)}dx$$ $$ = -\frac{2}{3} + d - \frac{2d^3}{3}$$ Derive by $d$ and compare to zero: $$E' = 1 - 2d^2 = 0 \rightarrow d = \frac{1}{\sqrt{2}}$$

share|cite|improve this answer
Thank you very much for the thorough explanation, nbubis! – Alan Aug 18 '12 at 10:56
I got $2d^2-1$, and so should you. – Michael Hardy Aug 18 '12 at 21:29
@MichaelHardy yes you are right. WHILE I posted my answer I did it based on nbubis's answer. I didnt check it by myself. I only focused on the second part of the question which say minimum! although it seemed to be maximum based on his answer. But you are completely right. – Seyhmus Güngören Aug 18 '12 at 21:41

The value of $d$ that that minimizes $E(|X-d|)$ is the median value of $X$, i.e. the value $m$ such that $$ \Pr(X\le m) = 0.5 = \Pr(X\ge m). $$

Thus for continuous distirbutions it is the value of $m$ for which $$ \int_{-\infty}^m f_X(x)\,dx = 0.5 = \int_m^\infty f_X(x)\,dx. $$

In your case, you want $$ \int_0^m 2x\,dx = 0.5 = \int_m^1 2x\,dx. $$ So $m^2 -0^2 = 0.5 = 1^2-m^2$. Consequently $m= \sqrt{0.5}= \sqrt{2}/2$.

share|cite|improve this answer

I will note one important thing about the question. You will get $$E^{'}[X]=1-2d^2$$ as @nbubis wrote down already. When you find $$E^{''}[X]=-4d$$ and since $d\in[0,1]$ you have $$E^{''}[X]<0$$ which indicates that you have a maximum instead of minimum as you stated in the question EDIT: Result was based on $$E^{'}[X]=1-2d^2$$ Since it is $$E^{'}[X]=2d^2-1,$$ there is a minimum. I didnt solve the first derivative by myself just copied.

share|cite|improve this answer
Thank you very much for clarification! – Alan Aug 18 '12 at 11:40
@Alan my pleasure;) – Seyhmus Güngören Aug 18 '12 at 11:41
This is nonsense. You get a minimum, not a maximum. The derivative should be $2d^2-1$, not $1-2d^2$. – Michael Hardy Aug 18 '12 at 21:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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