Let X be a continuous random variable with probability density function f(x). Determine the value of y for which E(|X - y|) is minimum.
Not sure where to even begin. Any help is appreciated.
I was always told this was the median and I think I got it.
I've never done this before, so here's my work...
$\displaystyle \int_{-\infty}^{\infty}|x-y|f(x)dx= \int_{-\infty}^y(-x+y)f(x)dx+ \int_y^{\infty}(x-y)f(x)dx$
$\displaystyle = -\int_{-\infty}^yxf(x)dx+y\int_{-\infty}^yf(x)dx+ \int_y^{\infty}xf(x)dx-y\int_y^{\infty}f(x)dx$
$\displaystyle = -\int_{-\infty}^yxf(x)dx+\int_y^{\infty}xf(x)dx+y\int_{-\infty}^yf(x)dx+ -y\int_y^{\infty}f(x)dx$
$\displaystyle = -\int_{-\infty}^yxf(x)dx+E(X)-\int_{-\infty}^yxf(x)dx+yF(y) -y[1-F(y)]$
$\displaystyle =E(X) -2\int_{-\infty}^yxf(x)dx+2yF(y) -y$
NOW differentiate wrt y and use the fundamental theorem of calc...
$\displaystyle -2yf(y)+2F(y)+2yf(y) -1=2F(y)-1$
Set that equal to zero produces F(y)=.5 meaning y is the median.