We try to find c value minimizing E[|x-c|], "expected value of absolute deviations", for a continuous random variable X.
E[|x-c|]=Integral(-inf,inf)[|x-c|]f(x)dx =Integral(-inf,c)[-x+c]f(x)dx+Integral(c,inf)[x-c]f(x)dx
Now I want to take first derivative here, with respect to c and set it equal to 0. I know I should use the rule "If you integrate a function f and then differentiate the integral with respect to its upper endpoint (y above) you get f back again" but I think I miss the trick.
How can I proceed?
Best regards..