In Element of Statistical learning it is saying on page 20, equation 2.18. That using the L1 norm instead of the usual L2 norm leads to an $f(X)$ optimising the EPE being the median instead of the regression function.
I am trying to prove this fact as follow:
Considering that it still suffice to minimize the Expected predicted error pointwise for each x i.e. we have still equation 2.12 holding up from page 18:
$f(X) = argmin_cE_{Y|X}((|Y-c|) |X)$
then I try to find c that minimize the Expectation as follow:
\begin{equation} \begin{split} \frac{\partial E_{Y|X}((|Y-c|) |X)}{\partial c} \overset{!}{=} 0 \Leftrightarrow \int_Y - \frac{y - c}{| y - c |} p_{Y|X}(y|x)dy = 0 \end{split} \end{equation}
but I am stuck here as I don't see how to show that:
$$ \int_Y - \frac{y - c}{| y - c |} p_{Y|X}(y|x)dy = 0 $$
leads to $c$ being the median.