The definition of median, $m$, for a continuous random variable $X$ is $$P(X\leq m)=P(X\geq m)=\int_{-\infty}^m f(x)\text{d}x=\int_{m}^{\infty}f(x)\text{d}x=\frac{1}{2}$$
where $f(x)$ is the pdf of $X$.
Now the problem goes as follows:
Show that if $X$ is a continuous random variable, then $$min_{a} (E|X-a|)=E|X-m|$$
The work I have done for this problem:
WORK
Have that $$E|X-a|=\int_{\mathbb{R}} |x-a|f(x)\text{d}x=\int_{a}^{\infty}(x-a)f(x)\text{d}x-\int_{-\infty}^a (x-a)f(x)\text{d}x$$ Differentiation with respect to $x$ gives us $$\frac{d}{dx}E|X-a|=\int_{a}^{\infty} f(x)\text{d}x-\int_{-\infty}^a f(x)\text{d}x$$ Setting this equal to 0, we find that $$\int_{a}^{\infty} f(x)\text{d}x= \int_{-\infty}^a f(x)\text{d}x$$ We know that $$\int_{\mathbb{R}}f(x)\text{d}x=1$$ $$\implies \int_{a}^{\infty} f(x)\text{d}x= \int_{-\infty}^a f(x)\text{d}x=\frac{1}{2}$$ Hence, $a$ must be our median, by definition.
What I am confused on is showing the minimal property. I looked up what I could, and it appears that using the second derivative to show that we produce a positive value for f(a) present us with minimality, but I don't really understand why. Potentially a very naïve question, but why does f(a)>0 for second-derivative have significance? Is it because of the absolute-value property on $X-a$?